newFns,
Object... forArguments) {
assert(inTrans());
- if (oldFns.length == 0) return this;
+ if (oldFns.isEmpty()) return this;
for (int i = arity; i < length; i++) {
Name n = names[i];
- int nfi = indexOf(n.function, oldFns);
+ int nfi = oldFns.indexOf(n.function);
if (nfi >= 0 && Arrays.equals(n.arguments, forArguments)) {
- changeName(i, new Name(newFns[nfi], n.arguments));
+ changeName(i, new Name(newFns.get(nfi), n.arguments));
}
}
return this;
diff --git a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
index 868e82fe67a..4ebcd51dcd6 100644
--- a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
+++ b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
@@ -381,10 +381,11 @@ class LambdaFormEditor {
/// Editing methods for method handles. These need to have fast paths.
private BoundMethodHandle.SpeciesData oldSpeciesData() {
- return BoundMethodHandle.speciesData(lambdaForm);
+ return BoundMethodHandle.speciesDataFor(lambdaForm);
}
+
private BoundMethodHandle.SpeciesData newSpeciesData(BasicType type) {
- return oldSpeciesData().extendWith(type);
+ return oldSpeciesData().extendWith((byte) type.ordinal());
}
BoundMethodHandle bindArgumentL(BoundMethodHandle mh, int pos, Object value) {
@@ -461,7 +462,7 @@ class LambdaFormEditor {
buf.replaceParameterByNewExpression(pos, new Name(getter, newBaseAddress));
} else {
// cannot bind the MH arg itself, unless oldData is empty
- assert(oldData == BoundMethodHandle.SpeciesData.EMPTY);
+ assert(oldData == BoundMethodHandle.SPECIALIZER.topSpecies());
newBaseAddress = new Name(L_TYPE).withConstraint(newData);
buf.replaceParameterByNewExpression(0, new Name(getter, newBaseAddress));
buf.insertParameter(0, newBaseAddress);
diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index bf3b30443a6..ee76e84d5ed 100644
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -776,11 +776,11 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
if (PROFILE_GWT) {
int[] counts = new int[2];
mh = (BoundMethodHandle)
- BoundMethodHandle.speciesData_LLLL().constructor().invokeBasic(type, form,
+ BoundMethodHandle.speciesData_LLLL().factory().invokeBasic(type, form,
(Object) test, (Object) profile(target), (Object) profile(fallback), counts);
} else {
mh = (BoundMethodHandle)
- BoundMethodHandle.speciesData_LLL().constructor().invokeBasic(type, form,
+ BoundMethodHandle.speciesData_LLL().factory().invokeBasic(type, form,
(Object) test, (Object) profile(target), (Object) profile(fallback));
}
} catch (Throwable ex) {
@@ -1089,7 +1089,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLLL();
BoundMethodHandle mh;
try {
- mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) target, (Object) exType,
+ mh = (BoundMethodHandle) data.factory().invokeBasic(type, form, (Object) target, (Object) exType,
(Object) catcher, (Object) collectArgs, (Object) unboxResult);
} catch (Throwable ex) {
throw uncaughtException(ex);
@@ -1784,6 +1784,11 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
MemberName memberName = (MemberName)mname;
return memberName.getName();
}
+ @Override
+ public Class> getDeclaringClass(Object mname) {
+ MemberName memberName = (MemberName)mname;
+ return memberName.getDeclaringClass();
+ }
@Override
public MethodType getMethodType(Object mname) {
@@ -1885,7 +1890,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLL();
BoundMethodHandle mh;
try {
- mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) clauseData,
+ mh = (BoundMethodHandle) data.factory().invokeBasic(type, form, (Object) clauseData,
(Object) collectArgs, (Object) unboxResult);
} catch (Throwable ex) {
throw uncaughtException(ex);
@@ -2128,7 +2133,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
BoundMethodHandle.SpeciesData data = BoundMethodHandle.speciesData_LLLL();
BoundMethodHandle mh;
try {
- mh = (BoundMethodHandle) data.constructor().invokeBasic(type, form, (Object) target, (Object) cleanup,
+ mh = (BoundMethodHandle) data.factory().invokeBasic(type, form, (Object) target, (Object) cleanup,
(Object) collectArgs, (Object) unboxResult);
} catch (Throwable ex) {
throw uncaughtException(ex);
diff --git a/src/java.base/share/classes/java/lang/invoke/SimpleMethodHandle.java b/src/java.base/share/classes/java/lang/invoke/SimpleMethodHandle.java
index c9e37a81ff4..99a8020aee6 100644
--- a/src/java.base/share/classes/java/lang/invoke/SimpleMethodHandle.java
+++ b/src/java.base/share/classes/java/lang/invoke/SimpleMethodHandle.java
@@ -25,6 +25,8 @@
package java.lang.invoke;
+import jdk.internal.vm.annotation.Stable;
+
import static java.lang.invoke.LambdaForm.BasicType.*;
import static java.lang.invoke.MethodHandleStatics.*;
@@ -33,6 +35,7 @@ import static java.lang.invoke.MethodHandleStatics.*;
* @author jrose
*/
final class SimpleMethodHandle extends BoundMethodHandle {
+
private SimpleMethodHandle(MethodType type, LambdaForm form) {
super(type, form);
}
@@ -41,10 +44,11 @@ final class SimpleMethodHandle extends BoundMethodHandle {
return new SimpleMethodHandle(type, form);
}
- /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.EMPTY;
+ /*non-public*/ static @Stable BoundMethodHandle.SpeciesData BMH_SPECIES;
- /*non-public*/ public SpeciesData speciesData() {
- return SPECIES_DATA;
+ @Override
+ /*non-public*/ BoundMethodHandle.SpeciesData speciesData() {
+ return BMH_SPECIES;
}
@Override
@@ -57,11 +61,6 @@ final class SimpleMethodHandle extends BoundMethodHandle {
return "\n& Class="+getClass().getSimpleName();
}
- @Override
- /*non-public*/ public int fieldCount() {
- return 0;
- }
-
@Override
/*non-public*/ final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
return BoundMethodHandle.bindSingle(mt, lf, narg); // Use known fast path.
@@ -69,7 +68,7 @@ final class SimpleMethodHandle extends BoundMethodHandle {
@Override
/*non-public*/ final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
try {
- return (BoundMethodHandle) SPECIES_DATA.extendWith(I_TYPE).constructor().invokeBasic(mt, lf, narg);
+ return (BoundMethodHandle) BMH_SPECIES.extendWith(I_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
} catch (Throwable ex) {
throw uncaughtException(ex);
}
@@ -77,7 +76,7 @@ final class SimpleMethodHandle extends BoundMethodHandle {
@Override
/*non-public*/ final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
try {
- return (BoundMethodHandle) SPECIES_DATA.extendWith(J_TYPE).constructor().invokeBasic(mt, lf, narg);
+ return (BoundMethodHandle) BMH_SPECIES.extendWith(J_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
} catch (Throwable ex) {
throw uncaughtException(ex);
}
@@ -85,7 +84,7 @@ final class SimpleMethodHandle extends BoundMethodHandle {
@Override
/*non-public*/ final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
try {
- return (BoundMethodHandle) SPECIES_DATA.extendWith(F_TYPE).constructor().invokeBasic(mt, lf, narg);
+ return (BoundMethodHandle) BMH_SPECIES.extendWith(F_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
} catch (Throwable ex) {
throw uncaughtException(ex);
}
@@ -93,7 +92,7 @@ final class SimpleMethodHandle extends BoundMethodHandle {
@Override
/*non-public*/ final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
try {
- return (BoundMethodHandle) SPECIES_DATA.extendWith(D_TYPE).constructor().invokeBasic(mt, lf, narg);
+ return (BoundMethodHandle) BMH_SPECIES.extendWith(D_TYPE_NUM).factory().invokeBasic(mt, lf, narg);
} catch (Throwable ex) {
throw uncaughtException(ex);
}
diff --git a/src/java.base/share/classes/java/net/InetAddress.java b/src/java.base/share/classes/java/net/InetAddress.java
index 692c1e829f5..84a0c578f5f 100644
--- a/src/java.base/share/classes/java/net/InetAddress.java
+++ b/src/java.base/share/classes/java/net/InetAddress.java
@@ -1133,7 +1133,7 @@ class InetAddress implements java.io.Serializable {
/**
* Create an instance of the NameService interface based on
- * the setting of the {@codejdk.net.hosts.file} system property.
+ * the setting of the {@code jdk.net.hosts.file} system property.
*
* The default NameService is the PlatformNameService, which typically
* delegates name and address resolution calls to the underlying
diff --git a/src/java.base/share/classes/java/util/stream/AbstractTask.java b/src/java.base/share/classes/java/util/stream/AbstractTask.java
index f6bd8f5fc00..44c2656157b 100644
--- a/src/java.base/share/classes/java/util/stream/AbstractTask.java
+++ b/src/java.base/share/classes/java/util/stream/AbstractTask.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -27,6 +27,7 @@ package java.util.stream;
import java.util.Spliterator;
import java.util.concurrent.CountedCompleter;
import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinWorkerThread;
/**
* Abstract base class for most fork-join tasks used to implement stream ops.
@@ -88,13 +89,7 @@ abstract class AbstractTask>
extends CountedCompleter {
- /**
- * Default target factor of leaf tasks for parallel decomposition.
- * To allow load balancing, we over-partition, currently to approximately
- * four tasks per processor, which enables others to help out
- * if leaf tasks are uneven or some processors are otherwise busy.
- */
- static final int LEAF_TARGET = ForkJoinPool.getCommonPoolParallelism() << 2;
+ private static final int LEAF_TARGET = ForkJoinPool.getCommonPoolParallelism() << 2;
/** The pipeline helper, common to all tasks in a computation */
protected final PipelineHelper helper;
@@ -156,6 +151,22 @@ abstract class AbstractTask 0L ? est : 1L;
}
diff --git a/src/java.base/share/classes/java/util/stream/ForEachOps.java b/src/java.base/share/classes/java/util/stream/ForEachOps.java
index df2cb1e4508..69714ca3f85 100644
--- a/src/java.base/share/classes/java/util/stream/ForEachOps.java
+++ b/src/java.base/share/classes/java/util/stream/ForEachOps.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -28,7 +28,6 @@ import java.util.Objects;
import java.util.Spliterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountedCompleter;
-import java.util.concurrent.ForkJoinTask;
import java.util.function.Consumer;
import java.util.function.DoubleConsumer;
import java.util.function.IntConsumer;
@@ -378,7 +377,7 @@ final class ForEachOps {
this.spliterator = spliterator;
this.targetSize = AbstractTask.suggestTargetSize(spliterator.estimateSize());
// Size map to avoid concurrent re-sizes
- this.completionMap = new ConcurrentHashMap<>(Math.max(16, AbstractTask.LEAF_TARGET << 1));
+ this.completionMap = new ConcurrentHashMap<>(Math.max(16, AbstractTask.getLeafTarget() << 1));
this.action = action;
this.leftPredecessor = null;
}
diff --git a/src/java.base/share/classes/java/util/stream/StreamSpliterators.java b/src/java.base/share/classes/java/util/stream/StreamSpliterators.java
index 4606ce30306..7c44076f5af 100644
--- a/src/java.base/share/classes/java/util/stream/StreamSpliterators.java
+++ b/src/java.base/share/classes/java/util/stream/StreamSpliterators.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -897,7 +897,7 @@ class StreamSpliterators {
* Note: The source spliterator may report {@code ORDERED} since that
* spliterator be the result of a previous pipeline stage that was
* collected to a {@code Node}. It is the order of the pipeline stage
- * that governs whether the this slice spliterator is to be used or not.
+ * that governs whether this slice spliterator is to be used or not.
*/
abstract static class UnorderedSliceSpliterator> {
static final int CHUNK_SIZE = 1 << 7;
@@ -914,7 +914,7 @@ class StreamSpliterators {
this.unlimited = limit < 0;
this.skipThreshold = limit >= 0 ? limit : 0;
this.chunkSize = limit >= 0 ? (int)Math.min(CHUNK_SIZE,
- ((skip + limit) / AbstractTask.LEAF_TARGET) + 1) : CHUNK_SIZE;
+ ((skip + limit) / AbstractTask.getLeafTarget()) + 1) : CHUNK_SIZE;
this.permits = new AtomicLong(limit >= 0 ? skip + limit : skip);
}
diff --git a/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java b/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java
index 0d283644868..75751839bd7 100644
--- a/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java
@@ -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
@@ -30,33 +30,39 @@ import java.util.Map;
public interface JavaLangInvokeAccess {
/**
- * Create a new MemberName instance. Used by {@see StackFrameInfo}.
+ * Create a new MemberName instance. Used by {@code StackFrameInfo}.
*/
Object newMemberName();
/**
- * Returns the name for the given MemberName. Used by {@see StackFrameInfo}.
+ * Returns the name for the given MemberName. Used by {@code StackFrameInfo}.
*/
String getName(Object mname);
/**
* Returns the {@code MethodType} for the given MemberName.
- * Used by {@see StackFrameInfo}.
+ * Used by {@code StackFrameInfo}.
*/
MethodType getMethodType(Object mname);
/**
* Returns the descriptor for the given MemberName.
- * Used by {@see StackFrameInfo}.
+ * Used by {@code StackFrameInfo}.
*/
String getMethodDescriptor(Object mname);
/**
- * Returns {@code true} if the given MemberName is a native method. Used by
- * {@see StackFrameInfo}.
+ * Returns {@code true} if the given MemberName is a native method.
+ * Used by {@code StackFrameInfo}.
*/
boolean isNative(Object mname);
+ /**
+ * Returns the declaring class for the given MemberName.
+ * Used by {@code StackFrameInfo}.
+ */
+ Class> getDeclaringClass(Object mname);
+
/**
* Returns a {@code byte[]} representation of a class implementing
* DirectMethodHandle of each pairwise combination of {@code MethodType} and
diff --git a/src/java.base/share/native/include/classfile_constants.h b/src/java.base/share/native/include/classfile_constants.h
index 94b97f75f2e..e6490a74cda 100644
--- a/src/java.base/share/native/include/classfile_constants.h
+++ b/src/java.base/share/native/include/classfile_constants.h
@@ -54,9 +54,29 @@ enum {
JVM_ACC_STRICT = 0x0800,
JVM_ACC_SYNTHETIC = 0x1000,
JVM_ACC_ANNOTATION = 0x2000,
- JVM_ACC_ENUM = 0x4000
+ JVM_ACC_ENUM = 0x4000,
+ JVM_ACC_MODULE = 0x8000
};
+#define JVM_ACC_PUBLIC_BIT 0
+#define JVM_ACC_PRIVATE_BIT 1
+#define JVM_ACC_PROTECTED_BIT 2
+#define JVM_ACC_STATIC_BIT 3
+#define JVM_ACC_FINAL_BIT 4
+#define JVM_ACC_SYNCHRONIZED_BIT 5
+#define JVM_ACC_SUPER_BIT 5
+#define JVM_ACC_VOLATILE_BIT 6
+#define JVM_ACC_BRIDGE_BIT 6
+#define JVM_ACC_TRANSIENT_BIT 7
+#define JVM_ACC_VARARGS_BIT 7
+#define JVM_ACC_NATIVE_BIT 8
+#define JVM_ACC_INTERFACE_BIT 9
+#define JVM_ACC_ABSTRACT_BIT 10
+#define JVM_ACC_STRICT_BIT 11
+#define JVM_ACC_SYNTHETIC_BIT 12
+#define JVM_ACC_ANNOTATION_BIT 13
+#define JVM_ACC_ENUM_BIT 14
+
/* Used in newarray instruction. */
enum {
@@ -86,8 +106,9 @@ enum {
JVM_CONSTANT_InterfaceMethodref = 11,
JVM_CONSTANT_NameAndType = 12,
JVM_CONSTANT_MethodHandle = 15, // JSR 292
- JVM_CONSTANT_MethodType = 16, // JSR 292
- JVM_CONSTANT_InvokeDynamic = 18
+ JVM_CONSTANT_MethodType = 16, // JSR 292
+ JVM_CONSTANT_InvokeDynamic = 18,
+ JVM_CONSTANT_ExternalMax = 18
};
/* JVM_CONSTANT_MethodHandle subtypes */
diff --git a/src/java.base/share/native/include/jvm.h b/src/java.base/share/native/include/jvm.h
index de90fd99dae..109d1d1dbdf 100644
--- a/src/java.base/share/native/include/jvm.h
+++ b/src/java.base/share/native/include/jvm.h
@@ -1155,20 +1155,25 @@ JVM_NativePath(char *);
* be renamed to JVM_* in the future?
*/
-/*
- * BE CAREFUL! The following functions do not implement the
- * full feature set of standard C printf formats.
- */
-int
+/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3),
+ * respectively, with the following differences:
+ * - The string written to str is always zero-terminated, also in case of
+ * truncation (count is too small to hold the result string), unless count
+ * is 0. In case of truncation count-1 characters are written and '\0'
+ * appendend.
+ * - If count is too small to hold the whole string, -1 is returned across
+ * all platforms. */
+
+JNIEXPORT int
jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
-int
+JNIEXPORT int
jio_snprintf(char *str, size_t count, const char *fmt, ...);
-int
+JNIEXPORT int
jio_fprintf(FILE *, const char *fmt, ...);
-int
+JNIEXPORT int
jio_vfprintf(FILE *, const char *fmt, va_list args);
diff --git a/src/java.base/solaris/native/libjsig/jsig.c b/src/java.base/solaris/native/libjsig/jsig.c
index 3c509159a2d..2e98f0363ee 100644
--- a/src/java.base/solaris/native/libjsig/jsig.c
+++ b/src/java.base/solaris/native/libjsig/jsig.c
@@ -37,7 +37,7 @@
#include
#include