mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8213203: [JVMCI] adopt formatting changes from jvmci 8
Reviewed-by: kvn
This commit is contained in:
parent
7a350b9474
commit
a429adfa2d
44 changed files with 506 additions and 128 deletions
|
@ -209,6 +209,7 @@ OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) {
|
|||
return map;
|
||||
}
|
||||
|
||||
#if INCLUDE_AOT
|
||||
AOTOopRecorder::AOTOopRecorder(Arena* arena, bool deduplicate) : OopRecorder(arena, deduplicate) {
|
||||
_meta_refs = new GrowableArray<jobject>();
|
||||
}
|
||||
|
@ -268,6 +269,7 @@ void AOTOopRecorder::record_meta_ref(jobject o, int index) {
|
|||
assert(index == _meta_refs->length(), "must be last");
|
||||
_meta_refs->append(o);
|
||||
}
|
||||
#endif // INCLUDE_AOT
|
||||
|
||||
void* CodeInstaller::record_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS) {
|
||||
/*
|
||||
|
@ -555,6 +557,7 @@ void CodeInstaller::initialize_dependencies(oop compiled_code, OopRecorder* reco
|
|||
}
|
||||
}
|
||||
|
||||
#if INCLUDE_AOT
|
||||
RelocBuffer::~RelocBuffer() {
|
||||
if (_buffer != NULL) {
|
||||
FREE_C_HEAP_ARRAY(char, _buffer);
|
||||
|
@ -593,9 +596,7 @@ JVMCIEnv::CodeInstallResult CodeInstaller::gather_metadata(Handle target, Handle
|
|||
// Get instructions and constants CodeSections early because we need it.
|
||||
_instructions = buffer.insts();
|
||||
_constants = buffer.consts();
|
||||
#if INCLUDE_AOT
|
||||
buffer.set_immutable_PIC(_immutable_pic_compilation);
|
||||
#endif
|
||||
|
||||
initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
|
||||
JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, false, CHECK_OK);
|
||||
|
@ -618,6 +619,7 @@ JVMCIEnv::CodeInstallResult CodeInstaller::gather_metadata(Handle target, Handle
|
|||
reloc_buffer->set_size(size);
|
||||
return JVMCIEnv::ok;
|
||||
}
|
||||
#endif // INCLUDE_AOT
|
||||
|
||||
// constructor used to create a method
|
||||
JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS) {
|
||||
|
@ -769,6 +771,7 @@ int CodeInstaller::estimate_stubs_size(TRAPS) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#if INCLUDE_AOT
|
||||
if (UseAOT && site->is_a(site_Call::klass())) {
|
||||
oop target = site_Call::target(site);
|
||||
InstanceKlass* target_klass = InstanceKlass::cast(target->klass());
|
||||
|
@ -777,6 +780,7 @@ int CodeInstaller::estimate_stubs_size(TRAPS) {
|
|||
aot_call_stubs++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
int size = static_call_stubs * CompiledStaticCall::to_interp_stub_size();
|
||||
|
@ -1278,10 +1282,12 @@ void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, Handle si
|
|||
if (!_immutable_pic_compilation) {
|
||||
pd_patch_MetaspaceConstant(pc_offset, constant, CHECK);
|
||||
}
|
||||
#if INCLUDE_AOT
|
||||
} else if (constant->is_a(HotSpotSentinelConstant::klass())) {
|
||||
if (!_immutable_pic_compilation) {
|
||||
JVMCI_ERROR("sentinel constant not supported for normal compiles: %s", constant->klass()->signature_name());
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
JVMCI_ERROR("unknown constant type in data patch: %s", constant->klass()->signature_name());
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "jvmci/jvmciEnv.hpp"
|
||||
#include "code/nativeInst.hpp"
|
||||
|
||||
#if INCLUDE_AOT
|
||||
class RelocBuffer : public StackObj {
|
||||
enum { stack_size = 1024 };
|
||||
public:
|
||||
|
@ -106,6 +107,7 @@ private:
|
|||
AOTOopRecorder* _oop_recorder;
|
||||
ExceptionHandlerTable* _exception_table;
|
||||
};
|
||||
#endif // INCLUDE_AOT
|
||||
|
||||
/*
|
||||
* This class handles the conversion from a InstalledCode to a CodeBlob or an nmethod.
|
||||
|
@ -202,7 +204,9 @@ public:
|
|||
|
||||
CodeInstaller(bool immutable_pic_compilation) : _arena(mtCompiler), _immutable_pic_compilation(immutable_pic_compilation) {}
|
||||
|
||||
#if INCLUDE_AOT
|
||||
JVMCIEnv::CodeInstallResult gather_metadata(Handle target, Handle compiled_code, CodeMetadata& metadata, TRAPS);
|
||||
#endif
|
||||
JVMCIEnv::CodeInstallResult install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS);
|
||||
|
||||
static address runtime_call_target_address(oop runtime_call);
|
||||
|
|
|
@ -714,6 +714,7 @@ C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject
|
|||
C2V_END
|
||||
|
||||
C2V_VMENTRY(jint, getMetadata, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject metadata))
|
||||
#if INCLUDE_AOT
|
||||
ResourceMark rm;
|
||||
HandleMark hm;
|
||||
|
||||
|
@ -783,6 +784,9 @@ C2V_VMENTRY(jint, getMetadata, (JNIEnv *jniEnv, jobject, jobject target, jobject
|
|||
HotSpotMetaData::set_exceptionBytes(metadata_handle, exceptionArrayOop());
|
||||
|
||||
return result;
|
||||
#else
|
||||
THROW_MSG_0(vmSymbols::java_lang_InternalError(), "unimplemented");
|
||||
#endif
|
||||
C2V_END
|
||||
|
||||
C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject))
|
||||
|
@ -1426,12 +1430,16 @@ C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_m
|
|||
C2V_END
|
||||
|
||||
C2V_VMENTRY(jlong, getFingerprint, (JNIEnv*, jobject, jlong metaspace_klass))
|
||||
#if INCLUDE_AOT
|
||||
Klass *k = CompilerToVM::asKlass(metaspace_klass);
|
||||
if (k->is_instance_klass()) {
|
||||
return InstanceKlass::cast(k)->get_stored_fingerprint();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
THROW_MSG_0(vmSymbols::java_lang_InternalError(), "unimplemented");
|
||||
#endif
|
||||
C2V_END
|
||||
|
||||
C2V_VMENTRY(jobject, getHostClass, (JNIEnv*, jobject, jobject jvmci_type))
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The AArch64 platform independent portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.aarch64;
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The AMD64 platform independent portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.amd64;
|
|
@ -43,13 +43,19 @@ public class BytecodePosition {
|
|||
*
|
||||
* @param caller the parent position
|
||||
* @param method the method
|
||||
* @param bci a BCI within the method
|
||||
* @param bci a BCI such that {@code method.codeSize() == 0 || bci < method.getCodeSize()}. That
|
||||
* is, if code size is 0 then allow any value, otherwise the bci must be less than
|
||||
* the code size.
|
||||
*/
|
||||
public BytecodePosition(BytecodePosition caller, ResolvedJavaMethod method, int bci) {
|
||||
assert method != null;
|
||||
this.caller = caller;
|
||||
this.method = method;
|
||||
this.bci = bci;
|
||||
int codeSize = method.getCodeSize();
|
||||
if (codeSize != 0 && bci >= codeSize) {
|
||||
throw new IllegalArgumentException(String.format("bci %d is out of range for %s %d bytes", bci, method.format("%H.%n(%p)"), codeSize));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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 that defines the information associated with various {@link jdk.vm.ci.code.site.Site
|
||||
* sites} in generated code.
|
||||
*/
|
||||
package jdk.vm.ci.code.site;
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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 that defines the interface for runtime stack introspection.
|
||||
*/
|
||||
package jdk.vm.ci.code.stack;
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Common utility classes used by the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.common;
|
|
@ -43,7 +43,7 @@ import jdk.vm.ci.runtime.JVMCIBackend;
|
|||
|
||||
public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
|
||||
|
||||
protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
|
||||
private static EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
|
||||
// Configure the feature set using the HotSpot flag settings.
|
||||
EnumSet<AArch64.CPUFeature> features = EnumSet.noneOf(AArch64.CPUFeature.class);
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFac
|
|||
return features;
|
||||
}
|
||||
|
||||
protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
|
||||
private static EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
|
||||
EnumSet<AArch64.Flag> flags = EnumSet.noneOf(AArch64.Flag.class);
|
||||
|
||||
if (config.useBarriersForVolatile) {
|
||||
|
@ -115,7 +115,7 @@ public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFac
|
|||
return flags;
|
||||
}
|
||||
|
||||
protected TargetDescription createTarget(AArch64HotSpotVMConfig config) {
|
||||
private static TargetDescription createTarget(AArch64HotSpotVMConfig config) {
|
||||
final int stackFrameAlignment = 16;
|
||||
final int implicitNullCheckLimit = 4096;
|
||||
final boolean inlineObjects = true;
|
||||
|
@ -127,12 +127,12 @@ public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFac
|
|||
return new HotSpotConstantReflectionProvider(runtime);
|
||||
}
|
||||
|
||||
protected RegisterConfig createRegisterConfig(AArch64HotSpotVMConfig config, TargetDescription target) {
|
||||
private static RegisterConfig createRegisterConfig(AArch64HotSpotVMConfig config, TargetDescription target) {
|
||||
return new AArch64HotSpotRegisterConfig(target, config.useCompressedOops);
|
||||
}
|
||||
|
||||
protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntime runtime, TargetDescription target, RegisterConfig regConfig) {
|
||||
return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
|
||||
return new HotSpotCodeCacheProvider(runtime, target, regConfig);
|
||||
}
|
||||
|
||||
protected HotSpotMetaAccessProvider createMetaAccess(HotSpotJVMCIRuntime runtime) {
|
||||
|
|
|
@ -126,8 +126,7 @@ public class AArch64HotSpotRegisterConfig implements RegisterConfig {
|
|||
public static final Register threadRegister = r28;
|
||||
public static final Register fp = r29;
|
||||
|
||||
private static final RegisterArray reservedRegisters
|
||||
= new RegisterArray(rscratch1, rscratch2, threadRegister, fp, lr, r31, zr, sp);
|
||||
private static final RegisterArray reservedRegisters = new RegisterArray(rscratch1, rscratch2, threadRegister, fp, lr, r31, zr, sp);
|
||||
|
||||
private static RegisterArray initAllocatable(Architecture arch, boolean reserveForHeapBase) {
|
||||
RegisterArray allRegisters = arch.getAvailableValueRegisters();
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The AArch64 HotSpot specific portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot.aarch64;
|
|
@ -43,7 +43,7 @@ import jdk.vm.ci.runtime.JVMCIBackend;
|
|||
|
||||
public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
|
||||
|
||||
protected EnumSet<AMD64.CPUFeature> computeFeatures(AMD64HotSpotVMConfig config) {
|
||||
private static EnumSet<AMD64.CPUFeature> computeFeatures(AMD64HotSpotVMConfig config) {
|
||||
// Configure the feature set using the HotSpot flag settings.
|
||||
EnumSet<AMD64.CPUFeature> features = EnumSet.noneOf(AMD64.CPUFeature.class);
|
||||
if ((config.vmVersionFeatures & config.amd643DNOWPREFETCH) != 0) {
|
||||
|
@ -130,7 +130,7 @@ public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFacto
|
|||
return features;
|
||||
}
|
||||
|
||||
protected EnumSet<AMD64.Flag> computeFlags(AMD64HotSpotVMConfig config) {
|
||||
private static EnumSet<AMD64.Flag> computeFlags(AMD64HotSpotVMConfig config) {
|
||||
EnumSet<AMD64.Flag> flags = EnumSet.noneOf(AMD64.Flag.class);
|
||||
if (config.useCountLeadingZerosInstruction) {
|
||||
flags.add(AMD64.Flag.UseCountLeadingZerosInstruction);
|
||||
|
@ -141,7 +141,7 @@ public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFacto
|
|||
return flags;
|
||||
}
|
||||
|
||||
protected TargetDescription createTarget(AMD64HotSpotVMConfig config) {
|
||||
private static TargetDescription createTarget(AMD64HotSpotVMConfig config) {
|
||||
final int stackFrameAlignment = 16;
|
||||
final int implicitNullCheckLimit = 4096;
|
||||
final boolean inlineObjects = true;
|
||||
|
@ -153,12 +153,12 @@ public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFacto
|
|||
return new HotSpotConstantReflectionProvider(runtime);
|
||||
}
|
||||
|
||||
protected RegisterConfig createRegisterConfig(AMD64HotSpotVMConfig config, TargetDescription target) {
|
||||
private static RegisterConfig createRegisterConfig(AMD64HotSpotVMConfig config, TargetDescription target) {
|
||||
return new AMD64HotSpotRegisterConfig(target, config.useCompressedOops, config.windowsOs);
|
||||
}
|
||||
|
||||
protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntime runtime, TargetDescription target, RegisterConfig regConfig) {
|
||||
return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
|
||||
return new HotSpotCodeCacheProvider(runtime, target, regConfig);
|
||||
}
|
||||
|
||||
protected HotSpotMetaAccessProvider createMetaAccess(HotSpotJVMCIRuntime runtime) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2016, 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,9 @@ package jdk.vm.ci.hotspot.amd64;
|
|||
import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
|
||||
import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
|
||||
|
||||
/**
|
||||
* Used to access AMD64 specific native configuration details.
|
||||
*/
|
||||
class AMD64HotSpotVMConfig extends HotSpotVMConfigAccess {
|
||||
|
||||
AMD64HotSpotVMConfig(HotSpotVMConfigStore config) {
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The AMD64 HotSpot specific portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot.amd64;
|
|
@ -43,7 +43,7 @@ import jdk.vm.ci.sparc.SPARC.CPUFeature;
|
|||
|
||||
public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
|
||||
|
||||
protected TargetDescription createTarget(SPARCHotSpotVMConfig config) {
|
||||
private static TargetDescription createTarget(SPARCHotSpotVMConfig config) {
|
||||
final int stackFrameAlignment = 16;
|
||||
final int implicitNullCheckLimit = 4096;
|
||||
final boolean inlineObjects = false;
|
||||
|
@ -52,10 +52,10 @@ public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFacto
|
|||
}
|
||||
|
||||
protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntime runtime, TargetDescription target, RegisterConfig regConfig) {
|
||||
return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
|
||||
return new HotSpotCodeCacheProvider(runtime, target, regConfig);
|
||||
}
|
||||
|
||||
protected EnumSet<CPUFeature> computeFeatures(SPARCHotSpotVMConfig config) {
|
||||
private static EnumSet<CPUFeature> computeFeatures(SPARCHotSpotVMConfig config) {
|
||||
EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class);
|
||||
|
||||
if ((config.vmVersionFeatures & 1L << config.sparc_ADI) != 0) {
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The SPARC HotSpot specific portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot.sparc;
|
|
@ -261,9 +261,9 @@ final class CompilerToVM {
|
|||
|
||||
/**
|
||||
* If {@code cpi} denotes an entry representing a resolved dynamic adapter (see
|
||||
* {@code resolveInvokeDynamicInPool} and {@code resolveInvokeHandleInPool}), return the opcode
|
||||
* of the instruction for which the resolution was performed ({@code invokedynamic} or
|
||||
* {@code invokevirtual}}, or {@code -1} otherwise.
|
||||
* {@link #resolveInvokeDynamicInPool} and {@link #resolveInvokeHandleInPool}), return the
|
||||
* opcode of the instruction for which the resolution was performed ({@code invokedynamic} or
|
||||
* {@code invokevirtual}), or {@code -1} otherwise.
|
||||
*/
|
||||
native int isResolvedInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
|
||||
|
||||
|
@ -543,12 +543,11 @@ final class CompilerToVM {
|
|||
native boolean shouldDebugNonSafepoints();
|
||||
|
||||
/**
|
||||
* Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to the
|
||||
* HotSpot's log stream.
|
||||
* Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to HotSpot's
|
||||
* log stream.
|
||||
*
|
||||
* @exception NullPointerException if {@code bytes == null}
|
||||
* @exception IndexOutOfBoundsException if copying would cause access of data outside array
|
||||
* bounds
|
||||
* @throws NullPointerException if {@code bytes == null}
|
||||
* @throws IndexOutOfBoundsException if copying would cause access of data outside array bounds
|
||||
*/
|
||||
native void writeDebugOutput(byte[] bytes, int offset, int length);
|
||||
|
||||
|
@ -620,7 +619,7 @@ final class CompilerToVM {
|
|||
native int methodDataProfileDataSize(long metaspaceMethodData, int position);
|
||||
|
||||
/**
|
||||
* Gets the fingerprint for a given Klass*
|
||||
* Gets the fingerprint for a given Klass*.
|
||||
*
|
||||
* @param metaspaceKlass
|
||||
* @return the value of the fingerprint (zero for arrays and synthetic classes).
|
||||
|
|
|
@ -91,7 +91,7 @@ public interface EventProvider {
|
|||
*
|
||||
* @return a compilation event
|
||||
*/
|
||||
public abstract CompilationEvent newCompilationEvent();
|
||||
CompilationEvent newCompilationEvent();
|
||||
|
||||
/**
|
||||
* A compilation event.
|
||||
|
@ -117,7 +117,7 @@ public interface EventProvider {
|
|||
*
|
||||
* @return a compiler failure event
|
||||
*/
|
||||
public abstract CompilerFailureEvent newCompilerFailureEvent();
|
||||
CompilerFailureEvent newCompilerFailureEvent();
|
||||
|
||||
/**
|
||||
* A compiler failure event.
|
||||
|
|
|
@ -42,13 +42,13 @@ import jdk.vm.ci.meta.SpeculationLog;
|
|||
public class HotSpotCodeCacheProvider implements CodeCacheProvider {
|
||||
|
||||
protected final HotSpotJVMCIRuntime runtime;
|
||||
protected final HotSpotVMConfig config;
|
||||
private final HotSpotVMConfig config;
|
||||
protected final TargetDescription target;
|
||||
protected final RegisterConfig regConfig;
|
||||
|
||||
public HotSpotCodeCacheProvider(HotSpotJVMCIRuntime runtime, HotSpotVMConfig config, TargetDescription target, RegisterConfig regConfig) {
|
||||
public HotSpotCodeCacheProvider(HotSpotJVMCIRuntime runtime, TargetDescription target, RegisterConfig regConfig) {
|
||||
this.runtime = runtime;
|
||||
this.config = config;
|
||||
this.config = runtime.getConfig();
|
||||
this.target = target;
|
||||
this.regConfig = regConfig;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class HotSpotCodeCacheProvider implements CodeCacheProvider {
|
|||
|
||||
@Override
|
||||
public int getMinimumOutgoingSize() {
|
||||
return runtime.getConfig().runtimeCallStackSize;
|
||||
return config.runtimeCallStackSize;
|
||||
}
|
||||
|
||||
private InstalledCode logOrDump(InstalledCode installedCode, CompiledCode compiledCode) {
|
||||
|
|
|
@ -646,7 +646,7 @@ public final class HotSpotConstantPool implements ConstantPool, MetaspaceWrapper
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Converts a raw index from the bytecodes to a constant pool index (not a cache index).
|
||||
*
|
||||
* @param rawIndex index from the bytecode
|
||||
|
@ -760,6 +760,8 @@ public final class HotSpotConstantPool implements ConstantPool, MetaspaceWrapper
|
|||
/**
|
||||
* Determines if {@code type} contains signature polymorphic methods.
|
||||
*/
|
||||
@SuppressFBWarnings(value = "LI_LAZY_INIT_STATIC", justification = "signaturePolymorphicHolders is a cache, not a singleton that must be constructed exactly once" +
|
||||
"and compiler re-ordering is not an issue due to the VM call")
|
||||
static boolean isSignaturePolymorphicHolder(final ResolvedJavaType type) {
|
||||
String name = type.getName();
|
||||
if (signaturePolymorphicHolders == null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
|
@ -60,7 +60,7 @@ public final class HotSpotConstantPoolObject extends HotSpotObjectConstantImpl {
|
|||
if (o instanceof HotSpotConstantPoolObject) {
|
||||
if (super.equals(o)) {
|
||||
HotSpotConstantPoolObject other = (HotSpotConstantPoolObject) o;
|
||||
return type == other.type && cpi == other.cpi;
|
||||
return type.equals(other.type) && cpi == other.cpi;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -42,7 +42,7 @@ public class HotSpotConstantReflectionProvider implements ConstantReflectionProv
|
|||
|
||||
protected final HotSpotJVMCIRuntime runtime;
|
||||
protected final HotSpotMethodHandleAccessProvider methodHandleAccess;
|
||||
protected final HotSpotMemoryAccessProviderImpl memoryAccess;
|
||||
private final HotSpotMemoryAccessProviderImpl memoryAccess;
|
||||
|
||||
public HotSpotConstantReflectionProvider(HotSpotJVMCIRuntime runtime) {
|
||||
this.runtime = runtime;
|
||||
|
|
|
@ -36,7 +36,6 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import jdk.internal.misc.VM;
|
||||
|
@ -240,16 +239,16 @@ public final class HotSpotJVMCIRuntime implements JVMCIRuntime {
|
|||
return runtime().getHostJVMCIBackend().getCodeCache().getTarget().wordJavaKind;
|
||||
}
|
||||
|
||||
protected final CompilerToVM compilerToVm;
|
||||
final CompilerToVM compilerToVm;
|
||||
|
||||
protected final HotSpotVMConfigStore configStore;
|
||||
protected final HotSpotVMConfig config;
|
||||
private final HotSpotVMConfig config;
|
||||
private final JVMCIBackend hostBackend;
|
||||
|
||||
private final JVMCICompilerFactory compilerFactory;
|
||||
private final HotSpotJVMCICompilerFactory hsCompilerFactory;
|
||||
private volatile JVMCICompiler compiler;
|
||||
protected final HotSpotJVMCIMetaAccessContext metaAccessContext;
|
||||
final HotSpotJVMCIMetaAccessContext metaAccessContext;
|
||||
|
||||
/**
|
||||
* Stores the result of {@link HotSpotJVMCICompilerFactory#getCompilationLevelAdjustment} so
|
||||
|
@ -324,7 +323,7 @@ public final class HotSpotJVMCIRuntime implements JVMCIRuntime {
|
|||
}
|
||||
|
||||
if (Option.PrintConfig.getBoolean()) {
|
||||
printConfig(configStore, compilerToVm);
|
||||
configStore.printConfig();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,11 +342,11 @@ public final class HotSpotJVMCIRuntime implements JVMCIRuntime {
|
|||
return configStore;
|
||||
}
|
||||
|
||||
public HotSpotVMConfig getConfig() {
|
||||
HotSpotVMConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public CompilerToVM getCompilerToVM() {
|
||||
CompilerToVM getCompilerToVM() {
|
||||
return compilerToVm;
|
||||
}
|
||||
|
||||
|
@ -578,41 +577,6 @@ public final class HotSpotJVMCIRuntime implements JVMCIRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "DM_DEFAULT_ENCODING", justification = "no localization here please!")
|
||||
private static void printConfigLine(CompilerToVM vm, String format, Object... args) {
|
||||
String line = String.format(format, args);
|
||||
byte[] lineBytes = line.getBytes();
|
||||
vm.writeDebugOutput(lineBytes, 0, lineBytes.length);
|
||||
vm.flushDebugOutput();
|
||||
}
|
||||
|
||||
private static void printConfig(HotSpotVMConfigStore store, CompilerToVM vm) {
|
||||
TreeMap<String, VMField> fields = new TreeMap<>(store.getFields());
|
||||
for (VMField field : fields.values()) {
|
||||
if (!field.isStatic()) {
|
||||
printConfigLine(vm, "[vmconfig:instance field] %s %s {offset=%d[0x%x]}%n", field.type, field.name, field.offset, field.offset);
|
||||
} else {
|
||||
String value = field.value == null ? "null" : field.value instanceof Boolean ? field.value.toString() : String.format("%d[0x%x]", field.value, field.value);
|
||||
printConfigLine(vm, "[vmconfig:static field] %s %s = %s {address=0x%x}%n", field.type, field.name, value, field.address);
|
||||
}
|
||||
}
|
||||
TreeMap<String, VMFlag> flags = new TreeMap<>(store.getFlags());
|
||||
for (VMFlag flag : flags.values()) {
|
||||
printConfigLine(vm, "[vmconfig:flag] %s %s = %s%n", flag.type, flag.name, flag.value);
|
||||
}
|
||||
TreeMap<String, Long> addresses = new TreeMap<>(store.getAddresses());
|
||||
for (Map.Entry<String, Long> e : addresses.entrySet()) {
|
||||
printConfigLine(vm, "[vmconfig:address] %s = %d[0x%x]%n", e.getKey(), e.getValue(), e.getValue());
|
||||
}
|
||||
TreeMap<String, Long> constants = new TreeMap<>(store.getConstants());
|
||||
for (Map.Entry<String, Long> e : constants.entrySet()) {
|
||||
printConfigLine(vm, "[vmconfig:constant] %s = %d[0x%x]%n", e.getKey(), e.getValue(), e.getValue());
|
||||
}
|
||||
for (VMIntrinsicMethod e : store.getIntrinsics()) {
|
||||
printConfigLine(vm, "[vmconfig:intrinsic] %d = %s.%s %s%n", e.id, e.declaringClass, e.name, e.descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an output stream that writes to HotSpot's {@code tty} stream.
|
||||
*/
|
||||
|
|
|
@ -579,8 +579,9 @@ final class HotSpotMethodData {
|
|||
|
||||
totalCount += getMethodsNotRecordedExecutionCount(data, position);
|
||||
|
||||
// Fixup the case of C1's inability to optimize profiling of a statically bindable call site.
|
||||
// If it's a monomorphic call site, attribute all the counts to the first type (if any is recorded).
|
||||
// Fixup the case of C1's inability to optimize profiling of a statically bindable call
|
||||
// site. If it's a monomorphic call site, attribute all the counts to the first type (if
|
||||
// any is recorded).
|
||||
if (entries == 1) {
|
||||
counts[0] = totalCount;
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ abstract class HotSpotMethodDataAccessor {
|
|||
}
|
||||
|
||||
TriState getExceptionSeen(HotSpotMethodData data, int position) {
|
||||
final int EXCEPTIONS_MASK = 1 << config.bitDataExceptionSeenFlag;
|
||||
return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0);
|
||||
final int exceptionsMask = 1 << config.bitDataExceptionSeenFlag;
|
||||
return TriState.get((getFlags(data, position) & exceptionsMask) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -91,4 +91,7 @@ public interface HotSpotObjectConstant extends JavaConstant, HotSpotConstant, VM
|
|||
* {@code null}
|
||||
*/
|
||||
Object asObject(ResolvedJavaType type);
|
||||
|
||||
@Override
|
||||
String toValueString();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import jdk.vm.ci.meta.JavaTypeProfile;
|
|||
import jdk.vm.ci.meta.ProfilingInfo;
|
||||
import jdk.vm.ci.meta.TriState;
|
||||
|
||||
public final class HotSpotProfilingInfo implements ProfilingInfo {
|
||||
final class HotSpotProfilingInfo implements ProfilingInfo {
|
||||
|
||||
private final HotSpotMethodData methodData;
|
||||
private final HotSpotResolvedJavaMethod method;
|
||||
|
@ -42,7 +42,7 @@ public final class HotSpotProfilingInfo implements ProfilingInfo {
|
|||
private boolean includeNormal;
|
||||
private boolean includeOSR;
|
||||
|
||||
public HotSpotProfilingInfo(HotSpotMethodData methodData, HotSpotResolvedJavaMethod method, boolean includeNormal, boolean includeOSR) {
|
||||
HotSpotProfilingInfo(HotSpotMethodData methodData, HotSpotResolvedJavaMethod method, boolean includeNormal, boolean includeOSR) {
|
||||
this.methodData = methodData;
|
||||
this.method = method;
|
||||
this.includeNormal = includeNormal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2018, 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
|
||||
|
@ -28,8 +28,6 @@ import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
|
|||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
|
||||
import jdk.vm.ci.meta.JavaConstant;
|
||||
import jdk.vm.ci.meta.JavaType;
|
||||
import jdk.vm.ci.meta.ResolvedJavaType;
|
||||
|
|
|
@ -58,7 +58,8 @@ public interface HotSpotResolvedJavaMethod extends ResolvedJavaMethod {
|
|||
boolean hasReservedStackAccess();
|
||||
|
||||
/**
|
||||
* Sets flags on {@code method} indicating that it should never be inlined or compiled by the VM.
|
||||
* Sets flags on {@code method} indicating that it should never be inlined or compiled by the
|
||||
* VM.
|
||||
*/
|
||||
void setNotInlinableOrCompilable();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2018, 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
|
||||
|
@ -22,6 +22,24 @@
|
|||
*/
|
||||
package jdk.vm.ci.hotspot;
|
||||
|
||||
import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
|
||||
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.BRIDGE;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.SYNTHETIC;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.VARARGS;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmMethodModifiers;
|
||||
import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
|
||||
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Executable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import jdk.vm.ci.common.JVMCIError;
|
||||
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
|
||||
import jdk.vm.ci.meta.Constant;
|
||||
|
@ -40,24 +58,6 @@ import jdk.vm.ci.meta.Signature;
|
|||
import jdk.vm.ci.meta.SpeculationLog;
|
||||
import jdk.vm.ci.meta.TriState;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Executable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
|
||||
import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.BRIDGE;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.SYNTHETIC;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.VARARGS;
|
||||
import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmMethodModifiers;
|
||||
import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
|
||||
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
|
||||
|
||||
/**
|
||||
* Implementation of {@link JavaMethod} for resolved HotSpot methods.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 2018, 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
|
||||
|
@ -102,8 +102,6 @@ public interface HotSpotResolvedObjectType extends ResolvedJavaType {
|
|||
|
||||
int layoutHelper();
|
||||
|
||||
long getFingerprint();
|
||||
|
||||
@Override
|
||||
HotSpotResolvedObjectType getEnclosingType();
|
||||
|
||||
|
@ -127,4 +125,11 @@ public interface HotSpotResolvedObjectType extends ResolvedJavaType {
|
|||
return isUnsafeAnonymous();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fingerprint for this type.
|
||||
*
|
||||
* @return the value of the fingerprint ({@code 0} for arrays and synthetic classes or if the VM
|
||||
* does not support fingerprints)
|
||||
*/
|
||||
long getFingerprint();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType
|
|||
}
|
||||
|
||||
@Override
|
||||
public HotSpotResolvedObjectTypeImpl getArrayClass() {
|
||||
public HotSpotResolvedObjectType getArrayClass() {
|
||||
if (kind == JavaKind.Void) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ package jdk.vm.ci.hotspot;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.vm.ci.meta.JavaConstant;
|
||||
import jdk.vm.ci.meta.SpeculationLog;
|
||||
|
|
|
@ -50,7 +50,8 @@ public class HotSpotVMConfigAccess {
|
|||
if (notPresent != null) {
|
||||
return notPresent;
|
||||
}
|
||||
throw new JVMCIError("expected VM symbol not found: " + name);
|
||||
store.printConfig();
|
||||
throw new JVMCIError("expected VM symbol not found in " + store + ": " + name);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
@ -81,7 +82,8 @@ public class HotSpotVMConfigAccess {
|
|||
if (notPresent != null) {
|
||||
return notPresent;
|
||||
}
|
||||
throw new JVMCIError("expected VM constant not found: " + name);
|
||||
store.printConfig();
|
||||
throw new JVMCIError("expected VM constant not found in " + store + ": " + name);
|
||||
}
|
||||
return type.cast(convertValue(name, type, c, null));
|
||||
}
|
||||
|
@ -241,7 +243,8 @@ public class HotSpotVMConfigAccess {
|
|||
if (!required) {
|
||||
return null;
|
||||
}
|
||||
throw new JVMCIError("expected VM field not found: " + name);
|
||||
store.printConfig();
|
||||
throw new JVMCIError("expected VM field not found in " + store + ": " + name);
|
||||
}
|
||||
|
||||
// Make sure the native type is still the type we expect.
|
||||
|
@ -285,7 +288,8 @@ public class HotSpotVMConfigAccess {
|
|||
if (notPresent != null) {
|
||||
return notPresent;
|
||||
}
|
||||
throw new JVMCIError("expected VM flag not found: " + name);
|
||||
store.printConfig();
|
||||
throw new JVMCIError("expected VM flag not found in " + store + ": " + name);
|
||||
} else {
|
||||
cppType = null;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2018, 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,8 +29,10 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import jdk.vm.ci.common.InitTimer;
|
||||
import jdk.vm.ci.common.JVMCIError;
|
||||
|
||||
/**
|
||||
* Access to VM configuration data.
|
||||
|
@ -108,7 +110,9 @@ public final class HotSpotVMConfigStore {
|
|||
try (InitTimer t = timer("CompilerToVm readConfiguration")) {
|
||||
data = compilerToVm.readConfiguration();
|
||||
}
|
||||
assert data.length == 5 : data.length;
|
||||
if (data.length != 5) {
|
||||
throw new JVMCIError("Expected data.length to be 5, not %d", data.length);
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
VMField[] vmFieldsInfo = (VMField[]) data[0];
|
||||
|
@ -145,4 +149,52 @@ public final class HotSpotVMConfigStore {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s[%d fields, %d constants, %d addresses, %d flags, %d intrinsics]",
|
||||
getClass().getSimpleName(),
|
||||
vmFields.size(),
|
||||
vmConstants.size(),
|
||||
vmAddresses.size(),
|
||||
vmFlags.size(),
|
||||
vmIntrinsics.size());
|
||||
}
|
||||
|
||||
void printConfig() {
|
||||
CompilerToVM vm = compilerToVm;
|
||||
TreeMap<String, VMField> fields = new TreeMap<>(getFields());
|
||||
for (VMField field : fields.values()) {
|
||||
if (!field.isStatic()) {
|
||||
printConfigLine(vm, "[vmconfig:instance field] %s %s {offset=%d[0x%x]}%n", field.type, field.name, field.offset, field.offset);
|
||||
} else {
|
||||
String value = field.value == null ? "null" : field.value instanceof Boolean ? field.value.toString() : String.format("%d[0x%x]", field.value, field.value);
|
||||
printConfigLine(vm, "[vmconfig:static field] %s %s = %s {address=0x%x}%n", field.type, field.name, value, field.address);
|
||||
}
|
||||
}
|
||||
TreeMap<String, VMFlag> flags = new TreeMap<>(getFlags());
|
||||
for (VMFlag flag : flags.values()) {
|
||||
printConfigLine(vm, "[vmconfig:flag] %s %s = %s%n", flag.type, flag.name, flag.value);
|
||||
}
|
||||
TreeMap<String, Long> addresses = new TreeMap<>(getAddresses());
|
||||
for (Map.Entry<String, Long> e : addresses.entrySet()) {
|
||||
printConfigLine(vm, "[vmconfig:address] %s = %d[0x%x]%n", e.getKey(), e.getValue(), e.getValue());
|
||||
}
|
||||
TreeMap<String, Long> constants = new TreeMap<>(getConstants());
|
||||
for (Map.Entry<String, Long> e : constants.entrySet()) {
|
||||
printConfigLine(vm, "[vmconfig:constant] %s = %d[0x%x]%n", e.getKey(), e.getValue(), e.getValue());
|
||||
}
|
||||
for (VMIntrinsicMethod e : getIntrinsics()) {
|
||||
printConfigLine(vm, "[vmconfig:intrinsic] %d = %s.%s %s%n", e.id, e.declaringClass, e.name, e.descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "DM_DEFAULT_ENCODING", justification = "no localization here please!")
|
||||
private static void printConfigLine(CompilerToVM vm, String format, Object... args) {
|
||||
String line = String.format(format, args);
|
||||
byte[] lineBytes = line.getBytes();
|
||||
vm.writeDebugOutput(lineBytes, 0, lineBytes.length);
|
||||
vm.flushDebugOutput();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* HotSpot specific portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.hotspot;
|
|
@ -98,7 +98,7 @@ public final class Assumptions implements Iterable<Assumptions.Assumption> {
|
|||
}
|
||||
|
||||
/**
|
||||
* An assumption that a given class has no subclasses implementing {@code Object#finalize()}).
|
||||
* An assumption that a given class has no subclasses implementing {@link Object#finalize()}).
|
||||
*/
|
||||
public static final class NoFinalizableSubclass extends Assumption {
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ public interface ConstantPool {
|
|||
/**
|
||||
* Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks
|
||||
* specific to the bytecode it denotes are performed if the field is already resolved. Checks
|
||||
* for some bytecodes require the method that contains the bytecode to be specified. Should
|
||||
* any of these checks fail, an unresolved field reference is returned.
|
||||
* for some bytecodes require the method that contains the bytecode to be specified. Should any
|
||||
* of these checks fail, an unresolved field reference is returned.
|
||||
*
|
||||
* @param cpi the constant pool index
|
||||
* @param opcode the opcode of the instruction for which the lookup is being performed or
|
||||
|
|
|
@ -47,7 +47,7 @@ public class LocalVariableTable {
|
|||
|
||||
/**
|
||||
* Gets a description of a local variable that occupies the bytecode frame slot indexed by
|
||||
* {@code slot} and is live at the bytecode index {@code bci}
|
||||
* {@code slot} and is live at the bytecode index {@code bci}.
|
||||
*
|
||||
* @return a description of the requested local variable or null if no such variable matches
|
||||
* {@code slot} and {@code bci}
|
||||
|
@ -74,7 +74,7 @@ public class LocalVariableTable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a description of all the local variables live at the bytecode index {@code bci}
|
||||
* Gets a description of all the local variables live at the bytecode index {@code bci}.
|
||||
*/
|
||||
public Local[] getLocalsAt(int bci) {
|
||||
List<Local> result = new ArrayList<>();
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
*/
|
||||
package jdk.vm.ci.meta;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import static java.lang.reflect.Modifier.PRIVATE;
|
||||
import static java.lang.reflect.Modifier.PROTECTED;
|
||||
import static java.lang.reflect.Modifier.PUBLIC;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/**
|
||||
* A Java element (i.e., a class, interface, field or method) that is described by a set of Java
|
||||
* language {@linkplain #getModifiers() modifiers}.
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The core runtime interface of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.runtime;
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The service related portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.services;
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The SPARC platform independent portions of the JVMCI API.
|
||||
*/
|
||||
package jdk.vm.ci.sparc;
|
Loading…
Add table
Add a link
Reference in a new issue