This commit is contained in:
Jesper Wilhelmsson 2017-08-08 22:55:42 +02:00
commit 2cfd23d6f4
56 changed files with 239 additions and 368 deletions

View File

@ -46,6 +46,7 @@ $(eval $(call SetupBuildLauncher, jaotc, \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.runtime=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
--add-exports=jdk.internal.vm.ci/jdk.vm.ci.sparc=$(call CommaList, jdk.internal.vm.compiler jdk.aot) \
-XX:+UseAOT \
-XX:+CalculateClassFingerprint \
-Djvmci.UseProfilingInformation=false \
-Dgraal.UseExceptionProbability=false \
-Djvmci.Compiler=graal \

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2017, 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
@ -35,12 +35,14 @@ include $(SPEC)
include MakeBase.gmk
include TestFilesCompilation.gmk
$(eval $(call IncludeCustomExtension, jdk, test/JtregNative.gmk))
################################################################################
# Targets for building the native tests themselves.
################################################################################
# Add more directories here when needed.
BUILD_JDK_JTREG_NATIVE_SRC := \
BUILD_JDK_JTREG_NATIVE_SRC += \
$(JDK_TOPDIR)/test/native_sanity \
$(JDK_TOPDIR)/test/java/lang/String/nativeEncoding \
#

View File

@ -64,7 +64,7 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
#include <poll.h>
#include "jvm.h"
#include "net_util.h"

View File

@ -34,7 +34,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <poll.h>
#include <sys/pollset.h>
#include <fcntl.h>
#include <stddef.h>

View File

@ -36,7 +36,7 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
#include <poll.h>
#include "jvm.h"
#include "net_util.h"

View File

@ -32,7 +32,7 @@
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <poll.h>
#include <sys/inotify.h>
#include "sun_nio_fs_LinuxWatchService.h"

View File

@ -60,7 +60,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/signal.h>
#include <signal.h>
/* O Flags */

View File

@ -290,8 +290,6 @@ static int (*main_fptr)(int argc, char **argv) = NULL;
*/
static void *apple_main (void *arg)
{
objc_registerThreadWithCollector();
if (main_fptr == NULL) {
#ifdef STATIC_BUILD
extern int main(int argc, char **argv);
@ -732,6 +730,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (stack_size > 0) {
pthread_attr_setstacksize(&attr, stack_size);
}
pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;
@ -771,7 +770,7 @@ JLI_GetJavaVMInstance()
void
RegisterThread()
{
objc_registerThreadWithCollector();
// stubbed out for windows and *nixes.
}
static void

View File

@ -38,7 +38,7 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
#include <poll.h>
#include "jvm.h"
#include "net_util.h"

View File

@ -2241,22 +2241,12 @@ public class File
UNSAFE.putIntVolatile(this, PREFIX_LENGTH_OFFSET, fs.prefixLength(path));
}
private static final long PATH_OFFSET;
private static final long PREFIX_LENGTH_OFFSET;
private static final jdk.internal.misc.Unsafe UNSAFE;
static {
try {
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
PATH_OFFSET = unsafe.objectFieldOffset(
File.class.getDeclaredField("path"));
PREFIX_LENGTH_OFFSET = unsafe.objectFieldOffset(
File.class.getDeclaredField("prefixLength"));
UNSAFE = unsafe;
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final jdk.internal.misc.Unsafe UNSAFE
= jdk.internal.misc.Unsafe.getUnsafe();
private static final long PATH_OFFSET
= UNSAFE.objectFieldOffset(File.class, "path");
private static final long PREFIX_LENGTH_OFFSET
= UNSAFE.objectFieldOffset(File.class, "prefixLength");
/** use serialVersionUID from JDK 1.0.2 for interoperability */
private static final long serialVersionUID = 301077366599181567L;

View File

@ -2864,26 +2864,14 @@ public final class Class<T> implements java.io.Serializable,
// and have to avoid calling it in the static initializer of the Class class...
private static final Unsafe unsafe = Unsafe.getUnsafe();
// offset of Class.reflectionData instance field
private static final long reflectionDataOffset;
private static final long reflectionDataOffset
= unsafe.objectFieldOffset(Class.class, "reflectionData");
// offset of Class.annotationType instance field
private static final long annotationTypeOffset;
private static final long annotationTypeOffset
= unsafe.objectFieldOffset(Class.class, "annotationType");
// offset of Class.annotationData instance field
private static final long annotationDataOffset;
static {
Field[] fields = Class.class.getDeclaredFields0(false); // bypass caches
reflectionDataOffset = objectFieldOffset(fields, "reflectionData");
annotationTypeOffset = objectFieldOffset(fields, "annotationType");
annotationDataOffset = objectFieldOffset(fields, "annotationData");
}
private static long objectFieldOffset(Field[] fields, String fieldName) {
Field field = searchFields(fields, fieldName);
if (field == null) {
throw new Error("No " + fieldName + " field found in java.lang.Class");
}
return unsafe.objectFieldOffset(field);
}
private static final long annotationDataOffset
= unsafe.objectFieldOffset(Class.class, "annotationData");
static <T> boolean casReflectionData(Class<?> clazz,
SoftReference<ReflectionData<T>> oldData,

View File

@ -30,7 +30,6 @@ import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.net.URL;
import java.security.AccessController;
import java.security.AccessControlContext;
@ -2895,12 +2894,7 @@ public abstract class ClassLoader {
Unsafe unsafe = Unsafe.getUnsafe();
Class<?> k = ClassLoader.class;
long offset;
try {
Field f = k.getDeclaredField(name);
offset = unsafe.objectFieldOffset(f);
} catch (NoSuchFieldException e) {
throw new InternalError(e);
}
offset = unsafe.objectFieldOffset(k, name);
return unsafe.compareAndSetObject(this, offset, null, obj);
}
}

View File

@ -130,7 +130,7 @@ public final class Module implements AnnotatedElement {
// define module to VM
boolean isOpen = descriptor.isOpen();
boolean isOpen = descriptor.isOpen() || descriptor.isAutomatic();
Version version = descriptor.version().orElse(null);
String vs = Objects.toString(version, null);
String loc = Objects.toString(uri, null);
@ -1156,18 +1156,14 @@ public final class Module implements AnnotatedElement {
m.implAddReads(ALL_UNNAMED_MODULE, true);
}
// exports and opens
if (descriptor.isOpen() || descriptor.isAutomatic()) {
// The VM doesn't special case open or automatic modules yet
// so need to export all packages
for (String source : descriptor.packages()) {
addExportsToAll0(m, source);
// exports and opens, skipped for open and automatic
if (!descriptor.isOpen() && !descriptor.isAutomatic()) {
if (isBootLayer && descriptor.opens().isEmpty()) {
// no open packages, no qualified exports to modules in parent layers
initExports(m, nameToModule);
} else {
initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
}
} else if (isBootLayer && descriptor.opens().isEmpty()) {
// no open packages, no qualified exports to modules in parent layers
initExports(m, nameToModule);
} else {
initExportsAndOpens(m, nameToSource, nameToModule, layer.parents());
}
}

View File

@ -276,11 +276,9 @@ public class CallSite {
if (offset > 0) {
return offset;
}
try {
offset = TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target"));
assert(offset > 0);
return offset;
} catch (Exception ex) { throw newInternalError(ex); }
offset = TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class, "target");
assert(offset > 0);
return offset;
}
/*package-private*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2017, 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
@ -70,13 +70,18 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
* and those seven fields omit much of the information in Method.
* @author jrose
*/
/*non-public*/ final class ResolvedMethodName {
//@Injected JVM_Method* vmtarget;
//@Injected Class<?> vmholder;
};
/*non-public*/ final class MemberName implements Member, Cloneable {
private Class<?> clazz; // class in which the method is defined
private Class<?> clazz; // class in which the member is defined
private String name; // may be null if not yet materialized
private Object type; // may be null if not yet materialized
private int flags; // modifier bits; see reflect.Modifier
//@Injected JVM_Method* vmtarget;
//@Injected int vmindex;
private ResolvedMethodName method; // cached resolved method information
//@Injected intptr_t vmindex; // vtable index or offset of resolved member
Object resolution; // if null, this guy is resolved
/** Return the declaring class of this member.

View File

@ -1587,12 +1587,6 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
}
}
private static final long FORM_OFFSET;
static {
try {
FORM_OFFSET = UNSAFE.objectFieldOffset(MethodHandle.class.getDeclaredField("form"));
} catch (ReflectiveOperationException ex) {
throw newInternalError(ex);
}
}
private static final long FORM_OFFSET
= UNSAFE.objectFieldOffset(MethodHandle.class, "form");
}

View File

@ -1239,17 +1239,11 @@ s.writeObject(this.parameterArray());
// Support for resetting final fields while deserializing. Implement Holder
// pattern to make the rarely needed offset calculation lazy.
private static class OffsetHolder {
private static final long rtypeOffset, ptypesOffset;
static {
try {
rtypeOffset = UNSAFE.objectFieldOffset
(MethodType.class.getDeclaredField("rtype"));
ptypesOffset = UNSAFE.objectFieldOffset
(MethodType.class.getDeclaredField("ptypes"));
} catch (Exception ex) {
throw new Error(ex);
}
}
static final long rtypeOffset
= UNSAFE.objectFieldOffset(MethodType.class, "rtype");
static final long ptypesOffset
= UNSAFE.objectFieldOffset(MethodType.class, "ptypes");
}
/**

View File

@ -2014,12 +2014,7 @@ public abstract class VarHandle {
private static final long VFORM_OFFSET;
static {
try {
VFORM_OFFSET = UNSAFE.objectFieldOffset(VarHandle.class.getDeclaredField("vform"));
}
catch (ReflectiveOperationException e) {
throw newInternalError(e);
}
VFORM_OFFSET = UNSAFE.objectFieldOffset(VarHandle.class, "vform");
// The VarHandleGuards must be initialized to ensure correct
// compilation of the guard methods

View File

@ -35,32 +35,20 @@ import static java.lang.invoke.MethodHandleStatics.UNSAFE;
*/
abstract class VarHandleByteArrayBase {
// Buffer.address
static final long BUFFER_ADDRESS;
static final long BUFFER_ADDRESS
= UNSAFE.objectFieldOffset(Buffer.class, "address");
// Buffer.limit
static final long BUFFER_LIMIT;
static final long BUFFER_LIMIT
= UNSAFE.objectFieldOffset(Buffer.class, "limit");
// ByteBuffer.hb
static final long BYTE_BUFFER_HB;
static final long BYTE_BUFFER_HB
= UNSAFE.objectFieldOffset(ByteBuffer.class, "hb");
// ByteBuffer.isReadOnly
static final long BYTE_BUFFER_IS_READ_ONLY;
static {
try {
BUFFER_ADDRESS = UNSAFE.objectFieldOffset(
Buffer.class.getDeclaredField("address"));
BUFFER_LIMIT = UNSAFE.objectFieldOffset(
Buffer.class.getDeclaredField("limit"));
BYTE_BUFFER_HB = UNSAFE.objectFieldOffset(
ByteBuffer.class.getDeclaredField("hb"));
BYTE_BUFFER_IS_READ_ONLY = UNSAFE.objectFieldOffset(
ByteBuffer.class.getDeclaredField("isReadOnly"));
}
catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
static final long BYTE_BUFFER_IS_READ_ONLY
= UNSAFE.objectFieldOffset(ByteBuffer.class, "isReadOnly");
static final boolean BE = UNSAFE.isBigEndian();

View File

@ -4067,20 +4067,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
}
private static class UnsafeHolder {
private static final jdk.internal.misc.Unsafe unsafe;
private static final long intCompactOffset;
private static final long intValOffset;
static {
try {
unsafe = jdk.internal.misc.Unsafe.getUnsafe();
intCompactOffset = unsafe.objectFieldOffset
(BigDecimal.class.getDeclaredField("intCompact"));
intValOffset = unsafe.objectFieldOffset
(BigDecimal.class.getDeclaredField("intVal"));
} catch (Exception ex) {
throw new ExceptionInInitializerError(ex);
}
}
private static final jdk.internal.misc.Unsafe unsafe
= jdk.internal.misc.Unsafe.getUnsafe();
private static final long intCompactOffset
= unsafe.objectFieldOffset(BigDecimal.class, "intCompact");
private static final long intValOffset
= unsafe.objectFieldOffset(BigDecimal.class, "intVal");
static void setIntCompact(BigDecimal bd, long val) {
unsafe.putLong(bd, intCompactOffset, val);
}

View File

@ -4582,20 +4582,12 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// Support for resetting final fields while deserializing
private static class UnsafeHolder {
private static final jdk.internal.misc.Unsafe unsafe;
private static final long signumOffset;
private static final long magOffset;
static {
try {
unsafe = jdk.internal.misc.Unsafe.getUnsafe();
signumOffset = unsafe.objectFieldOffset
(BigInteger.class.getDeclaredField("signum"));
magOffset = unsafe.objectFieldOffset
(BigInteger.class.getDeclaredField("mag"));
} catch (Exception ex) {
throw new ExceptionInInitializerError(ex);
}
}
private static final jdk.internal.misc.Unsafe unsafe
= jdk.internal.misc.Unsafe.getUnsafe();
private static final long signumOffset
= unsafe.objectFieldOffset(BigInteger.class, "signum");
private static final long magOffset
= unsafe.objectFieldOffset(BigInteger.class, "mag");
static void putSign(BigInteger bi, int sign) {
unsafe.putInt(bi, signumOffset, sign);

View File

@ -576,19 +576,10 @@ class Inet6Address extends InetAddress {
new ObjectStreamField("ifname", String.class)
};
private static final long FIELDS_OFFSET;
private static final jdk.internal.misc.Unsafe UNSAFE;
static {
try {
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
FIELDS_OFFSET = unsafe.objectFieldOffset(
Inet6Address.class.getDeclaredField("holder6"));
UNSAFE = unsafe;
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final jdk.internal.misc.Unsafe UNSAFE
= jdk.internal.misc.Unsafe.getUnsafe();
private static final long FIELDS_OFFSET = UNSAFE.objectFieldOffset(
Inet6Address.class, "holder6");
/**
* restore the state of this object from stream

View File

@ -1706,20 +1706,10 @@ class InetAddress implements java.io.Serializable {
}
}
private static final long FIELDS_OFFSET;
private static final jdk.internal.misc.Unsafe UNSAFE;
static {
try {
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
FIELDS_OFFSET = unsafe.objectFieldOffset(
InetAddress.class.getDeclaredField("holder")
);
UNSAFE = unsafe;
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final jdk.internal.misc.Unsafe UNSAFE
= jdk.internal.misc.Unsafe.getUnsafe();
private static final long FIELDS_OFFSET
= UNSAFE.objectFieldOffset(InetAddress.class, "holder");
private void readObject (ObjectInputStream s) throws
IOException, ClassNotFoundException {

View File

@ -302,18 +302,10 @@ public class InetSocketAddress
throw new InvalidObjectException("Stream data required");
}
private static final long FIELDS_OFFSET;
private static final jdk.internal.misc.Unsafe UNSAFE;
static {
try {
jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
FIELDS_OFFSET = unsafe.objectFieldOffset(
InetSocketAddress.class.getDeclaredField("holder"));
UNSAFE = unsafe;
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final jdk.internal.misc.Unsafe UNSAFE
= jdk.internal.misc.Unsafe.getUnsafe();
private static final long FIELDS_OFFSET
= UNSAFE.objectFieldOffset(InetSocketAddress.class, "holder");
/**
* Gets the port number.

View File

@ -3306,15 +3306,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
}
private static final Unsafe U = Unsafe.getUnsafe();
private static final long LOCKSTATE;
static {
try {
LOCKSTATE = U.objectFieldOffset
(TreeBin.class.getDeclaredField("lockState"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final long LOCKSTATE
= U.objectFieldOffset(TreeBin.class, "lockState");
}
/* ----------------Table Traversal -------------- */
@ -6380,27 +6373,23 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
private static final int ASHIFT;
static {
try {
SIZECTL = U.objectFieldOffset
(ConcurrentHashMap.class.getDeclaredField("sizeCtl"));
TRANSFERINDEX = U.objectFieldOffset
(ConcurrentHashMap.class.getDeclaredField("transferIndex"));
BASECOUNT = U.objectFieldOffset
(ConcurrentHashMap.class.getDeclaredField("baseCount"));
CELLSBUSY = U.objectFieldOffset
(ConcurrentHashMap.class.getDeclaredField("cellsBusy"));
SIZECTL = U.objectFieldOffset
(ConcurrentHashMap.class, "sizeCtl");
TRANSFERINDEX = U.objectFieldOffset
(ConcurrentHashMap.class, "transferIndex");
BASECOUNT = U.objectFieldOffset
(ConcurrentHashMap.class, "baseCount");
CELLSBUSY = U.objectFieldOffset
(ConcurrentHashMap.class, "cellsBusy");
CELLVALUE = U.objectFieldOffset
(CounterCell.class.getDeclaredField("value"));
CELLVALUE = U.objectFieldOffset
(CounterCell.class, "value");
ABASE = U.arrayBaseOffset(Node[].class);
int scale = U.arrayIndexScale(Node[].class);
if ((scale & (scale - 1)) != 0)
throw new Error("array index scale not a power of two");
ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
ABASE = U.arrayBaseOffset(Node[].class);
int scale = U.arrayIndexScale(Node[].class);
if ((scale & (scale - 1)) != 0)
throw new Error("array index scale not a power of two");
ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
// Reduce the risk of rare disastrous classloading in first call to
// LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773

View File

@ -1050,30 +1050,18 @@ public class ThreadLocalRandom extends Random {
// Unsafe mechanics
private static final Unsafe U = Unsafe.getUnsafe();
private static final long SEED;
private static final long PROBE;
private static final long SECONDARY;
private static final long THREADLOCALS;
private static final long INHERITABLETHREADLOCALS;
private static final long INHERITEDACCESSCONTROLCONTEXT;
static {
try {
SEED = U.objectFieldOffset
(Thread.class.getDeclaredField("threadLocalRandomSeed"));
PROBE = U.objectFieldOffset
(Thread.class.getDeclaredField("threadLocalRandomProbe"));
SECONDARY = U.objectFieldOffset
(Thread.class.getDeclaredField("threadLocalRandomSecondarySeed"));
THREADLOCALS = U.objectFieldOffset
(Thread.class.getDeclaredField("threadLocals"));
INHERITABLETHREADLOCALS = U.objectFieldOffset
(Thread.class.getDeclaredField("inheritableThreadLocals"));
INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset
(Thread.class.getDeclaredField("inheritedAccessControlContext"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final long SEED = U.objectFieldOffset
(Thread.class, "threadLocalRandomSeed");
private static final long PROBE = U.objectFieldOffset
(Thread.class, "threadLocalRandomProbe");
private static final long SECONDARY = U.objectFieldOffset
(Thread.class, "threadLocalRandomSecondarySeed");
private static final long THREADLOCALS = U.objectFieldOffset
(Thread.class, "threadLocals");
private static final long INHERITABLETHREADLOCALS = U.objectFieldOffset
(Thread.class, "inheritableThreadLocals");
private static final long INHERITEDACCESSCONTROLCONTEXT = U.objectFieldOffset
(Thread.class, "inheritedAccessControlContext");
/** Rarely-used holder for the second of a pair of Gaussians */
private static final ThreadLocal<Double> nextLocalGaussian =

View File

@ -59,16 +59,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
* are unresolved cyclic startup dependencies.
*/
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
private static final long VALUE;
static {
try {
VALUE = U.objectFieldOffset
(AtomicInteger.class.getDeclaredField("value"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final long VALUE = U.objectFieldOffset(AtomicInteger.class, "value");
private volatile int value;

View File

@ -73,16 +73,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
* are unresolved cyclic startup dependencies.
*/
private static final jdk.internal.misc.Unsafe U = jdk.internal.misc.Unsafe.getUnsafe();
private static final long VALUE;
static {
try {
VALUE = U.objectFieldOffset
(AtomicLong.class.getDeclaredField("value"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final long VALUE = U.objectFieldOffset(AtomicLong.class, "value");
private volatile long value;

View File

@ -421,21 +421,11 @@ public class LockSupport {
// Hotspot implementation via intrinsics API
private static final Unsafe U = Unsafe.getUnsafe();
private static final long PARKBLOCKER;
private static final long SECONDARY;
private static final long TID;
static {
try {
PARKBLOCKER = U.objectFieldOffset
(Thread.class.getDeclaredField("parkBlocker"));
SECONDARY = U.objectFieldOffset
(Thread.class.getDeclaredField("threadLocalRandomSecondarySeed"));
TID = U.objectFieldOffset
(Thread.class.getDeclaredField("tid"));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
private static final long PARKBLOCKER = U.objectFieldOffset
(Thread.class, "parkBlocker");
private static final long SECONDARY = U.objectFieldOffset
(Thread.class, "threadLocalRandomSecondarySeed");
private static final long TID = U.objectFieldOffset
(Thread.class, "tid");
}

View File

@ -135,17 +135,16 @@ public final class InnocuousThread extends Thread {
Class<?> tk = Thread.class;
Class<?> gk = ThreadGroup.class;
THREAD_LOCALS = UNSAFE.objectFieldOffset
(tk.getDeclaredField("threadLocals"));
THREAD_LOCALS = UNSAFE.objectFieldOffset(tk, "threadLocals");
INHERITABLE_THREAD_LOCALS = UNSAFE.objectFieldOffset
(tk.getDeclaredField("inheritableThreadLocals"));
(tk, "inheritableThreadLocals");
INHERITEDACCESSCONTROLCONTEXT = UNSAFE.objectFieldOffset
(tk.getDeclaredField("inheritedAccessControlContext"));
(tk, "inheritedAccessControlContext");
CONTEXTCLASSLOADER = UNSAFE.objectFieldOffset
(tk.getDeclaredField("contextClassLoader"));
(tk, "contextClassLoader");
long tg = UNSAFE.objectFieldOffset(tk.getDeclaredField("group"));
long gp = UNSAFE.objectFieldOffset(gk.getDeclaredField("parent"));
long tg = UNSAFE.objectFieldOffset(tk, "group");
long gp = UNSAFE.objectFieldOffset(gk, "parent");
ThreadGroup group = (ThreadGroup)
UNSAFE.getObject(Thread.currentThread(), tg);

View File

@ -953,6 +953,25 @@ public final class Unsafe {
return objectFieldOffset0(f);
}
/**
* Reports the location of the field with a given name in the storage
* allocation of its class.
*
* @throws NullPointerException if any parameter is {@code null}.
* @throws InternalError if there is no field named {@code name} declared
* in class {@code c}, i.e., if {@code c.getDeclaredField(name)}
* would throw {@code java.lang.NoSuchFieldException}.
*
* @see #objectFieldOffset(Field)
*/
public long objectFieldOffset(Class<?> c, String name) {
if (c == null || name == null) {
throw new NullPointerException();
}
return objectFieldOffset1(c, name);
}
/**
* Reports the location of a given static field, in conjunction with {@link
* #staticFieldBase}.
@ -3685,6 +3704,7 @@ public final class Unsafe {
private native void copyMemory0(Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes);
private native void copySwapMemory0(Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes, long elemSize);
private native long objectFieldOffset0(Field f);
private native long objectFieldOffset1(Class<?> c, String name);
private native long staticFieldOffset0(Field f);
private native Object staticFieldBase0(Field f);
private native boolean shouldBeInitialized0(Class<?> c);

View File

@ -614,20 +614,13 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
}
private static class UnsafeAccessor {
private static final jdk.internal.misc.Unsafe unsafe;
private static final long typeOffset;
private static final long memberValuesOffset;
static {
try {
unsafe = jdk.internal.misc.Unsafe.getUnsafe();
typeOffset = unsafe.objectFieldOffset
(AnnotationInvocationHandler.class.getDeclaredField("type"));
memberValuesOffset = unsafe.objectFieldOffset
(AnnotationInvocationHandler.class.getDeclaredField("memberValues"));
} catch (Exception ex) {
throw new ExceptionInInitializerError(ex);
}
}
private static final jdk.internal.misc.Unsafe unsafe
= jdk.internal.misc.Unsafe.getUnsafe();
private static final long typeOffset = unsafe.objectFieldOffset
(AnnotationInvocationHandler.class, "type");
private static final long memberValuesOffset = unsafe.objectFieldOffset
(AnnotationInvocationHandler.class, "memberValues");
static void setType(AnnotationInvocationHandler o,
Class<? extends Annotation> type) {
unsafe.putObject(o, typeOffset, type);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@
#ifdef __NEWVALID /* special setup for Sun test regime */
#if defined(i386) || defined(i486) || \
defined(intel) || defined(x86) || defined(arm) || \
defined(i86pc) || defined(_M_IA64) || defined(ia64)
defined(i86pc) || defined(ia64)
#define _LITTLE_ENDIAN
#endif
#endif

View File

@ -206,7 +206,7 @@ static jlong initialHeapSize = 0; /* inital heap size */
* A minimum -Xss stack size suitable for all platforms.
*/
#ifndef STACK_SIZE_MINIMUM
#define STACK_SIZE_MINIMUM (32 * KB)
#define STACK_SIZE_MINIMUM (64 * KB)
#endif
/*

View File

@ -28,7 +28,7 @@
#include "jvm.h"
#include "jlong.h"
#include "sun_nio_ch_DevPollArrayWrapper.h"
#include <sys/poll.h>
#include <poll.h>
#include <unistd.h>
#include <sys/time.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,5 +23,3 @@
* questions.
*/
// AOT uses jdk.internal.misc.Unsafe
exports jdk.internal.misc to jdk.aot;

View File

@ -65,7 +65,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/signal.h>
#include <signal.h>
/* O Flags */

View File

@ -742,6 +742,7 @@ ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void
if (stack_size > 0) {
pthread_attr_setstacksize(&attr, stack_size);
}
pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
void * tmp;

View File

@ -27,7 +27,7 @@
#define NET_UTILS_MD_H
#include <netdb.h>
#include <sys/poll.h>
#include <poll.h>
#include <sys/socket.h>
/************************************************************************

View File

@ -31,24 +31,21 @@
#include "jlong.h"
#include "sun_nio_ch_NativeThread.h"
#include "nio_util.h"
#include <signal.h>
#ifdef __linux__
#include <pthread.h>
#include <sys/signal.h>
/* Also defined in net/linux_close.c */
#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
#elif _AIX
#include <pthread.h>
#include <sys/signal.h>
/* Also defined in net/aix_close.c */
#define INTERRUPT_SIGNAL (SIGRTMAX - 1)
#elif __solaris__
#include <thread.h>
#include <signal.h>
#define INTERRUPT_SIGNAL (SIGRTMAX - 2)
#elif _ALLBSD_SOURCE
#include <pthread.h>
#include <signal.h>
/* Also defined in net/bsd_close.c */
#define INTERRUPT_SIGNAL SIGIO
#else

View File

@ -23,7 +23,7 @@
* questions.
*/
#include <sys/poll.h>
#include <poll.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,3 +26,4 @@
exports sun.security.rsa to jdk.crypto.mscapi;
exports sun.security.internal.spec to jdk.crypto.mscapi;
exports sun.security.util to jdk.crypto.mscapi;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2017, 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
@ -559,9 +559,7 @@ GetJavaProperties(JNIEnv* env)
}
sprintf(buf, "%d.%d", majorVersion, minorVersion);
sprops.os_version = _strdup(buf);
#if _M_IA64
sprops.os_arch = "ia64";
#elif _M_AMD64
#if _M_AMD64
sprops.os_arch = "amd64";
#elif _X86_
sprops.os_arch = "x86";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017, 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
@ -332,7 +332,15 @@ AWT_ASSERT_APPKIT_THREAD;
#define DRAGMASK (NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDownMask | NSRightMouseDraggedMask | NSLeftMouseUpMask | NSRightMouseUpMask | NSFlagsChangedMask | NSKeyDownMask)
- (NSEvent *)nextEventMatchingMask:(NSUInteger)mask untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
#if defined(MAC_OS_X_VERSION_10_12) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12 && \
__LP64__
// 10.12 changed `mask` to NSEventMask (unsigned long long) for x86_64 builds.
- (NSEvent *)nextEventMatchingMask:(NSEventMask)mask
#else
- (NSEvent *)nextEventMatchingMask:(NSUInteger)mask
#endif
untilDate:(NSDate *)expiration inMode:(NSString *)mode dequeue:(BOOL)deqFlag {
if (mask == DRAGMASK && [((NSString *)kCFRunLoopDefaultMode) isEqual:mode]) {
postEventDuringEventSynthesis = YES;
}
@ -449,4 +457,3 @@ AWT_ASSERT_APPKIT_THREAD;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017, 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
@ -394,8 +394,6 @@ SplashEventLoop(Splash * splash) {
void *
SplashScreenThread(void *param) {
objc_registerThreadWithCollector();
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Splash *splash = (Splash *) param;

View File

@ -455,10 +455,15 @@ static const int extend_test[16] = /* entry n is 2**(n-1) */
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
{ 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
{ 0,
(int)(((unsigned)(~0)<<1) + 1), (int)(((unsigned)(~0)<<2) + 1),
(int)(((unsigned)(~0)<<3) + 1), (int)(((unsigned)(~0)<<4) + 1),
(int)(((unsigned)(~0)<<5) + 1), (int)(((unsigned)(~0)<<6) + 1),
(int)(((unsigned)(~0)<<7) + 1), (int)(((unsigned)(~0)<<8) + 1),
(int)(((unsigned)(~0)<<9) + 1), (int)(((unsigned)(~0)<<10) + 1),
(int)(((unsigned)(~0)<<11) + 1), (int)(((unsigned)(~0)<<12) + 1),
(int)(((unsigned)(~0)<<13) + 1), (int)(((unsigned)(~0)<<14) + 1),
(int)(((unsigned)(~0)<<15) + 1) };
#endif /* AVOID_TABLES */

View File

@ -215,10 +215,15 @@ static const int extend_test[16] = /* entry n is 2**(n-1) */
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
{ 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
{ 0,
(int)(((unsigned)(~0)<<1) + 1), (int)(((unsigned)(~0)<<2) + 1),
(int)(((unsigned)(~0)<<3) + 1), (int)(((unsigned)(~0)<<4) + 1),
(int)(((unsigned)(~0)<<5) + 1), (int)(((unsigned)(~0)<<6) + 1),
(int)(((unsigned)(~0)<<7) + 1), (int)(((unsigned)(~0)<<8) + 1),
(int)(((unsigned)(~0)<<9) + 1), (int)(((unsigned)(~0)<<10) + 1),
(int)(((unsigned)(~0)<<11) + 1), (int)(((unsigned)(~0)<<12) + 1),
(int)(((unsigned)(~0)<<13) + 1), (int)(((unsigned)(~0)<<14) + 1),
(int)(((unsigned)(~0)<<15) + 1) };
#endif /* AVOID_TABLES */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2017, 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
@ -483,15 +483,6 @@ Java_sun_awt_image_JPEGImageDecoder_initIDs(JNIEnv *env, jclass cls,
"available", "()I"));
}
/*
* The Windows Itanium Aug 2002 SDK generates bad code
* for this routine. Disable optimization for now.
*/
#ifdef _M_IA64
#pragma optimize ("", off)
#endif
JNIEXPORT void JNICALL
Java_sun_awt_image_JPEGImageDecoder_readImage(JNIEnv *env,
jobject this,
@ -745,10 +736,6 @@ Java_sun_awt_image_JPEGImageDecoder_readImage(JNIEnv *env,
RELEASE_ARRAYS(env, &jsrc);
return;
}
#ifdef _M_IA64
#pragma optimize ("", on)
#endif
/*
* SOME FINE POINTS:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2017, 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
@ -125,15 +125,13 @@ debugLoop_run(void)
jboolean replyToSender = JNI_TRUE;
/*
* For VirtualMachine commands we hold the vmDeathLock
* For all commands we hold the vmDeathLock
* while executing and replying to the command. This ensures
* that a VM command after VM_DEATH will be allowed to complete
* that a command after VM_DEATH will be allowed to complete
* before the thread posting the VM_DEATH continues VM
* termination.
*/
if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
debugMonitorEnter(vmDeathLock);
}
debugMonitorEnter(vmDeathLock);
/* Initialize the input and output streams */
inStream_init(&in, p);
@ -172,9 +170,7 @@ debugLoop_run(void)
/*
* Release the vmDeathLock as the reply has been posted.
*/
if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
debugMonitorExit(vmDeathLock);
}
debugMonitorExit(vmDeathLock);
inStream_destroy(&in);
outStream_destroy(&out);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2017, 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
@ -240,10 +240,10 @@ dequeueCommand(void)
size = commandSize(command);
/*
* Immediately close out any commands enqueued from a
* previously attached debugger.
* Immediately close out any commands enqueued from
* a dead VM or a previously attached debugger.
*/
if (command->sessionID != currentSessionID) {
if (gdata->vmDead || command->sessionID != currentSessionID) {
log_debugee_location("dequeueCommand(): command session removal", NULL, NULL, 0);
completeCommand(command);
command = NULL;

View File

@ -37,7 +37,7 @@
#include <thread.h>
#else
#include <pthread.h>
#include <sys/poll.h>
#include <poll.h>
#endif
#include "socket_md.h"

View File

@ -302,6 +302,14 @@ sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java 8057732 generic-
com/sun/tools/attach/StartManagementAgent.java 8179700 generic-all
sun/tools/jhsdb/AlternateHashingTest.java 8184042 macosx-all
sun/tools/jhsdb/BasicLauncherTest.java 8184042 macosx-all
sun/tools/jhsdb/HeapDumpTest.java 8184042 macosx-all
sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java 8184042 macosx-all
############################################################################
# jdk_other

View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
# @test
# @bug 4660158
# @author Staffan Larsen
# @requires os.family != "windows"
# @key intermittent
# @run shell JdbExprTest.sh

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ public class TestJcmdDefaults {
private static final String TEST_SRC = System.getProperty("test.src").trim();
private static final String[] VM_ARGS = new String[] { "-XX:+UsePerfData" };
private static final String JCMD_LIST_REGEX = "^\\d+\\s*.*";
private static final String JCMD_LIST_REGEX = "(?s)^\\d+\\s*.*";
public static void main(String[] args) throws Exception {
testJcmdUsage("-h");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2017, 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
@ -75,9 +75,9 @@ public class Settings extends TestHelper {
}
static void runTestOptionDefault() throws IOException {
String stackSize = "256"; // in kb
int stackSize = 256; // in kb
if (getArch().equals("ppc64") || getArch().equals("ppc64le")) {
stackSize = "800";
stackSize = 800;
}
TestResult tr;
tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
@ -88,7 +88,7 @@ public class Settings extends TestHelper {
throw new RuntimeException("test fails");
}
tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
"-Xss" + stackSize + "000", "-XshowSettings", "-jar", testJar.getAbsolutePath());
"-Xss" + (stackSize * 1024), "-XshowSettings", "-jar", testJar.getAbsolutePath());
containsAllOptions(tr);
if (!tr.isOK()) {
System.out.println(tr);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017, 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
@ -155,15 +155,21 @@ public class TooSmallStackSize extends TestHelper {
checkStack("16k");
/*
* Try with a 32k stack size, which is the size that the launcher will
* Try with a 64k stack size, which is the size that the launcher will
* set to if you try setting to anything smaller. This should produce the same
* result as setting to 16k if the fix for 6762191 is in place.
*/
String min_stack_allowed = checkStack("32k");
String min_stack_allowed = checkStack("64k");
/*
* Try again with a the minimum stack size that was given in the error message
*/
checkMinStackAllowed(min_stack_allowed);
/*
* Try again with a size that is not OS page aligned. This is to help test that
* asserts added for 8176768 are not triggered.
*/
checkMinStackAllowed("513k");
}
}