Merge
This commit is contained in:
commit
ee06cb9b8a
@ -3134,10 +3134,10 @@ void LIR_Assembler::atomic_op(LIR_Code code, LIR_Opr src, LIR_Opr data, LIR_Opr
|
||||
Register obj = as_reg(data);
|
||||
Register dst = as_reg(dest);
|
||||
if (is_oop && UseCompressedOops) {
|
||||
__ encode_heap_oop(rscratch1, obj);
|
||||
obj = rscratch1;
|
||||
__ encode_heap_oop(rscratch2, obj);
|
||||
obj = rscratch2;
|
||||
}
|
||||
assert_different_registers(obj, addr.base(), tmp, rscratch2, dst);
|
||||
assert_different_registers(obj, addr.base(), tmp, rscratch1, dst);
|
||||
__ lea(tmp, addr);
|
||||
(_masm->*xchg)(dst, obj, tmp);
|
||||
if (is_oop && UseCompressedOops) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@ -47,8 +47,10 @@ public class MethodCounters extends Metadata {
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("MethodCounters");
|
||||
|
||||
interpreterInvocationCountField = new CIntField(type.getCIntegerField("_interpreter_invocation_count"), 0);
|
||||
interpreterThrowoutCountField = new CIntField(type.getCIntegerField("_interpreter_throwout_count"), 0);
|
||||
if (VM.getVM().isServerCompiler()) {
|
||||
interpreterInvocationCountField = new CIntField(type.getCIntegerField("_interpreter_invocation_count"), 0);
|
||||
interpreterThrowoutCountField = new CIntField(type.getCIntegerField("_interpreter_throwout_count"), 0);
|
||||
}
|
||||
if (!VM.getVM().isCore()) {
|
||||
invocationCounter = new CIntField(type.getCIntegerField("_invocation_counter"), 0);
|
||||
backedgeCounter = new CIntField(type.getCIntegerField("_backedge_counter"), 0);
|
||||
@ -61,11 +63,19 @@ public class MethodCounters extends Metadata {
|
||||
private static CIntField backedgeCounter;
|
||||
|
||||
public int interpreterInvocationCount() {
|
||||
return (int) interpreterInvocationCountField.getValue(this);
|
||||
if (interpreterInvocationCountField != null) {
|
||||
return (int) interpreterInvocationCountField.getValue(this);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int interpreterThrowoutCount() {
|
||||
return (int) interpreterThrowoutCountField.getValue(this);
|
||||
if (interpreterThrowoutCountField != null) {
|
||||
return (int) interpreterThrowoutCountField.getValue(this);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public long getInvocationCounter() {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
|
@ -632,9 +632,11 @@ BytecodeInterpreter::run(interpreterState istate) {
|
||||
if (_compiling) {
|
||||
MethodCounters* mcs;
|
||||
GET_METHOD_COUNTERS(mcs);
|
||||
#if COMPILER2_OR_JVMCI
|
||||
if (ProfileInterpreter) {
|
||||
METHOD->increment_interpreter_invocation_count(THREAD);
|
||||
}
|
||||
#endif
|
||||
mcs->invocation_counter()->increment();
|
||||
if (mcs->invocation_counter()->reached_InvocationLimit(mcs->backedge_counter())) {
|
||||
CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception);
|
||||
|
@ -523,8 +523,10 @@ IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
|
||||
#ifndef CC_INTERP
|
||||
continuation = Interpreter::remove_activation_entry();
|
||||
#endif
|
||||
#if COMPILER2_OR_JVMCI
|
||||
// Count this for compilation purposes
|
||||
h_method->interpreter_throwout_increment(THREAD);
|
||||
#endif
|
||||
} else {
|
||||
// handler in this method => change bci/bcp to handler bci/bcp and continue there
|
||||
handler_pc = h_method->code_base() + handler_bci;
|
||||
|
@ -264,6 +264,7 @@ class Method : public Metadata {
|
||||
int highest_osr_comp_level() const;
|
||||
void set_highest_osr_comp_level(int level);
|
||||
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
// Count of times method was exited via exception while interpreting
|
||||
void interpreter_throwout_increment(TRAPS) {
|
||||
MethodCounters* mcs = get_method_counters(CHECK);
|
||||
@ -271,6 +272,7 @@ class Method : public Metadata {
|
||||
mcs->interpreter_throwout_increment();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int interpreter_throwout_count() const {
|
||||
MethodCounters* mcs = method_counters();
|
||||
@ -407,11 +409,13 @@ class Method : public Metadata {
|
||||
return (mcs == NULL) ? 0 : mcs->interpreter_invocation_count();
|
||||
}
|
||||
}
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
int increment_interpreter_invocation_count(TRAPS) {
|
||||
if (TieredCompilation) ShouldNotReachHere();
|
||||
MethodCounters* mcs = get_method_counters(CHECK_0);
|
||||
return (mcs == NULL) ? 0 : mcs->increment_interpreter_invocation_count();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PRODUCT
|
||||
int compiled_invocation_count() const { return _compiled_invocation_count; }
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 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
|
||||
@ -34,8 +34,10 @@ class MethodCounters: public MetaspaceObj {
|
||||
friend class VMStructs;
|
||||
friend class JVMCIVMStructs;
|
||||
private:
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
|
||||
u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
|
||||
#endif
|
||||
u2 _number_of_breakpoints; // fullspeed debugging support
|
||||
InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations
|
||||
InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations
|
||||
@ -60,9 +62,7 @@ class MethodCounters: public MetaspaceObj {
|
||||
u1 _highest_osr_comp_level; // Same for OSR level
|
||||
#endif
|
||||
|
||||
MethodCounters(methodHandle mh) : _interpreter_invocation_count(0),
|
||||
_interpreter_throwout_count(0),
|
||||
_number_of_breakpoints(0),
|
||||
MethodCounters(methodHandle mh) : _number_of_breakpoints(0),
|
||||
_nmethod_age(INT_MAX)
|
||||
#ifdef TIERED
|
||||
, _rate(0),
|
||||
@ -71,6 +71,8 @@ class MethodCounters: public MetaspaceObj {
|
||||
_highest_osr_comp_level(0)
|
||||
#endif
|
||||
{
|
||||
set_interpreter_invocation_count(0);
|
||||
set_interpreter_throwout_count(0);
|
||||
invocation_counter()->init();
|
||||
backedge_counter()->init();
|
||||
|
||||
@ -109,6 +111,8 @@ class MethodCounters: public MetaspaceObj {
|
||||
|
||||
void clear_counters();
|
||||
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
int interpreter_invocation_count() {
|
||||
return _interpreter_invocation_count;
|
||||
}
|
||||
@ -131,6 +135,24 @@ class MethodCounters: public MetaspaceObj {
|
||||
_interpreter_throwout_count = count;
|
||||
}
|
||||
|
||||
#else // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
int interpreter_invocation_count() {
|
||||
return 0;
|
||||
}
|
||||
void set_interpreter_invocation_count(int count) {
|
||||
assert(count == 0, "count must be 0");
|
||||
}
|
||||
|
||||
int interpreter_throwout_count() const {
|
||||
return 0;
|
||||
}
|
||||
void set_interpreter_throwout_count(int count) {
|
||||
assert(count == 0, "count must be 0");
|
||||
}
|
||||
|
||||
#endif // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
u2 number_of_breakpoints() const { return _number_of_breakpoints; }
|
||||
void incr_number_of_breakpoints() { ++_number_of_breakpoints; }
|
||||
void decr_number_of_breakpoints() { --_number_of_breakpoints; }
|
||||
@ -170,10 +192,25 @@ class MethodCounters: public MetaspaceObj {
|
||||
return byte_offset_of(MethodCounters, _nmethod_age);
|
||||
}
|
||||
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
static ByteSize interpreter_invocation_counter_offset() {
|
||||
return byte_offset_of(MethodCounters, _interpreter_invocation_count);
|
||||
}
|
||||
|
||||
static int interpreter_invocation_counter_offset_in_bytes() {
|
||||
return offset_of(MethodCounters, _interpreter_invocation_count);
|
||||
}
|
||||
|
||||
#else // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
static ByteSize interpreter_invocation_counter_offset() {
|
||||
ShouldNotReachHere();
|
||||
return in_ByteSize(0);
|
||||
}
|
||||
|
||||
#endif // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
static ByteSize invocation_counter_offset() {
|
||||
return byte_offset_of(MethodCounters, _invocation_counter);
|
||||
}
|
||||
@ -182,10 +219,6 @@ class MethodCounters: public MetaspaceObj {
|
||||
return byte_offset_of(MethodCounters, _backedge_counter);
|
||||
}
|
||||
|
||||
static int interpreter_invocation_counter_offset_in_bytes() {
|
||||
return offset_of(MethodCounters, _interpreter_invocation_count);
|
||||
}
|
||||
|
||||
static ByteSize interpreter_invocation_limit_offset() {
|
||||
return byte_offset_of(MethodCounters, _interpreter_invocation_limit);
|
||||
}
|
||||
|
@ -3595,6 +3595,11 @@ jint Arguments::finalize_vm_init_args(ArgumentBootClassPath* bcp_p, bool bcp_ass
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(COMPILER2) && !INCLUDE_JVMCI
|
||||
UNSUPPORTED_OPTION(ProfileInterpreter, "ProfileInterpreter");
|
||||
NOT_PRODUCT(UNSUPPORTED_OPTION(TraceProfileInterpreter, "TraceProfileInterpreter"));
|
||||
#endif
|
||||
|
||||
#ifndef TIERED
|
||||
// Tiered compilation is undefined.
|
||||
UNSUPPORTED_OPTION(TieredCompilation, "TieredCompilation");
|
||||
|
@ -384,8 +384,8 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
|
||||
nonstatic_field(MethodCounters, _interpreter_profile_limit, int) \
|
||||
nonstatic_field(MethodCounters, _invoke_mask, int) \
|
||||
nonstatic_field(MethodCounters, _backedge_mask, int) \
|
||||
nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \
|
||||
nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \
|
||||
COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(MethodCounters, _interpreter_invocation_count, int)) \
|
||||
COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(MethodCounters, _interpreter_throwout_count, u2)) \
|
||||
nonstatic_field(MethodCounters, _number_of_breakpoints, u2) \
|
||||
nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \
|
||||
nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -206,6 +206,17 @@
|
||||
#define NOT_COMPILER2(code) code
|
||||
#endif // COMPILER2
|
||||
|
||||
// COMPILER2 or JVMCI
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
#define COMPILER2_OR_JVMCI 1
|
||||
#define COMPILER2_OR_JVMCI_PRESENT(code) code
|
||||
#define NOT_COMPILER2_OR_JVMCI(code)
|
||||
#else
|
||||
#define COMPILER2_OR_JVMCI 0
|
||||
#define COMPILER2_OR_JVMCI_PRESENT(code)
|
||||
#define NOT_COMPILER2_OR_JVMCI(code) code
|
||||
#endif
|
||||
|
||||
#ifdef TIERED
|
||||
#define TIERED_ONLY(code) code
|
||||
#define NOT_TIERED(code)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -21,25 +21,14 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8050079
|
||||
* @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA.
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* java.base/jdk.internal
|
||||
* @ignore 8132924
|
||||
* @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java
|
||||
* @run main TestMonomorphicObjectCall
|
||||
* @build java.base/java.lang.Object
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-VerifyDependencies
|
||||
* -XX:TieredStopAtLevel=1 -XX:CompileOnly=TestMonomorphicObjectCall::callFinalize
|
||||
* -XX:CompileOnly=java.lang.Object::finalizeObject TestMonomorphicObjectCall
|
||||
*/
|
||||
public class TestMonomorphicObjectCall {
|
||||
|
||||
@ -51,32 +40,7 @@ public class TestMonomorphicObjectCall {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
if (args.length == 0) {
|
||||
byte[] bytecode = Files.readAllBytes(Paths.get(System.getProperty("test.classes") + File.separator +
|
||||
"java" + File.separator + "lang" + File.separator + "Object.class"));
|
||||
ClassFileInstaller.writeClassToDisk("java.lang.Object", bytecode, "mods/java.base");
|
||||
// Execute new instance with modified java.lang.Object
|
||||
executeTestJvm();
|
||||
} else {
|
||||
// Trigger compilation of 'callFinalize'
|
||||
callFinalize(new Object());
|
||||
}
|
||||
}
|
||||
|
||||
public static void executeTestJvm() throws Throwable {
|
||||
// Execute test with modified version of java.lang.Object
|
||||
// in -Xbootclasspath.
|
||||
String[] vmOpts = new String[] {
|
||||
"-Xpatch:mods",
|
||||
"-Xcomp",
|
||||
"-XX:+IgnoreUnrecognizedVMOptions",
|
||||
"-XX:-VerifyDependencies",
|
||||
"-XX:CompileOnly=TestMonomorphicObjectCall::callFinalize",
|
||||
"-XX:CompileOnly=Object::finalizeObject",
|
||||
"-XX:TieredStopAtLevel=1",
|
||||
TestMonomorphicObjectCall.class.getName(),
|
||||
"true"};
|
||||
OutputAnalyzer output = ProcessTools.executeTestJvm(vmOpts);
|
||||
output.shouldHaveExitValue(0);
|
||||
// Trigger compilation of 'callFinalize'
|
||||
callFinalize(new Object());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
Loading…
x
Reference in New Issue
Block a user