Mercurial > hg > graal-jvmci-8
changeset 22481:48c212309281
Merge
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Fri, 28 Aug 2015 11:25:42 -0700 |
parents | f5fee32d3d6e (diff) f9a6a2f0b414 (current diff) |
children | da68ca58b271 |
files | |
diffstat | 25 files changed, 179 insertions(+), 211 deletions(-) [+] |
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java Fri Aug 28 11:23:51 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java Fri Aug 28 11:25:42 2015 -0700 @@ -63,7 +63,13 @@ * Note that the number of locals and the number of stack slots may be smaller than the maximum * number of locals and stack slots as specified in the compiled method. */ - public final Value[] values; + public final JavaValue[] values; + + /** + * 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; /** * The number of locals in the values array. @@ -169,12 +175,14 @@ * @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, Value[] values, int numLocals, int numStack, int numLocks) { + public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, JavaValue[] values, Kind[] slotKinds, int numLocals, int numStack, + int numLocks) { super(caller, method, bci); assert values != null; this.rethrowException = rethrowException; this.duringCall = duringCall; this.values = values; + this.slotKinds = slotKinds; this.numLocals = numLocals; this.numStack = numStack; this.numLocks = numLocks; @@ -186,18 +194,17 @@ * slot following a double word item. This should really be checked in FrameState itself but * because of Word type rewriting and alternative backends that can't be done. */ - public boolean validateFormat(boolean derivedOk) { + public boolean validateFormat() { if (caller() != null) { - caller().validateFormat(derivedOk); + caller().validateFormat(); } for (int i = 0; i < numLocals + numStack; i++) { if (values[i] != null) { - Kind kind = values[i].getKind(); + Kind kind = slotKinds[i]; if (kind.needsTwoSlots()) { - assert values.length > i + 1 : String.format("missing second word %s", this); - assert values[i + 1] == null || values[i + 1].getKind() == Kind.Illegal : this; + assert slotKinds.length > i + 1 : String.format("missing second word %s", this); + assert slotKinds[i + 1] == Kind.Illegal : this; } - assert derivedOk || ValueUtil.isIllegal(values[i]) || !values[i].getLIRKind().isUnknownReference() : "Unexpected derived value: " + values[i]; } } return true; @@ -209,7 +216,7 @@ * @param i the local variable index * @return the value that can be used to reconstruct the local's current value */ - public Value getLocalValue(int i) { + public JavaValue getLocalValue(int i) { return values[i]; } @@ -219,7 +226,7 @@ * @param i the stack index * @return the value that can be used to reconstruct the stack slot's current value */ - public Value getStackValue(int i) { + public JavaValue getStackValue(int i) { return values[i + numLocals]; } @@ -229,7 +236,7 @@ * @param i the lock index * @return the value that can be used to reconstruct the lock's current value */ - public Value getLockValue(int i) { + public JavaValue getLockValue(int i) { return values[i + numLocals + numStack]; }
--- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/StackLockValue.java Fri Aug 28 11:23:51 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/StackLockValue.java Fri Aug 28 11:25:42 2015 -0700 @@ -28,24 +28,23 @@ /** * Represents lock information in the debug information. */ -public final class StackLockValue extends AbstractValue implements JavaValue { +public final class StackLockValue implements JavaValue { - private Value owner; + private JavaValue owner; private StackSlotValue slot; private final boolean eliminated; - public StackLockValue(Value object, StackSlotValue slot, boolean eliminated) { - super(LIRKind.Illegal); + public StackLockValue(JavaValue object, StackSlotValue slot, boolean eliminated) { this.owner = object; this.slot = slot; this.eliminated = eliminated; } - public Value getOwner() { + public JavaValue getOwner() { return owner; } - public void setOwner(Value newOwner) { + public void setOwner(JavaValue newOwner) { this.owner = newOwner; }
--- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/ValueUtil.java Fri Aug 28 11:23:51 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/ValueUtil.java Fri Aug 28 11:25:42 2015 -0700 @@ -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,16 +36,21 @@ return Value.ILLEGAL.equals(value); } + public static boolean isIllegalJavaValue(JavaValue value) { + assert value != null; + return Value.ILLEGAL.equals(value); + } + public static boolean isLegal(Value value) { return !isIllegal(value); } - public static boolean isVirtualObject(Value value) { + public static boolean isVirtualObject(JavaValue value) { assert value != null; return value instanceof VirtualObject; } - public static VirtualObject asVirtualObject(Value value) { + public static VirtualObject asVirtualObject(JavaValue value) { assert value != null; return (VirtualObject) value; } @@ -55,6 +60,11 @@ return value instanceof JavaConstant; } + public static boolean isConstantJavaValue(JavaValue value) { + assert value != null; + return value instanceof JavaConstant; + } + public static JavaConstant asConstant(Value value) { assert value != null; return (JavaConstant) value;
--- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/VirtualObject.java Fri Aug 28 11:23:51 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/VirtualObject.java Fri Aug 28 11:25:42 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -31,10 +31,11 @@ * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the * object. */ -public final class VirtualObject extends AbstractValue implements JavaValue { +public final class VirtualObject implements JavaValue { private final ResolvedJavaType type; - private Value[] values; + private JavaValue[] values; + private Kind[] slotKinds; private final int id; /** @@ -46,24 +47,20 @@ * * @param type the type of the object whose allocation was removed during compilation. This can * be either an instance of an array type. - * @param values an array containing all the values to be stored into the object when it is - * recreated * @param id a unique id that identifies the object within the debug information for one * position in the compiled code. * @return a new {@link VirtualObject} instance. */ - public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) { - return new VirtualObject(type, values, id); + public static VirtualObject get(ResolvedJavaType type, int id) { + return new VirtualObject(type, id); } - private VirtualObject(ResolvedJavaType type, Value[] values, int id) { - super(LIRKind.reference(Kind.Object)); + private VirtualObject(ResolvedJavaType type, int id) { this.type = type; - this.values = values; this.id = id; } - private static StringBuilder appendValue(StringBuilder buf, Value value, Set<VirtualObject> visited) { + private static StringBuilder appendValue(StringBuilder buf, JavaValue value, Set<VirtualObject> visited) { if (value instanceof VirtualObject) { VirtualObject vo = (VirtualObject) value; buf.append("vobject:").append(vo.type.toJavaName(false)).append(':').append(vo.id); @@ -118,11 +115,18 @@ /** * Returns an array containing all the values to be stored into the object when it is recreated. */ - public Value[] getValues() { + public JavaValue[] getValues() { return values; } /** + * Returns an array containing the Java kind of all values in the object. + */ + public Kind[] getSlotKinds() { + return slotKinds; + } + + /** * Returns the unique id that identifies the object within the debug information for one * position in the compiled code. */ @@ -130,16 +134,18 @@ return id; } - private static boolean checkValues(ResolvedJavaType type, Value[] values) { + private boolean checkValues() { + assert (values == null) == (slotKinds == null); if (values != null) { + assert values.length == slotKinds.length; if (!type.isArray()) { ResolvedJavaField[] fields = type.getInstanceFields(true); int fieldIndex = 0; for (int i = 0; i < values.length; i++) { ResolvedJavaField field = fields[fieldIndex++]; - Kind valKind = values[i].getKind().getStackKind(); + Kind valKind = slotKinds[i].getStackKind(); if (field.getKind() == Kind.Object) { - assert values[i].getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind(); + assert valKind.isObject() : field + ": " + valKind + " != " + field.getKind(); } else { if ((valKind == Kind.Double || valKind == Kind.Long) && field.getKind() == Kind.Int) { assert fields[fieldIndex].getKind() == Kind.Int; @@ -154,12 +160,12 @@ Kind componentKind = type.getComponentType().getKind().getStackKind(); if (componentKind == Kind.Object) { for (int i = 0; i < values.length; i++) { - assert values[i].getLIRKind().isReference(0) : values[i].getKind() + " != " + componentKind; + assert slotKinds[i].isObject() : slotKinds[i] + " != " + componentKind; } } else { for (int i = 0; i < values.length; i++) { - assert values[i].getKind() == componentKind || componentKind.getBitCount() >= values[i].getKind().getBitCount() || - (componentKind == Kind.Int && values[i].getKind().getBitCount() >= Kind.Int.getBitCount()) : values[i].getKind() + " != " + componentKind; + assert slotKinds[i] == componentKind || componentKind.getBitCount() >= slotKinds[i].getBitCount() || + (componentKind == Kind.Int && slotKinds[i].getBitCount() >= Kind.Int.getBitCount()) : slotKinds[i] + " != " + componentKind; } } } @@ -172,15 +178,17 @@ * * @param values an array containing all the values to be stored into the object when it is * recreated. + * @param slotKinds an array containing the Java kinds of the values. */ - public void setValues(Value[] values) { - assert checkValues(type, values); + public void setValues(JavaValue[] values, Kind[] slotKinds) { this.values = values; + this.slotKinds = slotKinds; + assert checkValues(); } @Override public int hashCode() { - return getLIRKind().hashCode() + type.hashCode(); + return 42 + type.hashCode(); } @Override
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCompiledCode.java Fri Aug 28 11:23:51 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotCompiledCode.java Fri Aug 28 11:25:42 2015 -0700 @@ -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 @@ -138,7 +138,7 @@ Infopoint info = (Infopoint) site; if (info.debugInfo != null) { BytecodeFrame frame = info.debugInfo.frame(); - assert frame == null || frame.validateFormat(false); + assert frame == null || frame.validateFormat(); } } }
--- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java Fri Aug 28 11:23:51 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java Fri Aug 28 11:25:42 2015 -0700 @@ -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 @@ -49,6 +49,11 @@ PrimitiveConstant FALSE = new PrimitiveConstant(Kind.Boolean, 0L); /** + * Returns the Java kind of this constant. + */ + Kind getKind(); + + /** * Checks whether this constant is null. * * @return {@code true} if this constant is the null constant
--- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaValue.java Fri Aug 28 11:23:51 2015 -0700 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaValue.java Fri Aug 28 11:25:42 2015 -0700 @@ -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 @@ -23,12 +23,7 @@ package jdk.internal.jvmci.meta; /** - * Interface for things that represent a Java value. + * Marker interface for things that represent a Java value. */ public interface JavaValue { - - /** - * Returns the kind of this value. - */ - Kind getKind(); }
--- a/make/bsd/makefiles/vm.make Fri Aug 28 11:23:51 2015 -0700 +++ b/make/bsd/makefiles/vm.make Fri Aug 28 11:25:42 2015 -0700 @@ -134,10 +134,6 @@ LIBS += -pthread endif -ifeq ($(OS_VENDOR),Darwin) - LIBS += -framework ApplicationServices -framework IOKit -endif - # By default, link the *.o into the library, not the executable. LINK_INTO$(LINK_INTO) = LIBJVM
--- a/mx.jvmci/mx_jvmci.py Fri Aug 28 11:23:51 2015 -0700 +++ b/mx.jvmci/mx_jvmci.py Fri Aug 28 11:25:42 2015 -0700 @@ -1373,10 +1373,11 @@ mx.log('Skipping dependency ' + groupId + '.' + artifactId + ' as ' + name + ' cannot be resolved') return if dep.isDistribution(): - allDeps = allDeps + [d.name for d in dep.archived_deps() if d.isJavaProject()] + allDeps = allDeps + [d for d in dep.archived_deps() if d.isJavaProject()] else: - allDeps.append(name) - d = mx.Distribution(_suite, name=artifactId, subDir=_suite.dir, path=path, sourcesPath=path, deps=allDeps, mainClass=None, excludedLibs=[], distDependencies=[], javaCompliance=None) + allDeps.append(dep) + d = mx.JARDistribution(_suite, name=artifactId, subDir=_suite.dir, path=path, sourcesPath=path, deps=allDeps, \ + mainClass=None, excludedLibs=[], distDependencies=[], javaCompliance=None, platformDependent=False, theLicense=None) d.make_archive() env = os.environ.copy() env['JAVA_HOME'] = get_jvmci_jdk(vmToCheck='server') @@ -1530,6 +1531,12 @@ for suite in matchedSuites: absoluteMicro = os.path.join(jmhPath, suite) (pfx, exe, vm, forkedVmArgs, _) = parseVmArgs(vmArgs) + def quoteSpace(s): + if " " in s: + return '"' + s + '"' + return s + + forkedVmArgs = map(quoteSpace, forkedVmArgs) if pfx: mx.log("JMH ignores prefix: \"" + ' '.join(pfx) + "\"") javaArgs = ['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), @@ -1541,46 +1548,6 @@ javaArgs.append(str(v)) mx.run_java(javaArgs + regex, addDefaultArgs=False, cwd=jmhPath) -def microbench(args): - """run JMH microbenchmark projects""" - vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True) - - # look for -f in JMH arguments - containsF = False - forking = True - for i in range(len(jmhArgs)): - arg = jmhArgs[i] - if arg.startswith('-f'): - containsF = True - if arg == '-f' and (i+1) < len(jmhArgs): - arg += jmhArgs[i+1] - try: - if int(arg[2:]) == 0: - forking = False - except ValueError: - pass - - # default to -f1 if not specified otherwise - if not containsF: - jmhArgs += ['-f1'] - - # find all projects with a direct JMH dependency - jmhProjects = [] - for p in mx.projects(): - if 'JMH' in p.deps: - jmhProjects.append(p.name) - cp = mx.classpath(jmhProjects) - - # execute JMH runner - args = ['-cp', cp] - if not forking: - args += vmArgs - args += ['org.openjdk.jmh.Main'] - if forking: - (_, _, jvm, _, _) = parseVmArgs(vmArgs) - args += ['--jvmArgsPrepend', ' '.join(['-' + jvm] + vmArgs)] - vm(args + jmhArgs) - def hsdis(args, copyToDir=None): """download the hsdis library
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -3542,7 +3542,7 @@ masm->block_comment("BEGIN JVMCI"); int implicit_exception_uncommon_trap_offset = __ offset() - start; __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()), O7); - DEBUG_ONLY(__ st(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())));) + __ st(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()))); __ add(O7, -8, O7); int uncommon_trap_offset = __ offset() - start; @@ -3557,7 +3557,7 @@ __ ld(G2_thread, in_bytes(JavaThread::pending_deoptimization_offset()), O1); __ sub(G0, 1, L1); - __ st_ptr(L1, G2_thread, in_bytes(JavaThread::pending_deoptimization_offset())); + __ st(L1, G2_thread, in_bytes(JavaThread::pending_deoptimization_offset())); __ mov((int32_t)Deoptimization::Unpack_reexecute, L0deopt_mode); __ mov(G2_thread, O0);
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -3397,7 +3397,7 @@ int implicit_exception_uncommon_trap_offset = __ pc() - start; __ pushptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()))); - DEBUG_ONLY(__ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())), (int32_t)NULL_WORD);) + __ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())), (int32_t)NULL_WORD); int uncommon_trap_offset = __ pc() - start;
--- a/src/os/bsd/vm/os_bsd.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/os/bsd/vm/os_bsd.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -3834,11 +3834,6 @@ return fetcher.result(); } -address os::get_pc(void* context) { - ucontext_t *uc = (ucontext_t*)context; - return os::Bsd::ucontext_get_pc(uc); -} - int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime) { return pthread_cond_timedwait(_cond, _mutex, _abstime);
--- a/src/os/linux/vm/os_linux.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/os/linux/vm/os_linux.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -5031,11 +5031,6 @@ return fetcher.result(); } -address os::get_pc(void* context) { - ucontext_t *uc = (ucontext_t*)context; - return os::Linux::ucontext_get_pc(uc); -} - int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime) { if (is_NPTL()) {
--- a/src/os/solaris/vm/os_solaris.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/os/solaris/vm/os_solaris.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -4265,11 +4265,6 @@ return fetcher.result(); } -address os::get_pc(void* context) { - ucontext_t *uc = (ucontext_t*)context; - return os::Solaris::ucontext_get_pc(uc); -} - // This does not do anything on Solaris. This is basically a hook for being // able to use structured exception handling (thread-local exception filters) on, e.g., Win32. void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread) {
--- a/src/os/windows/vm/os_windows.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/os/windows/vm/os_windows.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -3710,16 +3710,6 @@ #endif } -address os::get_pc(void* context) { - CONTEXT* uc = (CONTEXT*)context; -#ifdef _M_AMD64 - return (address) uc->Rip; -#else - return (address) uc->Eip; -#endif -} - - // GetCurrentThreadId() returns DWORD intx os::current_thread_id() { return GetCurrentThreadId(); }
--- a/src/share/vm/classfile/javaClasses.hpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/classfile/javaClasses.hpp Fri Aug 28 11:25:42 2015 -0700 @@ -154,7 +154,7 @@ return java_string->int_field(count_offset); } else { typeArrayOop value_array = ((typeArrayOop)java_string->obj_field(value_offset)); - if(value_array == NULL) { + if (value_array == NULL) { return 0; } else { return value_array->length();
--- a/src/share/vm/classfile/vmSymbols.hpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/classfile/vmSymbols.hpp Fri Aug 28 11:25:42 2015 -0700 @@ -299,7 +299,6 @@ template(selectAlternative_signature, "(ZLjava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;)Ljava/lang/invoke/MethodHandle;") \ \ /* Support for JVMCI */ \ - template(java_util_BitSet, "java/util/BitSet") \ JVMCI_ONLY(template(jdk_internal_jvmci_hotspot_HotSpotCompiledCode, "jdk/internal/jvmci/hotspot/HotSpotCompiledCode")) \ JVMCI_ONLY(template(jdk_internal_jvmci_hotspot_HotSpotCompiledCode_Comment, "jdk/internal/jvmci/hotspot/HotSpotCompiledCode$Comment")) \ JVMCI_ONLY(template(jdk_internal_jvmci_hotspot_HotSpotCompiledNmethod, "jdk/internal/jvmci/hotspot/HotSpotCompiledNmethod")) \
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -178,41 +178,39 @@ record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder); } -ScopeValue* CodeInstaller::get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) { - second = NULL; - if (value == AbstractValue::ILLEGAL()) { - return _illegal_value; - } - +static Location::Type get_oop_type(oop value) { oop lirKind = AbstractValue::lirKind(value); oop platformKind = LIRKind::platformKind(lirKind); - jint referenceMask = LIRKind::referenceMask(lirKind); - assert(referenceMask != -1, "derived pointers are not allowed"); - assert(referenceMask == 0 || referenceMask == 1, "unexpected referenceMask"); - bool reference = referenceMask == 1; + assert(LIRKind::referenceMask(lirKind) == 1, "unexpected referenceMask"); + + if (JVMCIRuntime::kindToBasicType(Kind::typeChar(platformKind)) == T_INT) { + return Location::narrowoop; + } else { + return Location::oop; + } +} - BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(platformKind)); - - if (value->is_a(RegisterValue::klass())) { +ScopeValue* CodeInstaller::get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) { + second = NULL; + if (value == AbstractValue::ILLEGAL()) { + assert(type == T_ILLEGAL, "expected legal value"); + return _illegal_value; + } else if (value->is_a(RegisterValue::klass())) { oop reg = RegisterValue::reg(value); jint number = code_Register::number(reg); VMReg hotspotRegister = get_hotspot_reg(number); if (is_general_purpose_reg(hotspotRegister)) { Location::Type locationType; - if (type == T_INT) { - locationType = reference ? Location::narrowoop : Location::int_in_long; - } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { - locationType = Location::int_in_long; - } else if (type == T_FLOAT) { + if (type == T_OBJECT) { + locationType = get_oop_type(value); + } else if (type == T_LONG) { + locationType = Location::lng; + } else { + assert(type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN, "unexpected type in cpu register"); locationType = Location::int_in_long; - } else if (type == T_LONG) { - locationType = reference ? Location::oop : Location::lng; - } else { - assert(type == T_OBJECT && reference, "unexpected type in cpu register"); - locationType = Location::oop; } ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); - if (type == T_LONG && !reference) { + if (type == T_LONG) { second = value; } return value; @@ -225,7 +223,6 @@ } else { locationType = Location::dbl; } - assert(!reference, "unexpected type in floating point register"); ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); if (type == T_DOUBLE) { second = value; @@ -239,51 +236,47 @@ } Location::Type locationType; - if (type == T_LONG) { - locationType = reference ? Location::oop : Location::lng; - } else if (type == T_INT) { - locationType = reference ? Location::narrowoop : Location::normal; - } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) { - locationType = Location::normal; - } else if (type == T_FLOAT) { - assert(!reference, "unexpected type in stack slot"); - locationType = Location::normal; + if (type == T_OBJECT) { + locationType = get_oop_type(value); + } else if (type == T_LONG) { + locationType = Location::lng; } else if (type == T_DOUBLE) { - assert(!reference, "unexpected type in stack slot"); locationType = Location::dbl; } else { - assert(type == T_OBJECT && reference, "unexpected type in stack slot"); - locationType = Location::oop; + assert(type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN, "unexpected type in stack slot"); + locationType = Location::normal; } ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); - if (type == T_DOUBLE || (type == T_LONG && !reference)) { + if (type == T_DOUBLE || type == T_LONG) { second = value; } return value; - } else if (value->is_a(JavaConstant::klass())){ + } else if (value->is_a(JavaConstant::klass())) { record_metadata_in_constant(value, _oop_recorder); if (value->is_a(PrimitiveConstant::klass())) { - assert(!reference, "unexpected primitive constant type"); - if(value->is_a(RawConstant::klass())) { + if (value->is_a(RawConstant::klass())) { jlong prim = PrimitiveConstant::primitive(value); return new ConstantLongValue(prim); - } else if (type == T_INT || type == T_FLOAT) { - jint prim = (jint)PrimitiveConstant::primitive(value); - switch (prim) { - case -1: return _int_m1_scope_value; - case 0: return _int_0_scope_value; - case 1: return _int_1_scope_value; - case 2: return _int_2_scope_value; - default: return new ConstantIntValue(prim); + } else { + assert(type == JVMCIRuntime::kindToBasicType(Kind::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) { + case -1: return _int_m1_scope_value; + case 0: return _int_0_scope_value; + case 1: return _int_1_scope_value; + case 2: return _int_2_scope_value; + default: return new ConstantIntValue(prim); + } + } else { + assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type"); + jlong prim = PrimitiveConstant::primitive(value); + second = _int_1_scope_value; + return new ConstantLongValue(prim); } - } else { - assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type"); - jlong prim = PrimitiveConstant::primitive(value); - second = _int_1_scope_value; - return new ConstantLongValue(prim); } } else { - assert(reference, "unexpected object constant type"); + assert(type == T_OBJECT, "unexpected object constant"); if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) { return _oop_null_scope_value; } else { @@ -294,6 +287,7 @@ } } } else if (value->is_a(VirtualObject::klass())) { + assert(type == T_OBJECT, "unexpected virtual object"); int id = VirtualObject::id(value); ScopeValue* object = objects->at(id); assert(object != NULL, "missing value"); @@ -314,10 +308,13 @@ bool isLongArray = klass == Universe::longArrayKlassObj(); objArrayOop values = VirtualObject::values(value); + objArrayOop slotKinds = VirtualObject::slotKinds(value); for (jint i = 0; i < values->length(); i++) { ScopeValue* cur_second = NULL; oop object = values->obj_at(i); - ScopeValue* value = get_scope_value(object, objects, cur_second); + oop kind = slotKinds->obj_at(i); + BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind)); + ScopeValue* value = get_scope_value(object, type, objects, cur_second); if (isLongArray && cur_second == NULL) { // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations. @@ -334,13 +331,13 @@ } MonitorValue* CodeInstaller::get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects) { - guarantee(value->is_a(StackLockValue::klass()), "Monitors must be of type MonitorValue"); + guarantee(value->is_a(StackLockValue::klass()), "Monitors must be of type StackLockValue"); ScopeValue* second = NULL; - ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), objects, second); + ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), T_OBJECT, objects, second); assert(second == NULL, "monitor cannot occupy two stack slots"); - ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), objects, second); + ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), T_LONG, objects, second); assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots"); assert(lock_data_value->is_location(), "invalid monitor location"); Location lock_data_loc = ((LocationValue*)lock_data_value)->location(); @@ -726,7 +723,7 @@ // Stubs do not record scope info, just oop maps return; } - + GrowableArray<ScopeValue*>* objectMapping = record_virtual_objects(debug_info); record_scope(pc_offset, position, objectMapping); } @@ -775,8 +772,10 @@ jint expression_count = BytecodeFrame::numStack(frame); jint monitor_count = BytecodeFrame::numLocks(frame); objArrayOop values = BytecodeFrame::values(frame); + objArrayOop slotKinds = BytecodeFrame::slotKinds(frame); assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length"); + assert(local_count + expression_count == slotKinds->length(), "unexpected slotKinds length"); GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL; GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL; @@ -791,13 +790,17 @@ ScopeValue* second = NULL; oop value = values->obj_at(i); if (i < local_count) { - ScopeValue* first = get_scope_value(value, objects, second); + oop kind = slotKinds->obj_at(i); + BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind)); + ScopeValue* first = get_scope_value(value, type, objects, second); if (second != NULL) { locals->append(second); } locals->append(first); } else if (i < local_count + expression_count) { - ScopeValue* first = get_scope_value(value, objects, second); + oop kind = slotKinds->obj_at(i); + BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind)); + ScopeValue* first = get_scope_value(value, type, objects, second); if (second != NULL) { expressions->append(second); }
--- a/src/share/vm/jvmci/jvmciCodeInstaller.hpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/jvmci/jvmciCodeInstaller.hpp Fri Aug 28 11:25:42 2015 -0700 @@ -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 @@ -117,7 +117,7 @@ static bool is_general_purpose_reg(VMReg hotspotRegister); private: - ScopeValue* get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second); + ScopeValue* get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second); MonitorValue* get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects); // extract the fields of the CompilationResult
--- a/src/share/vm/jvmci/jvmciCompiler.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/jvmci/jvmciCompiler.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -64,6 +64,12 @@ #ifdef COMPILERJVMCI void JVMCICompiler::bootstrap() { +#ifndef PRODUCT + // We turn off CompileTheWorld so that compilation requests are not + // ignored during bootstrap or that JVMCI can be compiled by C1/C2. + FlagSetting ctwOff(CompileTheWorld, false); +#endif + JavaThread* THREAD = JavaThread::current(); _bootstrapping = true; // Allow bootstrap to perform JVMCI compilations of itself
--- a/src/share/vm/jvmci/jvmciJavaAccess.hpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/jvmci/jvmciJavaAccess.hpp Fri Aug 28 11:25:42 2015 -0700 @@ -172,7 +172,8 @@ typeArrayOop_field(RegisterSaveLayout, slots, "[I") \ end_class \ start_class(BytecodeFrame) \ - objArrayOop_field(BytecodeFrame, values, "[Ljdk/internal/jvmci/meta/Value;") \ + objArrayOop_field(BytecodeFrame, values, "[Ljdk/internal/jvmci/meta/JavaValue;") \ + objArrayOop_field(BytecodeFrame, slotKinds, "[Ljdk/internal/jvmci/meta/Kind;") \ int_field(BytecodeFrame, numLocals) \ int_field(BytecodeFrame, numStack) \ int_field(BytecodeFrame, numLocks) \ @@ -188,6 +189,7 @@ start_class(JavaConstant) \ end_class \ start_class(PrimitiveConstant) \ + oop_field(PrimitiveConstant, kind, "Ljdk/internal/jvmci/meta/Kind;") \ long_field(PrimitiveConstant, primitive) \ end_class \ start_class(RawConstant) \ @@ -241,12 +243,13 @@ end_class \ start_class(VirtualObject) \ int_field(VirtualObject, id) \ - oop_field(VirtualObject, type, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ - objArrayOop_field(VirtualObject, values, "[Ljdk/internal/jvmci/meta/Value;") \ + 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;") \ end_class \ start_class(StackLockValue) \ - oop_field(StackLockValue, owner, "Ljdk/internal/jvmci/meta/Value;") \ - oop_field(StackLockValue, slot, "Ljdk/internal/jvmci/code/StackSlotValue;") \ + oop_field(StackLockValue, owner, "Ljdk/internal/jvmci/meta/JavaValue;") \ + oop_field(StackLockValue, slot, "Ljdk/internal/jvmci/code/StackSlotValue;") \ boolean_field(StackLockValue, eliminated) \ end_class \ start_class(SpeculationLog) \
--- a/src/share/vm/prims/nativeLookup.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/prims/nativeLookup.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -130,7 +130,6 @@ void JNICALL JVM_InitJVMCIClassLoader(JNIEnv *env, jclass c, jobject loader); void JNICALL JVM_InitializeJVMCINatives(JNIEnv *env, jclass compilerToVMClass); jobject JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c); - jobject JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c); jobject JNICALL JVM_GetJVMCIServiceImpls(JNIEnv *env, jclass c, jclass serviceClass); #endif }
--- a/src/share/vm/runtime/thread.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/runtime/thread.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -1489,9 +1489,7 @@ _pending_failed_speculation = NULL; _pending_transfer_to_interpreter = false; _jvmci._alternate_call_target = NULL; - // TODO: If _jvmci becomes a union, then this assignment - // should be converted to an assertion or guarantee - _jvmci._implicit_exception_pc = NULL; + assert(_jvmci._implicit_exception_pc == NULL, "must be"); if (JVMCICounterSize > 0) { _jvmci_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal); memset(_jvmci_counters, 0, sizeof(jlong) * JVMCICounterSize);
--- a/src/share/vm/runtime/thread.hpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/runtime/thread.hpp Fri Aug 28 11:25:42 2015 -0700 @@ -934,15 +934,14 @@ // Specifies if the DeoptReason for the last uncommon trap was Reason_transfer_to_interpreter bool _pending_transfer_to_interpreter; - // These fields are mutually exclusive in terms of live ranges - // so this could be a union instead of a struct. - struct { + // These fields are mutually exclusive in terms of live ranges. + union { // Communicates the pc at which the most recent implicit exception occurred // from the signal handler to a deoptimization stub. address _implicit_exception_pc; - // Communicates an alternative call target to an i2c stub from a JavaCall. - address _alternate_call_target; // + // Communicates an alternative call target to an i2c stub from a JavaCall . + address _alternate_call_target; } _jvmci; // Support for high precision, thread sensitive counters in JVMCI compiled code.
--- a/src/share/vm/utilities/vmError.cpp Fri Aug 28 11:23:51 2015 -0700 +++ b/src/share/vm/utilities/vmError.cpp Fri Aug 28 11:25:42 2015 -0700 @@ -539,18 +539,17 @@ STEP(102, "(printing code blob if possible)") if (_verbose && _context) { - address pc = os::get_pc(_context); - CodeBlob* cb = CodeCache::find_blob(pc); + CodeBlob* cb = CodeCache::find_blob(_pc); if (cb != NULL) { - if (Interpreter::contains(pc)) { + if (Interpreter::contains(_pc)) { // The interpreter CodeBlob is very large so try to print the codelet instead. - InterpreterCodelet* codelet = Interpreter::codelet_containing(pc); + InterpreterCodelet* codelet = Interpreter::codelet_containing(_pc); if (codelet != NULL) { codelet->print_on(st); Disassembler::decode(codelet->code_begin(), codelet->code_end(), st); } } else { - StubCodeDesc* desc = StubCodeDesc::desc_for(pc); + StubCodeDesc* desc = StubCodeDesc::desc_for(_pc); if (desc != NULL) { desc->print_on(st); Disassembler::decode(desc->begin(), desc->end(), st);