mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-15 08:34:30 +02:00
Merge
This commit is contained in:
commit
9a6dfe1c55
11 changed files with 553 additions and 65 deletions
|
@ -28,10 +28,10 @@ import java.io.*;
|
|||
import java.util.*;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.basic.x86.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.basic.amd64.*;
|
||||
import sun.jvm.hotspot.debugger.x86.*;
|
||||
import sun.jvm.hotspot.debugger.amd64.*;
|
||||
import sun.jvm.hotspot.debugger.windows.x86.*;
|
||||
import sun.jvm.hotspot.debugger.windows.amd64.*;
|
||||
import sun.jvm.hotspot.utilities.AddressOps;
|
||||
|
||||
class WindbgCDebugger implements CDebugger {
|
||||
|
@ -75,14 +75,14 @@ class WindbgCDebugger implements CDebugger {
|
|||
if (ebp == null) return null;
|
||||
Address pc = context.getRegisterAsAddress(X86ThreadContext.EIP);
|
||||
if (pc == null) return null;
|
||||
return new X86CFrame(this, ebp, pc);
|
||||
return new WindowsX86CFrame(dbg, ebp, pc);
|
||||
} else if (dbg.getCPU().equals("amd64")) {
|
||||
AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext();
|
||||
Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP);
|
||||
if (rbp == null) return null;
|
||||
Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP);
|
||||
if (pc == null) return null;
|
||||
return new AMD64CFrame(this, rbp, pc);
|
||||
return new WindowsAMD64CFrame(dbg, rbp, pc);
|
||||
} else {
|
||||
// unsupported CPU!
|
||||
return null;
|
||||
|
|
|
@ -22,26 +22,26 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.debugger.cdbg.basic.amd64;
|
||||
package sun.jvm.hotspot.debugger.windows.amd64;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.debugger.amd64.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.basic.*;
|
||||
import sun.jvm.hotspot.debugger.windbg.*;
|
||||
|
||||
/** Basic AMD64 frame functionality providing sender() functionality. */
|
||||
|
||||
public class AMD64CFrame extends BasicCFrame {
|
||||
public class WindowsAMD64CFrame extends BasicCFrame {
|
||||
private Address rbp;
|
||||
private Address pc;
|
||||
|
||||
private static final int ADDRESS_SIZE = 8;
|
||||
|
||||
/** Constructor for topmost frame */
|
||||
public AMD64CFrame(CDebugger dbg, Address rbp, Address pc) {
|
||||
super(dbg);
|
||||
public WindowsAMD64CFrame(WindbgDebugger dbg, Address rbp, Address pc) {
|
||||
super(dbg.getCDebugger());
|
||||
this.rbp = rbp;
|
||||
this.pc = pc;
|
||||
this.dbg = dbg;
|
||||
}
|
||||
|
||||
public CFrame sender(ThreadProxy thread) {
|
||||
|
@ -52,15 +52,20 @@ public class AMD64CFrame extends BasicCFrame {
|
|||
return null;
|
||||
}
|
||||
|
||||
// Check alignment of rbp
|
||||
if ( dbg.getAddressValue(rbp) % ADDRESS_SIZE != 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Address nextRBP = rbp.getAddressAt( 0 * ADDRESS_SIZE);
|
||||
if (nextRBP == null) {
|
||||
if (nextRBP == null || nextRBP.lessThanOrEqual(rbp)) {
|
||||
return null;
|
||||
}
|
||||
Address nextPC = rbp.getAddressAt( 1 * ADDRESS_SIZE);
|
||||
if (nextPC == null) {
|
||||
return null;
|
||||
}
|
||||
return new AMD64CFrame(dbg(), nextRBP, nextPC);
|
||||
return new WindowsAMD64CFrame(dbg, nextRBP, nextPC);
|
||||
}
|
||||
|
||||
public Address pc() {
|
||||
|
@ -70,4 +75,6 @@ public class AMD64CFrame extends BasicCFrame {
|
|||
public Address localVariableBase() {
|
||||
return rbp;
|
||||
}
|
||||
|
||||
private WindbgDebugger dbg;
|
||||
}
|
|
@ -22,26 +22,26 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.debugger.cdbg.basic.x86;
|
||||
package sun.jvm.hotspot.debugger.windows.x86;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.debugger.x86.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.*;
|
||||
import sun.jvm.hotspot.debugger.cdbg.basic.*;
|
||||
import sun.jvm.hotspot.debugger.windbg.*;
|
||||
|
||||
/** Basic X86 frame functionality providing sender() functionality. */
|
||||
|
||||
public class X86CFrame extends BasicCFrame {
|
||||
public class WindowsX86CFrame extends BasicCFrame {
|
||||
private Address ebp;
|
||||
private Address pc;
|
||||
|
||||
private static final int ADDRESS_SIZE = 4;
|
||||
|
||||
/** Constructor for topmost frame */
|
||||
public X86CFrame(CDebugger dbg, Address ebp, Address pc) {
|
||||
super(dbg);
|
||||
public WindowsX86CFrame(WindbgDebugger dbg, Address ebp, Address pc) {
|
||||
super(dbg.getCDebugger());
|
||||
this.ebp = ebp;
|
||||
this.pc = pc;
|
||||
this.dbg = dbg;
|
||||
}
|
||||
|
||||
public CFrame sender(ThreadProxy thread) {
|
||||
|
@ -52,15 +52,20 @@ public class X86CFrame extends BasicCFrame {
|
|||
return null;
|
||||
}
|
||||
|
||||
// Check alignment of ebp
|
||||
if ( dbg.getAddressValue(ebp) % ADDRESS_SIZE != 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Address nextEBP = ebp.getAddressAt( 0 * ADDRESS_SIZE);
|
||||
if (nextEBP == null) {
|
||||
if (nextEBP == null || nextEBP.lessThanOrEqual(ebp)) {
|
||||
return null;
|
||||
}
|
||||
Address nextPC = ebp.getAddressAt( 1 * ADDRESS_SIZE);
|
||||
if (nextPC == null) {
|
||||
return null;
|
||||
}
|
||||
return new X86CFrame(dbg(), nextEBP, nextPC);
|
||||
return new WindowsX86CFrame(dbg, nextEBP, nextPC);
|
||||
}
|
||||
|
||||
public Address pc() {
|
||||
|
@ -70,4 +75,6 @@ public class X86CFrame extends BasicCFrame {
|
|||
public Address localVariableBase() {
|
||||
return ebp;
|
||||
}
|
||||
|
||||
private WindbgDebugger dbg;
|
||||
}
|
|
@ -48,8 +48,6 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/amd64/*.java \
|
|||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/bsd/x86/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/x86/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \
|
||||
|
@ -70,6 +68,8 @@ $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/win32/coff/*.java \
|
|||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/amd64/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/x86/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/x86/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/amd64/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/x86/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/g1/*.java \
|
||||
$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/parallelScavenge/*.java \
|
||||
|
|
|
@ -1719,15 +1719,28 @@ void ClassFileParser::parse_annotations(u1* buffer, int limit,
|
|||
coll->set_annotation(id);
|
||||
|
||||
if (id == AnnotationCollector::_sun_misc_Contended) {
|
||||
// @Contended can optionally specify the contention group.
|
||||
//
|
||||
// Contended group defines the equivalence class over the fields:
|
||||
// the fields within the same contended group are not treated distinct.
|
||||
// The only exception is default group, which does not incur the
|
||||
// equivalence. Naturally, contention group for classes is meaningless.
|
||||
//
|
||||
// While the contention group is specified as String, annotation
|
||||
// values are already interned, and we might as well use the constant
|
||||
// pool index as the group tag.
|
||||
//
|
||||
u2 group_index = 0; // default contended group
|
||||
if (count == 1
|
||||
&& s_size == (index - index0) // match size
|
||||
&& s_tag_val == *(abase + tag_off)
|
||||
&& member == vmSymbols::value_name()) {
|
||||
u2 group_index = Bytes::get_Java_u2(abase + s_con_off);
|
||||
coll->set_contended_group(group_index);
|
||||
} else {
|
||||
coll->set_contended_group(0); // default contended group
|
||||
group_index = Bytes::get_Java_u2(abase + s_con_off);
|
||||
if (_cp->symbol_at(group_index)->utf8_length() == 0) {
|
||||
group_index = 0; // default contended group
|
||||
}
|
||||
}
|
||||
coll->set_contended_group(group_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3165,13 +3178,13 @@ void ClassFileParser::layout_fields(Handle class_loader,
|
|||
first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
|
||||
nonstatic_field_size * heapOopSize;
|
||||
|
||||
next_nonstatic_field_offset = first_nonstatic_field_offset;
|
||||
|
||||
// class is contended, pad before all the fields
|
||||
if (parsed_annotations->is_contended()) {
|
||||
first_nonstatic_field_offset += pad_size;
|
||||
next_nonstatic_field_offset += pad_size;
|
||||
}
|
||||
|
||||
next_nonstatic_field_offset = first_nonstatic_field_offset;
|
||||
|
||||
unsigned int nonstatic_double_count = fac->count[NONSTATIC_DOUBLE] - fac_contended.count[NONSTATIC_DOUBLE];
|
||||
unsigned int nonstatic_word_count = fac->count[NONSTATIC_WORD] - fac_contended.count[NONSTATIC_WORD];
|
||||
unsigned int nonstatic_short_count = fac->count[NONSTATIC_SHORT] - fac_contended.count[NONSTATIC_SHORT];
|
||||
|
@ -3562,7 +3575,7 @@ void ClassFileParser::layout_fields(Handle class_loader,
|
|||
int instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
|
||||
|
||||
assert(instance_size == align_object_size(align_size_up(
|
||||
(instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize + ((parsed_annotations->is_contended()) ? pad_size : 0)),
|
||||
(instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize),
|
||||
wordSize) / wordSize), "consistent layout helper value");
|
||||
|
||||
// Number of non-static oop map blocks allocated at end of klass.
|
||||
|
|
|
@ -1624,15 +1624,19 @@ void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method
|
|||
}
|
||||
}
|
||||
|
||||
assert(sig_type != '[', "array should have sig_type == 'L'");
|
||||
bool handle_created = false;
|
||||
|
||||
// convert oop to JNI handle.
|
||||
if (sig_type == 'L' || sig_type == '[') {
|
||||
if (sig_type == 'L') {
|
||||
handle_created = true;
|
||||
value->l = (jobject)JNIHandles::make_local(thread, (oop)value->l);
|
||||
}
|
||||
|
||||
post_field_modification(thread, method, location, field_klass, object, field, sig_type, value);
|
||||
|
||||
// Destroy the JNI handle allocated above.
|
||||
if (sig_type == 'L') {
|
||||
if (handle_created) {
|
||||
JNIHandles::destroy_local(value->l);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
|
||||
##
|
||||
## @test Test7158804.sh
|
||||
## @bug 7158804
|
||||
## @summary Improve config file parsing
|
||||
## @run shell Test7158804.sh
|
||||
##
|
||||
if [ "${TESTSRC}" = "" ]
|
||||
then
|
||||
TESTSRC=${PWD}
|
||||
echo "TESTSRC not set. Using "${TESTSRC}" as default"
|
||||
fi
|
||||
echo "TESTSRC=${TESTSRC}"
|
||||
## Adding common setup Variables for running shell tests.
|
||||
. ${TESTSRC}/../../test_env.sh
|
||||
|
||||
rm -f .hotspotrc
|
||||
echo -XX:+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >.hotspotrc
|
||||
${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:+IgnoreUnrecognizedVMOptions -XX:Flags=.hotspotrc -version
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Test Failed"
|
||||
exit 1
|
||||
fi
|
||||
rm -f .hotspotrc
|
||||
exit 0
|
55
hotspot/test/runtime/CommandLine/ConfigFileParsing.java
Normal file
55
hotspot/test/runtime/CommandLine/ConfigFileParsing.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test ConfigFileParsing
|
||||
* @bug 7158804
|
||||
* @summary Improve config file parsing
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import com.oracle.java.testlibrary.*;
|
||||
|
||||
public class ConfigFileParsing {
|
||||
public static void main(String[] args) throws Exception {
|
||||
String testFileName = ".hotspotrc";
|
||||
|
||||
// Create really long invalid option
|
||||
String reallyLongInvalidOption = "";
|
||||
for (int i=0; i<5000; i++)
|
||||
reallyLongInvalidOption+='a';
|
||||
|
||||
// Populate the options file with really long string
|
||||
PrintWriter pw = new PrintWriter(testFileName);
|
||||
pw.println("-XX:+" + reallyLongInvalidOption);
|
||||
pw.close();
|
||||
|
||||
// start VM
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+IgnoreUnrecognizedVMOptions", "-XX:Flags=.hotspotrc", "-version");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
|
@ -32,10 +32,10 @@ import com.oracle.java.testlibrary.*;
|
|||
* @library /testlibrary
|
||||
* @build Agent
|
||||
* @run main ClassFileInstaller Agent
|
||||
* @run main Test
|
||||
* @run main TestRedefineObject
|
||||
* @run main/othervm -javaagent:agent.jar Agent
|
||||
*/
|
||||
public class Test {
|
||||
public class TestRedefineObject {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
PrintWriter pw = new PrintWriter("MANIFEST.MF");
|
||||
|
|
185
hotspot/test/runtime/contended/DefaultValue.java
Normal file
185
hotspot/test/runtime/contended/DefaultValue.java
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 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.
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.Class;
|
||||
import java.lang.String;
|
||||
import java.lang.System;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import sun.misc.Unsafe;
|
||||
import sun.misc.Contended;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8014509
|
||||
* @summary \@Contended: explicit default value behaves differently from the implicit value
|
||||
*
|
||||
* @run main/othervm -XX:-RestrictContended DefaultValue
|
||||
*/
|
||||
public class DefaultValue {
|
||||
|
||||
private static final Unsafe U;
|
||||
private static int ADDRESS_SIZE;
|
||||
private static int HEADER_SIZE;
|
||||
|
||||
static {
|
||||
// steal Unsafe
|
||||
try {
|
||||
Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
unsafe.setAccessible(true);
|
||||
U = (Unsafe) unsafe.get(null);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
// When running with CompressedOops on 64-bit platform, the address size
|
||||
// reported by Unsafe is still 8, while the real reference fields are 4 bytes long.
|
||||
// Try to guess the reference field size with this naive trick.
|
||||
try {
|
||||
long off1 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj1"));
|
||||
long off2 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj2"));
|
||||
ADDRESS_SIZE = (int) Math.abs(off2 - off1);
|
||||
HEADER_SIZE = (int) Math.min(off1, off2);
|
||||
} catch (NoSuchFieldException e) {
|
||||
ADDRESS_SIZE = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static class CompressedOopsClass {
|
||||
public Object obj1;
|
||||
public Object obj2;
|
||||
}
|
||||
|
||||
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
|
||||
Field f1 = klass.getField(field1);
|
||||
Field f2 = klass.getField(field2);
|
||||
|
||||
int diff = offset(f1) - offset(f2);
|
||||
if (diff < 0) {
|
||||
// f1 is first
|
||||
return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
|
||||
} else {
|
||||
// f2 is first
|
||||
return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean sameLayout(Class klass1, Class klass2) throws Exception {
|
||||
for (Field f1 : klass1.getDeclaredFields()) {
|
||||
Field f2 = klass2.getDeclaredField(f1.getName());
|
||||
if (offset(f1) != offset(f2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (Field f2 : klass1.getDeclaredFields()) {
|
||||
Field f1 = klass2.getDeclaredField(f2.getName());
|
||||
if (offset(f1) != offset(f2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isStatic(Field field) {
|
||||
return Modifier.isStatic(field.getModifiers());
|
||||
}
|
||||
|
||||
public static int offset(Field field) {
|
||||
if (isStatic(field)) {
|
||||
return (int) U.staticFieldOffset(field);
|
||||
} else {
|
||||
return (int) U.objectFieldOffset(field);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getSize(Field field) {
|
||||
Class type = field.getType();
|
||||
if (type == byte.class) { return 1; }
|
||||
if (type == boolean.class) { return 1; }
|
||||
if (type == short.class) { return 2; }
|
||||
if (type == char.class) { return 2; }
|
||||
if (type == int.class) { return 4; }
|
||||
if (type == float.class) { return 4; }
|
||||
if (type == long.class) { return 8; }
|
||||
if (type == double.class) { return 8; }
|
||||
return ADDRESS_SIZE;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
boolean endResult = true;
|
||||
|
||||
if (!arePaddedPairwise(R1.class, "int1", "int2")) {
|
||||
System.err.println("R1 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(R2.class, "int1", "int2")) {
|
||||
System.err.println("R2 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(R3.class, "int1", "int2")) {
|
||||
System.err.println("R3 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
System.out.println(endResult ? "Test PASSES" : "Test FAILS");
|
||||
if (!endResult) {
|
||||
throw new Error("Test failed");
|
||||
}
|
||||
}
|
||||
|
||||
public static class R1 {
|
||||
@Contended
|
||||
public int int1;
|
||||
@Contended
|
||||
public int int2;
|
||||
}
|
||||
|
||||
public static class R2 {
|
||||
@Contended("")
|
||||
public int int1;
|
||||
@Contended("")
|
||||
public int int2;
|
||||
}
|
||||
|
||||
public static class R3 {
|
||||
@Contended()
|
||||
public int int1;
|
||||
@Contended()
|
||||
public int int2;
|
||||
}
|
||||
|
||||
}
|
||||
|
248
hotspot/test/runtime/contended/Inheritance1.java
Normal file
248
hotspot/test/runtime/contended/Inheritance1.java
Normal file
|
@ -0,0 +1,248 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 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.
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.Class;
|
||||
import java.lang.String;
|
||||
import java.lang.System;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import sun.misc.Unsafe;
|
||||
import sun.misc.Contended;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8012939
|
||||
* @summary \@Contended doesn't work correctly with inheritance
|
||||
*
|
||||
* @run main/othervm -XX:-RestrictContended Inheritance1
|
||||
*/
|
||||
public class Inheritance1 {
|
||||
|
||||
private static final Unsafe U;
|
||||
private static int ADDRESS_SIZE;
|
||||
private static int HEADER_SIZE;
|
||||
|
||||
static {
|
||||
// steal Unsafe
|
||||
try {
|
||||
Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
|
||||
unsafe.setAccessible(true);
|
||||
U = (Unsafe) unsafe.get(null);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
// When running with CompressedOops on 64-bit platform, the address size
|
||||
// reported by Unsafe is still 8, while the real reference fields are 4 bytes long.
|
||||
// Try to guess the reference field size with this naive trick.
|
||||
try {
|
||||
long off1 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj1"));
|
||||
long off2 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj2"));
|
||||
ADDRESS_SIZE = (int) Math.abs(off2 - off1);
|
||||
HEADER_SIZE = (int) Math.min(off1, off2);
|
||||
} catch (NoSuchFieldException e) {
|
||||
ADDRESS_SIZE = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static class CompressedOopsClass {
|
||||
public Object obj1;
|
||||
public Object obj2;
|
||||
}
|
||||
|
||||
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
|
||||
Field f1 = klass.getField(field1);
|
||||
Field f2 = klass.getField(field2);
|
||||
|
||||
int diff = offset(f1) - offset(f2);
|
||||
if (diff < 0) {
|
||||
// f1 is first
|
||||
return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
|
||||
} else {
|
||||
// f2 is first
|
||||
return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean sameLayout(Class klass1, Class klass2) throws Exception {
|
||||
for (Field f1 : klass1.getDeclaredFields()) {
|
||||
Field f2 = klass2.getDeclaredField(f1.getName());
|
||||
if (offset(f1) != offset(f2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (Field f2 : klass1.getDeclaredFields()) {
|
||||
Field f1 = klass2.getDeclaredField(f2.getName());
|
||||
if (offset(f1) != offset(f2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isStatic(Field field) {
|
||||
return Modifier.isStatic(field.getModifiers());
|
||||
}
|
||||
|
||||
public static int offset(Field field) {
|
||||
if (isStatic(field)) {
|
||||
return (int) U.staticFieldOffset(field);
|
||||
} else {
|
||||
return (int) U.objectFieldOffset(field);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getSize(Field field) {
|
||||
Class type = field.getType();
|
||||
if (type == byte.class) { return 1; }
|
||||
if (type == boolean.class) { return 1; }
|
||||
if (type == short.class) { return 2; }
|
||||
if (type == char.class) { return 2; }
|
||||
if (type == int.class) { return 4; }
|
||||
if (type == float.class) { return 4; }
|
||||
if (type == long.class) { return 8; }
|
||||
if (type == double.class) { return 8; }
|
||||
return ADDRESS_SIZE;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
boolean endResult = true;
|
||||
|
||||
// --------------- INSTANCE FIELDS ---------------------
|
||||
|
||||
if (!arePaddedPairwise(A2_R1.class, "int1", "int2")) {
|
||||
System.err.println("A2_R1 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(A3_R1.class, "int1", "int2")) {
|
||||
System.err.println("A3_R1 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(A1_R2.class, "int1", "int2")) {
|
||||
System.err.println("A1_R2 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(A2_R2.class, "int1", "int2")) {
|
||||
System.err.println("A2_R2 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(A3_R2.class, "int1", "int2")) {
|
||||
System.err.println("A3_R2 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(A1_R3.class, "int1", "int2")) {
|
||||
System.err.println("A1_R3 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(A2_R3.class, "int1", "int2")) {
|
||||
System.err.println("A2_R3 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
if (!arePaddedPairwise(A3_R3.class, "int1", "int2")) {
|
||||
System.err.println("A3_R3 failed");
|
||||
endResult &= false;
|
||||
}
|
||||
|
||||
System.out.println(endResult ? "Test PASSES" : "Test FAILS");
|
||||
if (!endResult) {
|
||||
throw new Error("Test failed");
|
||||
}
|
||||
}
|
||||
|
||||
public static class R1 {
|
||||
public int int1;
|
||||
}
|
||||
|
||||
public static class R2 {
|
||||
@Contended
|
||||
public int int1;
|
||||
}
|
||||
|
||||
@Contended
|
||||
public static class R3 {
|
||||
public int int1;
|
||||
}
|
||||
|
||||
public static class A1_R1 extends R1 {
|
||||
public int int2;
|
||||
}
|
||||
|
||||
public static class A2_R1 extends R1 {
|
||||
@Contended
|
||||
public int int2;
|
||||
}
|
||||
|
||||
@Contended
|
||||
public static class A3_R1 extends R1 {
|
||||
public int int2;
|
||||
}
|
||||
|
||||
public static class A1_R2 extends R2 {
|
||||
public int int2;
|
||||
}
|
||||
|
||||
public static class A2_R2 extends R2 {
|
||||
@Contended
|
||||
public int int2;
|
||||
}
|
||||
|
||||
@Contended
|
||||
public static class A3_R2 extends R2 {
|
||||
public int int2;
|
||||
}
|
||||
|
||||
public static class A1_R3 extends R3 {
|
||||
public int int2;
|
||||
}
|
||||
|
||||
public static class A2_R3 extends R3 {
|
||||
@Contended
|
||||
public int int2;
|
||||
}
|
||||
|
||||
@Contended
|
||||
public static class A3_R3 extends R3 {
|
||||
public int int2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue