mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
Merge
This commit is contained in:
commit
cfaf92f28b
239 changed files with 4949 additions and 2023 deletions
|
@ -238,7 +238,7 @@ class BufferedInputStream extends FilterInputStream {
|
|||
nsz = marklimit;
|
||||
byte[] nbuf = new byte[nsz];
|
||||
System.arraycopy(buffer, 0, nbuf, 0, pos);
|
||||
if (!U.compareAndSetObject(this, BUF_OFFSET, buffer, nbuf)) {
|
||||
if (!U.compareAndSetReference(this, BUF_OFFSET, buffer, nbuf)) {
|
||||
// Can't replace buf if there was an async close.
|
||||
// Note: This would need to be changed if fill()
|
||||
// is ever made accessible to multiple threads.
|
||||
|
@ -482,7 +482,7 @@ class BufferedInputStream extends FilterInputStream {
|
|||
public void close() throws IOException {
|
||||
byte[] buffer;
|
||||
while ( (buffer = buf) != null) {
|
||||
if (U.compareAndSetObject(this, BUF_OFFSET, buffer, null)) {
|
||||
if (U.compareAndSetReference(this, BUF_OFFSET, buffer, null)) {
|
||||
InputStream input = in;
|
||||
in = null;
|
||||
if (input != null)
|
||||
|
|
|
@ -2237,7 +2237,7 @@ public class File
|
|||
if (sep != separatorChar)
|
||||
pathField = pathField.replace(sep, separatorChar);
|
||||
String path = fs.normalize(pathField);
|
||||
UNSAFE.putObject(this, PATH_OFFSET, path);
|
||||
UNSAFE.putReference(this, PATH_OFFSET, path);
|
||||
UNSAFE.putIntVolatile(this, PREFIX_LENGTH_OFFSET, fs.prefixLength(path));
|
||||
}
|
||||
|
||||
|
|
|
@ -2135,7 +2135,7 @@ public class ObjectStreamClass implements Serializable {
|
|||
switch (typeCodes[i]) {
|
||||
case 'L':
|
||||
case '[':
|
||||
vals[offsets[i]] = unsafe.getObject(obj, readKeys[i]);
|
||||
vals[offsets[i]] = unsafe.getReference(obj, readKeys[i]);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2190,7 +2190,7 @@ public class ObjectStreamClass implements Serializable {
|
|||
obj.getClass().getName());
|
||||
}
|
||||
if (!dryRun)
|
||||
unsafe.putObject(obj, key, val);
|
||||
unsafe.putReference(obj, key, val);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -405,7 +405,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||
|
||||
|
||||
/**
|
||||
* Returns the {@code Class} with the given <a href="ClassLoader.html#name">
|
||||
* Returns the {@code Class} with the given <a href="ClassLoader.html#binary-name">
|
||||
* binary name</a> in the given module.
|
||||
*
|
||||
* <p> This method attempts to locate, load, and link the class or interface.
|
||||
|
@ -427,7 +427,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||
* loads a class in another module.
|
||||
*
|
||||
* @param module A module
|
||||
* @param name The <a href="ClassLoader.html#name">binary name</a>
|
||||
* @param name The <a href="ClassLoader.html#binary-name">binary name</a>
|
||||
* of the class
|
||||
* @return {@code Class} object of the given name defined in the given module;
|
||||
* {@code null} if not found.
|
||||
|
@ -2904,19 +2904,19 @@ public final class Class<T> implements java.io.Serializable,
|
|||
static <T> boolean casReflectionData(Class<?> clazz,
|
||||
SoftReference<ReflectionData<T>> oldData,
|
||||
SoftReference<ReflectionData<T>> newData) {
|
||||
return unsafe.compareAndSetObject(clazz, reflectionDataOffset, oldData, newData);
|
||||
return unsafe.compareAndSetReference(clazz, reflectionDataOffset, oldData, newData);
|
||||
}
|
||||
|
||||
static <T> boolean casAnnotationType(Class<?> clazz,
|
||||
AnnotationType oldType,
|
||||
AnnotationType newType) {
|
||||
return unsafe.compareAndSetObject(clazz, annotationTypeOffset, oldType, newType);
|
||||
return unsafe.compareAndSetReference(clazz, annotationTypeOffset, oldType, newType);
|
||||
}
|
||||
|
||||
static <T> boolean casAnnotationData(Class<?> clazz,
|
||||
AnnotationData oldData,
|
||||
AnnotationData newData) {
|
||||
return unsafe.compareAndSetObject(clazz, annotationDataOffset, oldData, newData);
|
||||
return unsafe.compareAndSetReference(clazz, annotationDataOffset, oldData, newData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3002,7 +3002,7 @@ public abstract class ClassLoader {
|
|||
Class<?> k = ClassLoader.class;
|
||||
long offset;
|
||||
offset = unsafe.objectFieldOffset(k, name);
|
||||
return unsafe.compareAndSetObject(this, offset, null, obj);
|
||||
return unsafe.compareAndSetReference(this, offset, null, obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public final class StackWalker {
|
|||
*/
|
||||
public interface StackFrame {
|
||||
/**
|
||||
* Gets the <a href="ClassLoader.html#name">binary name</a>
|
||||
* Gets the <a href="ClassLoader.html#binary-name">binary name</a>
|
||||
* of the declaring class of the method represented by this stack frame.
|
||||
*
|
||||
* @return the binary name of the declaring class of the method
|
||||
|
|
|
@ -287,7 +287,7 @@ public class CallSite {
|
|||
}
|
||||
/*package-private*/
|
||||
MethodHandle getTargetVolatile() {
|
||||
return (MethodHandle) UNSAFE.getObjectVolatile(this, getTargetOffset());
|
||||
return (MethodHandle) UNSAFE.getReferenceVolatile(this, getTargetOffset());
|
||||
}
|
||||
/*package-private*/
|
||||
void setTargetVolatile(MethodHandle newTarget) {
|
||||
|
|
|
@ -940,7 +940,7 @@ abstract class ClassSpecializer<T,K,S extends ClassSpecializer<T,K,S>.SpeciesDat
|
|||
Object base = MethodHandleNatives.staticFieldBase(sdField);
|
||||
long offset = MethodHandleNatives.staticFieldOffset(sdField);
|
||||
UNSAFE.loadFence();
|
||||
return metaType.cast(UNSAFE.getObject(base, offset));
|
||||
return metaType.cast(UNSAFE.getReference(base, offset));
|
||||
} catch (Error err) {
|
||||
throw err;
|
||||
} catch (Exception ex) {
|
||||
|
@ -970,7 +970,7 @@ abstract class ClassSpecializer<T,K,S extends ClassSpecializer<T,K,S>.SpeciesDat
|
|||
Object base = MethodHandleNatives.staticFieldBase(sdField);
|
||||
long offset = MethodHandleNatives.staticFieldOffset(sdField);
|
||||
UNSAFE.storeFence();
|
||||
UNSAFE.putObject(base, offset, speciesData);
|
||||
UNSAFE.putReference(base, offset, speciesData);
|
||||
UNSAFE.storeFence();
|
||||
} catch (Error err) {
|
||||
throw err;
|
||||
|
|
|
@ -655,7 +655,7 @@ class DirectMethodHandle extends MethodHandle {
|
|||
case LONG: return GET_LONG_VOLATILE;
|
||||
case FLOAT: return GET_FLOAT_VOLATILE;
|
||||
case DOUBLE: return GET_DOUBLE_VOLATILE;
|
||||
case OBJECT: return GET_OBJECT_VOLATILE;
|
||||
case OBJECT: return GET_REFERENCE_VOLATILE;
|
||||
}
|
||||
} else {
|
||||
switch (wrapper) {
|
||||
|
@ -667,7 +667,7 @@ class DirectMethodHandle extends MethodHandle {
|
|||
case LONG: return GET_LONG;
|
||||
case FLOAT: return GET_FLOAT;
|
||||
case DOUBLE: return GET_DOUBLE;
|
||||
case OBJECT: return GET_OBJECT;
|
||||
case OBJECT: return GET_REFERENCE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -681,7 +681,7 @@ class DirectMethodHandle extends MethodHandle {
|
|||
case LONG: return PUT_LONG_VOLATILE;
|
||||
case FLOAT: return PUT_FLOAT_VOLATILE;
|
||||
case DOUBLE: return PUT_DOUBLE_VOLATILE;
|
||||
case OBJECT: return PUT_OBJECT_VOLATILE;
|
||||
case OBJECT: return PUT_REFERENCE_VOLATILE;
|
||||
}
|
||||
} else {
|
||||
switch (wrapper) {
|
||||
|
@ -693,7 +693,7 @@ class DirectMethodHandle extends MethodHandle {
|
|||
case LONG: return PUT_LONG;
|
||||
case FLOAT: return PUT_FLOAT;
|
||||
case DOUBLE: return PUT_DOUBLE;
|
||||
case OBJECT: return PUT_OBJECT;
|
||||
case OBJECT: return PUT_REFERENCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -653,7 +653,7 @@ class InvokerBytecodeGenerator {
|
|||
case LINK_TO_TARGET_METHOD: // fall-through
|
||||
case GENERIC_INVOKER: // fall-through
|
||||
case GENERIC_LINKER: return resolveFrom(name, invokerType.basicType(), Invokers.Holder.class);
|
||||
case GET_OBJECT: // fall-through
|
||||
case GET_REFERENCE: // fall-through
|
||||
case GET_BOOLEAN: // fall-through
|
||||
case GET_BYTE: // fall-through
|
||||
case GET_CHAR: // fall-through
|
||||
|
@ -662,7 +662,7 @@ class InvokerBytecodeGenerator {
|
|||
case GET_LONG: // fall-through
|
||||
case GET_FLOAT: // fall-through
|
||||
case GET_DOUBLE: // fall-through
|
||||
case PUT_OBJECT: // fall-through
|
||||
case PUT_REFERENCE: // fall-through
|
||||
case PUT_BOOLEAN: // fall-through
|
||||
case PUT_BYTE: // fall-through
|
||||
case PUT_CHAR: // fall-through
|
||||
|
|
|
@ -296,10 +296,10 @@ class LambdaForm {
|
|||
DIRECT_NEW_INVOKE_SPECIAL("DMH.newInvokeSpecial", "newInvokeSpecial"),
|
||||
DIRECT_INVOKE_INTERFACE("DMH.invokeInterface", "invokeInterface"),
|
||||
DIRECT_INVOKE_STATIC_INIT("DMH.invokeStaticInit", "invokeStaticInit"),
|
||||
GET_OBJECT("getObject"),
|
||||
PUT_OBJECT("putObject"),
|
||||
GET_OBJECT_VOLATILE("getObjectVolatile"),
|
||||
PUT_OBJECT_VOLATILE("putObjectVolatile"),
|
||||
GET_REFERENCE("getReference"),
|
||||
PUT_REFERENCE("putReference"),
|
||||
GET_REFERENCE_VOLATILE("getReferenceVolatile"),
|
||||
PUT_REFERENCE_VOLATILE("putReferenceVolatile"),
|
||||
GET_INT("getInt"),
|
||||
PUT_INT("putInt"),
|
||||
GET_INT_VOLATILE("getIntVolatile"),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -85,7 +85,8 @@ class LambdaFormEditor {
|
|||
PERMUTE_ARGS = 13,
|
||||
LOCAL_TYPES = 14,
|
||||
FOLD_SELECT_ARGS = 15,
|
||||
FOLD_SELECT_ARGS_TO_VOID = 16;
|
||||
FOLD_SELECT_ARGS_TO_VOID = 16,
|
||||
FILTER_SELECT_ARGS = 17;
|
||||
|
||||
private static final boolean STRESS_TEST = false; // turn on to disable most packing
|
||||
private static final int
|
||||
|
@ -730,21 +731,23 @@ class LambdaFormEditor {
|
|||
Name getCombiner = new Name(newData.getterFunction(oldData.fieldCount()), newBaseAddress);
|
||||
Object[] combinerArgs = new Object[1 + combinerArity];
|
||||
combinerArgs[0] = getCombiner;
|
||||
Name[] newParams;
|
||||
Name newParam = null;
|
||||
if (keepArguments) {
|
||||
newParams = new Name[0];
|
||||
for (int i = 0; i < combinerArity; i++) {
|
||||
combinerArgs[i + 1] = lambdaForm.parameter(1 + argPositions[i]);
|
||||
assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i]));
|
||||
}
|
||||
} else {
|
||||
newParams = new Name[combinerArity];
|
||||
for (int i = 0; i < newParams.length; i++) {
|
||||
newParams[i] = lambdaForm.parameter(1 + argPositions[i]);
|
||||
newParam = new Name(pos, BasicType.basicType(combinerType.returnType()));
|
||||
for (int i = 0; i < combinerArity; i++) {
|
||||
int argPos = 1 + argPositions[i];
|
||||
if (argPos == pos) {
|
||||
combinerArgs[i + 1] = newParam;
|
||||
} else {
|
||||
combinerArgs[i + 1] = lambdaForm.parameter(argPos);
|
||||
}
|
||||
assert (basicType(combinerType.parameterType(i)) == lambdaForm.parameterType(1 + argPositions[i]));
|
||||
}
|
||||
System.arraycopy(newParams, 0,
|
||||
combinerArgs, 1, combinerArity);
|
||||
}
|
||||
Name callCombiner = new Name(combinerType, combinerArgs);
|
||||
|
||||
|
@ -755,12 +758,13 @@ class LambdaFormEditor {
|
|||
|
||||
// insert new arguments, if needed
|
||||
int argPos = pos + resultArity; // skip result parameter
|
||||
for (Name newParam : newParams) {
|
||||
if (newParam != null) {
|
||||
buf.insertParameter(argPos++, newParam);
|
||||
exprPos++;
|
||||
}
|
||||
assert(buf.lastIndexOf(callCombiner) == exprPos+1+newParams.length);
|
||||
assert(buf.lastIndexOf(callCombiner) == exprPos+1);
|
||||
if (!dropResult) {
|
||||
buf.replaceParameterByCopy(pos, exprPos+1+newParams.length);
|
||||
buf.replaceParameterByCopy(pos, exprPos+1);
|
||||
}
|
||||
|
||||
return buf.endEdit();
|
||||
|
@ -845,6 +849,20 @@ class LambdaFormEditor {
|
|||
return putInCache(key, form);
|
||||
}
|
||||
|
||||
LambdaForm filterArgumentsForm(int filterPos, MethodType combinerType, int ... argPositions) {
|
||||
byte kind = Transform.FILTER_SELECT_ARGS;
|
||||
int[] keyArgs = Arrays.copyOf(argPositions, argPositions.length + 1);
|
||||
keyArgs[argPositions.length] = filterPos;
|
||||
Transform key = Transform.of(kind, keyArgs);
|
||||
LambdaForm form = getInCache(key);
|
||||
if (form != null) {
|
||||
assert(form.arity == lambdaForm.arity);
|
||||
return form;
|
||||
}
|
||||
form = makeArgumentCombinationForm(filterPos, combinerType, argPositions, false, false);
|
||||
return putInCache(key, form);
|
||||
}
|
||||
|
||||
LambdaForm permuteArgumentsForm(int skip, int[] reorder) {
|
||||
assert(skip == 1); // skip only the leading MH argument, names[0]
|
||||
int length = lambdaForm.names.length;
|
||||
|
|
|
@ -1663,7 +1663,7 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
|
|||
assert(newForm.customized == null || newForm.customized == this);
|
||||
if (form == newForm) return;
|
||||
newForm.prepare(); // as in MethodHandle.<init>
|
||||
UNSAFE.putObject(this, FORM_OFFSET, newForm);
|
||||
UNSAFE.putReference(this, FORM_OFFSET, newForm);
|
||||
UNSAFE.fullFence();
|
||||
}
|
||||
|
||||
|
|
|
@ -4316,28 +4316,6 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* As {@see foldArguments(MethodHandle, int, MethodHandle)}, but with the
|
||||
* added capability of selecting the arguments from the targets parameters
|
||||
* to call the combiner with. This allows us to avoid some simple cases of
|
||||
* permutations and padding the combiner with dropArguments to select the
|
||||
* right argument, which may ultimately produce fewer intermediaries.
|
||||
*/
|
||||
static MethodHandle foldArguments(MethodHandle target, int pos, MethodHandle combiner, int ... argPositions) {
|
||||
MethodType targetType = target.type();
|
||||
MethodType combinerType = combiner.type();
|
||||
Class<?> rtype = foldArgumentChecks(pos, targetType, combinerType, argPositions);
|
||||
BoundMethodHandle result = target.rebind();
|
||||
boolean dropResult = rtype == void.class;
|
||||
LambdaForm lform = result.editor().foldArgumentsForm(1 + pos, dropResult, combinerType.basicType(), argPositions);
|
||||
MethodType newType = targetType;
|
||||
if (!dropResult) {
|
||||
newType = newType.dropParameterTypes(pos, pos + 1);
|
||||
}
|
||||
result = result.copyWithExtendL(newType, lform, combiner);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType) {
|
||||
int foldArgs = combinerType.parameterCount();
|
||||
Class<?> rtype = combinerType.returnType();
|
||||
|
@ -4359,15 +4337,78 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
return rtype;
|
||||
}
|
||||
|
||||
private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType, int ... argPos) {
|
||||
int foldArgs = combinerType.parameterCount();
|
||||
if (argPos.length != foldArgs) {
|
||||
/**
|
||||
* Adapts a target method handle by pre-processing some of its arguments, then calling the target with the result
|
||||
* of the pre-processing replacing the argument at the given position.
|
||||
*
|
||||
* @param target the method handle to invoke after arguments are combined
|
||||
* @param position the position at which to start folding and at which to insert the folding result; if this is {@code
|
||||
* 0}, the effect is the same as for {@link #foldArguments(MethodHandle, MethodHandle)}.
|
||||
* @param combiner method handle to call initially on the incoming arguments
|
||||
* @param argPositions indexes of the target to pick arguments sent to the combiner from
|
||||
* @return method handle which incorporates the specified argument folding logic
|
||||
* @throws NullPointerException if either argument is null
|
||||
* @throws IllegalArgumentException if either of the following two conditions holds:
|
||||
* (1) {@code combiner}'s return type is not the same as the argument type at position
|
||||
* {@code pos} of the target signature;
|
||||
* (2) the {@code N} argument types at positions {@code argPositions[1...N]} of the target signature are
|
||||
* not identical with the argument types of {@code combiner}.
|
||||
*/
|
||||
/*non-public*/ static MethodHandle filterArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
|
||||
return argumentsWithCombiner(true, target, position, combiner, argPositions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapts a target method handle by pre-processing some of its arguments, calling the target with the result of
|
||||
* the pre-processing inserted into the original sequence of arguments at the given position.
|
||||
*
|
||||
* @param target the method handle to invoke after arguments are combined
|
||||
* @param position the position at which to start folding and at which to insert the folding result; if this is {@code
|
||||
* 0}, the effect is the same as for {@link #foldArguments(MethodHandle, MethodHandle)}.
|
||||
* @param combiner method handle to call initially on the incoming arguments
|
||||
* @param argPositions indexes of the target to pick arguments sent to the combiner from
|
||||
* @return method handle which incorporates the specified argument folding logic
|
||||
* @throws NullPointerException if either argument is null
|
||||
* @throws IllegalArgumentException if either of the following two conditions holds:
|
||||
* (1) {@code combiner}'s return type is non-{@code void} and not the same as the argument type at position
|
||||
* {@code pos} of the target signature;
|
||||
* (2) the {@code N} argument types at positions {@code argPositions[1...N]} of the target signature
|
||||
* (skipping {@code position} where the {@code combiner}'s return will be folded in) are not identical
|
||||
* with the argument types of {@code combiner}.
|
||||
*/
|
||||
/*non-public*/ static MethodHandle foldArgumentsWithCombiner(MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
|
||||
return argumentsWithCombiner(false, target, position, combiner, argPositions);
|
||||
}
|
||||
|
||||
private static MethodHandle argumentsWithCombiner(boolean filter, MethodHandle target, int position, MethodHandle combiner, int ... argPositions) {
|
||||
MethodType targetType = target.type();
|
||||
MethodType combinerType = combiner.type();
|
||||
Class<?> rtype = argumentsWithCombinerChecks(position, filter, targetType, combinerType, argPositions);
|
||||
BoundMethodHandle result = target.rebind();
|
||||
|
||||
MethodType newType = targetType;
|
||||
LambdaForm lform;
|
||||
if (filter) {
|
||||
lform = result.editor().filterArgumentsForm(1 + position, combinerType.basicType(), argPositions);
|
||||
} else {
|
||||
boolean dropResult = rtype == void.class;
|
||||
lform = result.editor().foldArgumentsForm(1 + position, dropResult, combinerType.basicType(), argPositions);
|
||||
if (!dropResult) {
|
||||
newType = newType.dropParameterTypes(position, position + 1);
|
||||
}
|
||||
}
|
||||
result = result.copyWithExtendL(newType, lform, combiner);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Class<?> argumentsWithCombinerChecks(int position, boolean filter, MethodType targetType, MethodType combinerType, int ... argPos) {
|
||||
int combinerArgs = combinerType.parameterCount();
|
||||
if (argPos.length != combinerArgs) {
|
||||
throw newIllegalArgumentException("combiner and argument map must be equal size", combinerType, argPos.length);
|
||||
}
|
||||
Class<?> rtype = combinerType.returnType();
|
||||
int foldVals = rtype == void.class ? 0 : 1;
|
||||
boolean ok = true;
|
||||
for (int i = 0; i < foldArgs; i++) {
|
||||
|
||||
for (int i = 0; i < combinerArgs; i++) {
|
||||
int arg = argPos[i];
|
||||
if (arg < 0 || arg > targetType.parameterCount()) {
|
||||
throw newIllegalArgumentException("arg outside of target parameterRange", targetType, arg);
|
||||
|
@ -4378,11 +4419,9 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||
+ " -> " + combinerType + ", map: " + Arrays.toString(argPos));
|
||||
}
|
||||
}
|
||||
if (ok && foldVals != 0 && combinerType.returnType() != targetType.parameterType(foldPos)) {
|
||||
ok = false;
|
||||
}
|
||||
if (!ok)
|
||||
if (filter && combinerType.returnType() != targetType.parameterType(position)) {
|
||||
throw misMatchedTypes("target and combiner types", targetType, combinerType);
|
||||
}
|
||||
return rtype;
|
||||
}
|
||||
|
||||
|
|
|
@ -1245,8 +1245,8 @@ s.writeObject(this.parameterArray());
|
|||
// store them into the implementation-specific final fields.
|
||||
checkRtype(rtype);
|
||||
checkPtypes(ptypes);
|
||||
UNSAFE.putObject(this, OffsetHolder.rtypeOffset, rtype);
|
||||
UNSAFE.putObject(this, OffsetHolder.ptypesOffset, ptypes);
|
||||
UNSAFE.putReference(this, OffsetHolder.rtypeOffset, rtype);
|
||||
UNSAFE.putReference(this, OffsetHolder.ptypesOffset, ptypes);
|
||||
}
|
||||
|
||||
// Support for resetting final fields while deserializing. Implement Holder
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1533,21 +1533,20 @@ public final class StringConcatFactory {
|
|||
// *ending* index.
|
||||
for (RecipeElement el : recipe.getElements()) {
|
||||
// Do the prepend, and put "new" index at index 1
|
||||
mh = MethodHandles.dropArguments(mh, 2, int.class);
|
||||
switch (el.getTag()) {
|
||||
case TAG_CONST: {
|
||||
MethodHandle prepender = MethodHandles.insertArguments(prepender(String.class), 3, el.getValue());
|
||||
mh = MethodHandles.foldArguments(mh, 1, prepender,
|
||||
2, 0, 3 // index, storage, coder
|
||||
mh = MethodHandles.filterArgumentsWithCombiner(mh, 1, prepender,
|
||||
1, 0, 2 // index, storage, coder
|
||||
);
|
||||
break;
|
||||
}
|
||||
case TAG_ARG: {
|
||||
int pos = el.getArgPos();
|
||||
MethodHandle prepender = prepender(ptypes[pos]);
|
||||
mh = MethodHandles.foldArguments(mh, 1, prepender,
|
||||
2, 0, 3, // index, storage, coder
|
||||
4 + pos // selected argument
|
||||
mh = MethodHandles.filterArgumentsWithCombiner(mh, 1, prepender,
|
||||
1, 0, 2, // index, storage, coder
|
||||
3 + pos // selected argument
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
@ -1557,7 +1556,7 @@ public final class StringConcatFactory {
|
|||
}
|
||||
|
||||
// Fold in byte[] instantiation at argument 0
|
||||
mh = MethodHandles.foldArguments(mh, 0, NEW_ARRAY,
|
||||
mh = MethodHandles.foldArgumentsWithCombiner(mh, 0, NEW_ARRAY,
|
||||
1, 2 // index, coder
|
||||
);
|
||||
|
||||
|
@ -1572,7 +1571,7 @@ public final class StringConcatFactory {
|
|||
// and deduce the coder from there. Arguments would be either converted to Strings
|
||||
// during the initial filtering, or handled by primitive specializations in CODER_MIXERS.
|
||||
//
|
||||
// The method handle shape after all length and coder mixers is:
|
||||
// The method handle shape before and after all length and coder mixers is:
|
||||
// (int, byte, <args>)String = ("index", "coder", <args>)
|
||||
byte initialCoder = INITIAL_CODER;
|
||||
int initialLen = 0; // initial length, in characters
|
||||
|
@ -1589,44 +1588,27 @@ public final class StringConcatFactory {
|
|||
Class<?> argClass = ptypes[ac];
|
||||
MethodHandle lm = lengthMixer(argClass);
|
||||
|
||||
// Read these bottom up:
|
||||
|
||||
if (argClass.isPrimitive() && argClass != char.class) {
|
||||
|
||||
// 3. Drop old index, producing ("new-index", "coder", <args>)
|
||||
mh = MethodHandles.dropArguments(mh, 1, int.class);
|
||||
|
||||
// 2. Compute "new-index", producing ("new-index", "old-index", "coder", <args>)
|
||||
// Length mixer needs old index, plus the appropriate argument
|
||||
mh = MethodHandles.foldArguments(mh, 0, lm,
|
||||
1, // old-index
|
||||
3 + ac // selected argument
|
||||
// Compute new "index" in-place using old value plus the appropriate argument.
|
||||
mh = MethodHandles.filterArgumentsWithCombiner(mh, 0, lm,
|
||||
0, // old-index
|
||||
2 + ac // selected argument
|
||||
);
|
||||
|
||||
// 1. The mh shape here is ("old-index", "coder", <args>); we don't need to recalculate
|
||||
// the coder for non-char primitive arguments
|
||||
|
||||
} else {
|
||||
MethodHandle cm = coderMixer(argClass);
|
||||
|
||||
// 4. Drop old index and coder, producing ("new-index", "new-coder", <args>)
|
||||
mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class);
|
||||
|
||||
// 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", <args>)
|
||||
// Length mixer needs old index, plus the appropriate argument
|
||||
mh = MethodHandles.foldArguments(mh, 0, lm,
|
||||
2, // old-index
|
||||
4 + ac // selected argument
|
||||
// Compute new "index" in-place using old value plus the appropriate argument.
|
||||
mh = MethodHandles.filterArgumentsWithCombiner(mh, 0, lm,
|
||||
0, // old-index
|
||||
2 + ac // selected argument
|
||||
);
|
||||
|
||||
// 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", <args>)
|
||||
// Coder mixer needs old coder, plus the appropriate argument.
|
||||
mh = MethodHandles.foldArguments(mh, 0, cm,
|
||||
2, // old-coder
|
||||
3 + ac // selected argument
|
||||
// Compute new "coder" in-place using old value plus the appropriate argument.
|
||||
mh = MethodHandles.filterArgumentsWithCombiner(mh, 1, cm,
|
||||
1, // old-coder
|
||||
2 + ac // selected argument
|
||||
);
|
||||
|
||||
// 1. The mh shape here is ("old-index", "old-coder", <args>)
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -1999,7 +1999,7 @@ public abstract class VarHandle {
|
|||
/*non-public*/
|
||||
final void updateVarForm(VarForm newVForm) {
|
||||
if (vform == newVForm) return;
|
||||
UNSAFE.putObject(this, VFORM_OFFSET, newVForm);
|
||||
UNSAFE.putReference(this, VFORM_OFFSET, newVForm);
|
||||
UNSAFE.fullFence();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ final class VarHandles {
|
|||
long foffset = MethodHandleNatives.objectFieldOffset(f);
|
||||
if (!type.isPrimitive()) {
|
||||
return f.isFinal() && !isWriteAllowedOnFinalFields
|
||||
? new VarHandleObjects.FieldInstanceReadOnly(refc, foffset, type)
|
||||
: new VarHandleObjects.FieldInstanceReadWrite(refc, foffset, type);
|
||||
? new VarHandleReferences.FieldInstanceReadOnly(refc, foffset, type)
|
||||
: new VarHandleReferences.FieldInstanceReadWrite(refc, foffset, type);
|
||||
}
|
||||
else if (type == boolean.class) {
|
||||
return f.isFinal() && !isWriteAllowedOnFinalFields
|
||||
|
@ -95,8 +95,8 @@ final class VarHandles {
|
|||
long foffset = MethodHandleNatives.staticFieldOffset(f);
|
||||
if (!type.isPrimitive()) {
|
||||
return f.isFinal() && !isWriteAllowedOnFinalFields
|
||||
? new VarHandleObjects.FieldStaticReadOnly(base, foffset, type)
|
||||
: new VarHandleObjects.FieldStaticReadWrite(base, foffset, type);
|
||||
? new VarHandleReferences.FieldStaticReadOnly(base, foffset, type)
|
||||
: new VarHandleReferences.FieldStaticReadWrite(base, foffset, type);
|
||||
}
|
||||
else if (type == boolean.class) {
|
||||
return f.isFinal() && !isWriteAllowedOnFinalFields
|
||||
|
@ -155,7 +155,7 @@ final class VarHandles {
|
|||
int ashift = 31 - Integer.numberOfLeadingZeros(ascale);
|
||||
|
||||
if (!componentType.isPrimitive()) {
|
||||
return new VarHandleObjects.Array(aoffset, ashift, arrayClass);
|
||||
return new VarHandleReferences.Array(aoffset, ashift, arrayClass);
|
||||
}
|
||||
else if (componentType == boolean.class) {
|
||||
return new VarHandleBooleans.Array(aoffset, ashift);
|
||||
|
|
|
@ -186,10 +186,17 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
#if[Object]
|
||||
return UNSAFE.compareAndSetReference(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
#else[Object]
|
||||
return UNSAFE.compareAndSet$RawType$(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
#end[Object]
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
@ -261,11 +268,19 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static $type$ getAndSet(ArrayHandle handle, Object oba, int index, $type$ value) {
|
||||
byte[] ba = (byte[]) oba;
|
||||
#if[Object]
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSetReference(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
convEndian(handle.be, value)));
|
||||
#else[Object]
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$(
|
||||
ba,
|
||||
address(ba, index(ba, index)),
|
||||
convEndian(handle.be, value)));
|
||||
#end[Object]
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
@ -537,13 +552,13 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
#if[floatingPoint]
|
||||
$rawType$ rawValue = UNSAFE.get$RawType$Unaligned(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
|
||||
handle.be);
|
||||
return $Type$.$rawType$BitsTo$Type$(rawValue);
|
||||
#else[floatingPoint]
|
||||
return UNSAFE.get$Type$Unaligned(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
((long) index(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
|
||||
handle.be);
|
||||
#end[floatingPoint]
|
||||
|
@ -554,13 +569,13 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
#if[floatingPoint]
|
||||
UNSAFE.put$RawType$Unaligned(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
|
||||
$Type$.$type$ToRaw$RawType$Bits(value),
|
||||
handle.be);
|
||||
#else[floatingPoint]
|
||||
UNSAFE.put$Type$Unaligned(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
((long) indexRO(bb, index)) + UNSAFE.getLong(bb, BUFFER_ADDRESS),
|
||||
value,
|
||||
handle.be);
|
||||
|
@ -572,7 +587,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.get$RawType$Volatile(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, index(bb, index))));
|
||||
}
|
||||
|
||||
|
@ -580,7 +595,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
static void setVolatile(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
UNSAFE.put$RawType$Volatile(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value));
|
||||
}
|
||||
|
@ -590,7 +605,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.get$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, index(bb, index))));
|
||||
}
|
||||
|
||||
|
@ -598,7 +613,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
static void setRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
UNSAFE.put$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value));
|
||||
}
|
||||
|
@ -608,7 +623,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.get$RawType$Opaque(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, index(bb, index))));
|
||||
}
|
||||
|
||||
|
@ -616,7 +631,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
static void setOpaque(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
UNSAFE.put$RawType$Opaque(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value));
|
||||
}
|
||||
|
@ -625,10 +640,17 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return UNSAFE.compareAndSet$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
#if[Object]
|
||||
return UNSAFE.compareAndSetReference(
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
#else[Object]
|
||||
return UNSAFE.compareAndSet$RawType$(
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
#end[Object]
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
@ -636,7 +658,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.compareAndExchange$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value)));
|
||||
}
|
||||
|
@ -646,7 +668,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.compareAndExchange$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value)));
|
||||
}
|
||||
|
@ -656,7 +678,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.compareAndExchange$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value)));
|
||||
}
|
||||
|
@ -665,7 +687,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return UNSAFE.weakCompareAndSet$RawType$Plain(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
}
|
||||
|
@ -674,7 +696,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return UNSAFE.weakCompareAndSet$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
}
|
||||
|
@ -683,7 +705,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return UNSAFE.weakCompareAndSet$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
}
|
||||
|
@ -692,7 +714,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return UNSAFE.weakCompareAndSet$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, expected), convEndian(handle.be, value));
|
||||
}
|
||||
|
@ -700,11 +722,19 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static $type$ getAndSet(ByteBufferHandle handle, Object obb, int index, $type$ value) {
|
||||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
#if[Object]
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getAndSetReference(
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value)));
|
||||
#else[Object]
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$(
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value)));
|
||||
#end[Object]
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
@ -712,7 +742,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
|
@ -722,7 +752,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
return convEndian(handle.be,
|
||||
UNSAFE.getAndSet$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
convEndian(handle.be, value)));
|
||||
}
|
||||
|
@ -734,7 +764,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndAdd$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
delta);
|
||||
} else {
|
||||
|
@ -747,7 +777,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndAdd$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
delta);
|
||||
} else {
|
||||
|
@ -760,7 +790,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndAdd$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
delta);
|
||||
} else {
|
||||
|
@ -771,7 +801,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
|
||||
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
|
||||
long offset = address(bb, indexRO(bb, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
|
||||
|
@ -788,7 +818,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -801,7 +831,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -814,7 +844,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseOr$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -825,7 +855,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static $type$ getAndBitwiseOrConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
|
||||
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
|
||||
long offset = address(bb, indexRO(bb, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
|
||||
|
@ -840,7 +870,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -853,7 +883,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -866,7 +896,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseAnd$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -877,7 +907,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static $type$ getAndBitwiseAndConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
|
||||
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
|
||||
long offset = address(bb, indexRO(bb, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
|
||||
|
@ -893,7 +923,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -906,7 +936,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$Release(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -919,7 +949,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
ByteBuffer bb = (ByteBuffer) Objects.requireNonNull(obb);
|
||||
if (handle.be == BE) {
|
||||
return UNSAFE.getAndBitwiseXor$RawType$Acquire(
|
||||
UNSAFE.getObject(bb, BYTE_BUFFER_HB),
|
||||
UNSAFE.getReference(bb, BYTE_BUFFER_HB),
|
||||
address(bb, indexRO(bb, index)),
|
||||
value);
|
||||
} else {
|
||||
|
@ -930,7 +960,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
@ForceInline
|
||||
static $type$ getAndBitwiseXorConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) {
|
||||
$type$ nativeExpectedValue, expectedValue;
|
||||
Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB);
|
||||
Object base = UNSAFE.getReference(bb, BYTE_BUFFER_HB);
|
||||
long offset = address(bb, indexRO(bb, index));
|
||||
do {
|
||||
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
|
||||
|
|
|
@ -4079,7 +4079,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
|
|||
}
|
||||
|
||||
static void setIntValVolatile(BigDecimal bd, BigInteger val) {
|
||||
unsafe.putObjectVolatile(bd, intValOffset, val);
|
||||
unsafe.putReferenceVolatile(bd, intValOffset, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4600,7 +4600,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
|
|||
}
|
||||
|
||||
static void putMag(BigInteger bi, int[] magnitude) {
|
||||
unsafe.putObject(bi, magOffset, magnitude);
|
||||
unsafe.putReference(bi, magOffset, magnitude);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -641,7 +641,7 @@ class Inet6Address extends InetAddress {
|
|||
ipaddress, scope_id, scope_id_set, scope_ifname, scope_ifname_set
|
||||
);
|
||||
|
||||
UNSAFE.putObject(this, FIELDS_OFFSET, h);
|
||||
UNSAFE.putReference(this, FIELDS_OFFSET, h);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1734,7 +1734,7 @@ class InetAddress implements java.io.Serializable {
|
|||
throw new InvalidObjectException("invalid address family type: " + family);
|
||||
}
|
||||
InetAddressHolder h = new InetAddressHolder(host, address, family);
|
||||
UNSAFE.putObject(this, FIELDS_OFFSET, h);
|
||||
UNSAFE.putReference(this, FIELDS_OFFSET, h);
|
||||
}
|
||||
|
||||
/* needed because the serializable fields no longer exist */
|
||||
|
|
|
@ -293,7 +293,7 @@ public class InetSocketAddress
|
|||
InetSocketAddressHolder h = new InetSocketAddressHolder(oisHostname,
|
||||
oisAddr,
|
||||
oisPort);
|
||||
UNSAFE.putObject(this, FIELDS_OFFSET, h);
|
||||
UNSAFE.putReference(this, FIELDS_OFFSET, h);
|
||||
}
|
||||
|
||||
private void readObjectNoData()
|
||||
|
|
|
@ -232,11 +232,8 @@ class SocketInputStream extends FileInputStream {
|
|||
* @return the number of immediately available bytes
|
||||
*/
|
||||
public int available() throws IOException {
|
||||
if (eof) {
|
||||
return 0;
|
||||
} else {
|
||||
return impl.available();
|
||||
}
|
||||
int available = impl.available();
|
||||
return eof ? 0 : available;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1222,6 +1222,6 @@ class Random implements java.io.Serializable {
|
|||
} catch (Exception ex) { throw new Error(ex); }
|
||||
}
|
||||
private void resetSeed(long seedVal) {
|
||||
unsafe.putObjectVolatile(this, seedOffset, new AtomicLong(seedVal));
|
||||
unsafe.putReferenceVolatile(this, seedOffset, new AtomicLong(seedVal));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -757,16 +757,16 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
static final <K,V> Node<K,V> tabAt(Node<K,V>[] tab, int i) {
|
||||
return (Node<K,V>)U.getObjectAcquire(tab, ((long)i << ASHIFT) + ABASE);
|
||||
return (Node<K,V>)U.getReferenceAcquire(tab, ((long)i << ASHIFT) + ABASE);
|
||||
}
|
||||
|
||||
static final <K,V> boolean casTabAt(Node<K,V>[] tab, int i,
|
||||
Node<K,V> c, Node<K,V> v) {
|
||||
return U.compareAndSetObject(tab, ((long)i << ASHIFT) + ABASE, c, v);
|
||||
return U.compareAndSetReference(tab, ((long)i << ASHIFT) + ABASE, c, v);
|
||||
}
|
||||
|
||||
static final <K,V> void setTabAt(Node<K,V>[] tab, int i, Node<K,V> v) {
|
||||
U.putObjectRelease(tab, ((long)i << ASHIFT) + ABASE, v);
|
||||
U.putReferenceRelease(tab, ((long)i << ASHIFT) + ABASE, v);
|
||||
}
|
||||
|
||||
/* ---------------- Fields -------------- */
|
||||
|
|
|
@ -976,13 +976,13 @@ public class ThreadLocalRandom extends Random {
|
|||
* Erases ThreadLocals by nulling out Thread maps.
|
||||
*/
|
||||
static final void eraseThreadLocals(Thread thread) {
|
||||
U.putObject(thread, THREADLOCALS, null);
|
||||
U.putObject(thread, INHERITABLETHREADLOCALS, null);
|
||||
U.putReference(thread, THREADLOCALS, null);
|
||||
U.putReference(thread, INHERITABLETHREADLOCALS, null);
|
||||
}
|
||||
|
||||
static final void setInheritedAccessControlContext(Thread thread,
|
||||
AccessControlContext acc) {
|
||||
U.putObjectRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc);
|
||||
U.putReferenceRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc);
|
||||
}
|
||||
|
||||
// Serialization support
|
||||
|
|
|
@ -439,39 +439,39 @@ public abstract class AtomicReferenceFieldUpdater<T,V> {
|
|||
public final boolean compareAndSet(T obj, V expect, V update) {
|
||||
accessCheck(obj);
|
||||
valueCheck(update);
|
||||
return U.compareAndSetObject(obj, offset, expect, update);
|
||||
return U.compareAndSetReference(obj, offset, expect, update);
|
||||
}
|
||||
|
||||
public final boolean weakCompareAndSet(T obj, V expect, V update) {
|
||||
// same implementation as strong form for now
|
||||
accessCheck(obj);
|
||||
valueCheck(update);
|
||||
return U.compareAndSetObject(obj, offset, expect, update);
|
||||
return U.compareAndSetReference(obj, offset, expect, update);
|
||||
}
|
||||
|
||||
public final void set(T obj, V newValue) {
|
||||
accessCheck(obj);
|
||||
valueCheck(newValue);
|
||||
U.putObjectVolatile(obj, offset, newValue);
|
||||
U.putReferenceVolatile(obj, offset, newValue);
|
||||
}
|
||||
|
||||
public final void lazySet(T obj, V newValue) {
|
||||
accessCheck(obj);
|
||||
valueCheck(newValue);
|
||||
U.putObjectRelease(obj, offset, newValue);
|
||||
U.putReferenceRelease(obj, offset, newValue);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final V get(T obj) {
|
||||
accessCheck(obj);
|
||||
return (V)U.getObjectVolatile(obj, offset);
|
||||
return (V)U.getReferenceVolatile(obj, offset);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final V getAndSet(T obj, V newValue) {
|
||||
accessCheck(obj);
|
||||
valueCheck(newValue);
|
||||
return (V)U.getAndSetObject(obj, offset, newValue);
|
||||
return (V)U.getAndSetReference(obj, offset, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class LockSupport {
|
|||
|
||||
private static void setBlocker(Thread t, Object arg) {
|
||||
// Even though volatile, hotspot doesn't need a write barrier here.
|
||||
U.putObject(t, PARKBLOCKER, arg);
|
||||
U.putReference(t, PARKBLOCKER, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,7 +291,7 @@ public class LockSupport {
|
|||
public static Object getBlocker(Thread t) {
|
||||
if (t == null)
|
||||
throw new NullPointerException();
|
||||
return U.getObjectVolatile(t, PARKBLOCKER);
|
||||
return U.getReferenceVolatile(t, PARKBLOCKER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
package java.util.zip;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.security.AccessController;
|
||||
|
@ -40,7 +39,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import static java.util.zip.ZipConstants.ENDHDR;
|
||||
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
|
||||
class ZipUtils {
|
||||
|
||||
|
@ -295,7 +293,7 @@ class ZipUtils {
|
|||
private static final long byteBufferOffsetOffset = unsafe.objectFieldOffset(ByteBuffer.class, "offset");
|
||||
|
||||
static byte[] getBufferArray(ByteBuffer byteBuffer) {
|
||||
return (byte[]) unsafe.getObject(byteBuffer, byteBufferArrayOffset);
|
||||
return (byte[]) unsafe.getReference(byteBuffer, byteBufferArrayOffset);
|
||||
}
|
||||
|
||||
static int getBufferOffset(ByteBuffer byteBuffer) {
|
||||
|
|
|
@ -98,8 +98,8 @@ public final class InnocuousThread extends Thread {
|
|||
|
||||
private InnocuousThread(ThreadGroup group, Runnable target, String name, ClassLoader tccl) {
|
||||
super(group, target, name, 0L, false);
|
||||
UNSAFE.putObjectRelease(this, INHERITEDACCESSCONTROLCONTEXT, ACC);
|
||||
UNSAFE.putObjectRelease(this, CONTEXTCLASSLOADER, tccl);
|
||||
UNSAFE.putReferenceRelease(this, INHERITEDACCESSCONTROLCONTEXT, ACC);
|
||||
UNSAFE.putReferenceRelease(this, CONTEXTCLASSLOADER, tccl);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,8 +120,8 @@ public final class InnocuousThread extends Thread {
|
|||
* Drops all thread locals (and inherited thread locals).
|
||||
*/
|
||||
public final void eraseThreadLocals() {
|
||||
UNSAFE.putObject(this, THREAD_LOCALS, null);
|
||||
UNSAFE.putObject(this, INHERITABLE_THREAD_LOCALS, null);
|
||||
UNSAFE.putReference(this, THREAD_LOCALS, null);
|
||||
UNSAFE.putReference(this, INHERITABLE_THREAD_LOCALS, null);
|
||||
}
|
||||
|
||||
// ensure run method is run only once
|
||||
|
@ -158,10 +158,10 @@ public final class InnocuousThread extends Thread {
|
|||
long tg = UNSAFE.objectFieldOffset(tk, "group");
|
||||
long gp = UNSAFE.objectFieldOffset(gk, "parent");
|
||||
ThreadGroup group = (ThreadGroup)
|
||||
UNSAFE.getObject(Thread.currentThread(), tg);
|
||||
UNSAFE.getReference(Thread.currentThread(), tg);
|
||||
|
||||
while (group != null) {
|
||||
ThreadGroup parent = (ThreadGroup)UNSAFE.getObject(group, gp);
|
||||
ThreadGroup parent = (ThreadGroup)UNSAFE.getReference(group, gp);
|
||||
if (parent == null)
|
||||
break;
|
||||
group = parent;
|
||||
|
|
|
@ -179,7 +179,7 @@ public final class Unsafe {
|
|||
* @see #getInt(Object, long)
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
public native Object getObject(Object o, long offset);
|
||||
public native Object getReference(Object o, long offset);
|
||||
|
||||
/**
|
||||
* Stores a reference value into a given Java variable.
|
||||
|
@ -192,7 +192,7 @@ public final class Unsafe {
|
|||
* @see #putInt(Object, long, int)
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
public native void putObject(Object o, long offset, Object x);
|
||||
public native void putReference(Object o, long offset, Object x);
|
||||
|
||||
/** @see #getInt(Object, long) */
|
||||
@HotSpotIntrinsicCandidate
|
||||
|
@ -1297,55 +1297,55 @@ public final class Unsafe {
|
|||
* @return {@code true} if successful
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final native boolean compareAndSetObject(Object o, long offset,
|
||||
public final native boolean compareAndSetReference(Object o, long offset,
|
||||
Object expected,
|
||||
Object x);
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final native Object compareAndExchangeReference(Object o, long offset,
|
||||
Object expected,
|
||||
Object x);
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final Object compareAndExchangeReferenceAcquire(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndExchangeReference(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final Object compareAndExchangeReferenceRelease(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndExchangeReference(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetReferencePlain(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndSetReference(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetReferenceAcquire(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndSetReference(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetReferenceRelease(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndSetReference(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetReference(Object o, long offset,
|
||||
Object expected,
|
||||
Object x);
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final native Object compareAndExchangeObject(Object o, long offset,
|
||||
Object expected,
|
||||
Object x);
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final Object compareAndExchangeObjectAcquire(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndExchangeObject(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final Object compareAndExchangeObjectRelease(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndExchangeObject(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetObjectPlain(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndSetObject(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetObjectAcquire(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndSetObject(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetObjectRelease(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndSetObject(o, offset, expected, x);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final boolean weakCompareAndSetObject(Object o, long offset,
|
||||
Object expected,
|
||||
Object x) {
|
||||
return compareAndSetObject(o, offset, expected, x);
|
||||
Object x) {
|
||||
return compareAndSetReference(o, offset, expected, x);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1958,17 +1958,17 @@ public final class Unsafe {
|
|||
|
||||
/**
|
||||
* Fetches a reference value from a given Java variable, with volatile
|
||||
* load semantics. Otherwise identical to {@link #getObject(Object, long)}
|
||||
* load semantics. Otherwise identical to {@link #getReference(Object, long)}
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
public native Object getObjectVolatile(Object o, long offset);
|
||||
public native Object getReferenceVolatile(Object o, long offset);
|
||||
|
||||
/**
|
||||
* Stores a reference value into a given Java variable, with
|
||||
* volatile store semantics. Otherwise identical to {@link #putObject(Object, long, Object)}
|
||||
* volatile store semantics. Otherwise identical to {@link #putReference(Object, long, Object)}
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
public native void putObjectVolatile(Object o, long offset, Object x);
|
||||
public native void putReferenceVolatile(Object o, long offset, Object x);
|
||||
|
||||
/** Volatile version of {@link #getInt(Object, long)} */
|
||||
@HotSpotIntrinsicCandidate
|
||||
|
@ -2036,10 +2036,10 @@ public final class Unsafe {
|
|||
|
||||
|
||||
|
||||
/** Acquire version of {@link #getObjectVolatile(Object, long)} */
|
||||
/** Acquire version of {@link #getReferenceVolatile(Object, long)} */
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final Object getObjectAcquire(Object o, long offset) {
|
||||
return getObjectVolatile(o, offset);
|
||||
public final Object getReferenceAcquire(Object o, long offset) {
|
||||
return getReferenceVolatile(o, offset);
|
||||
}
|
||||
|
||||
/** Acquire version of {@link #getBooleanVolatile(Object, long)} */
|
||||
|
@ -2091,7 +2091,7 @@ public final class Unsafe {
|
|||
}
|
||||
|
||||
/*
|
||||
* Versions of {@link #putObjectVolatile(Object, long, Object)}
|
||||
* Versions of {@link #putReferenceVolatile(Object, long, Object)}
|
||||
* that do not guarantee immediate visibility of the store to
|
||||
* other threads. This method is generally only useful if the
|
||||
* underlying field is a Java volatile (or if an array cell, one
|
||||
|
@ -2100,10 +2100,10 @@ public final class Unsafe {
|
|||
* Corresponds to C11 atomic_store_explicit(..., memory_order_release).
|
||||
*/
|
||||
|
||||
/** Release version of {@link #putObjectVolatile(Object, long, Object)} */
|
||||
/** Release version of {@link #putReferenceVolatile(Object, long, Object)} */
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final void putObjectRelease(Object o, long offset, Object x) {
|
||||
putObjectVolatile(o, offset, x);
|
||||
public final void putReferenceRelease(Object o, long offset, Object x) {
|
||||
putReferenceVolatile(o, offset, x);
|
||||
}
|
||||
|
||||
/** Release version of {@link #putBooleanVolatile(Object, long, boolean)} */
|
||||
|
@ -2156,10 +2156,10 @@ public final class Unsafe {
|
|||
|
||||
// ------------------------------ Opaque --------------------------------------
|
||||
|
||||
/** Opaque version of {@link #getObjectVolatile(Object, long)} */
|
||||
/** Opaque version of {@link #getReferenceVolatile(Object, long)} */
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final Object getObjectOpaque(Object o, long offset) {
|
||||
return getObjectVolatile(o, offset);
|
||||
public final Object getReferenceOpaque(Object o, long offset) {
|
||||
return getReferenceVolatile(o, offset);
|
||||
}
|
||||
|
||||
/** Opaque version of {@link #getBooleanVolatile(Object, long)} */
|
||||
|
@ -2210,10 +2210,10 @@ public final class Unsafe {
|
|||
return getDoubleVolatile(o, offset);
|
||||
}
|
||||
|
||||
/** Opaque version of {@link #putObjectVolatile(Object, long, Object)} */
|
||||
/** Opaque version of {@link #putReferenceVolatile(Object, long, Object)} */
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final void putObjectOpaque(Object o, long offset, Object x) {
|
||||
putObjectVolatile(o, offset, x);
|
||||
public final void putReferenceOpaque(Object o, long offset, Object x) {
|
||||
putReferenceVolatile(o, offset, x);
|
||||
}
|
||||
|
||||
/** Opaque version of {@link #putBooleanVolatile(Object, long, boolean)} */
|
||||
|
@ -2642,29 +2642,29 @@ public final class Unsafe {
|
|||
* @since 1.8
|
||||
*/
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final Object getAndSetObject(Object o, long offset, Object newValue) {
|
||||
public final Object getAndSetReference(Object o, long offset, Object newValue) {
|
||||
Object v;
|
||||
do {
|
||||
v = getObjectVolatile(o, offset);
|
||||
} while (!weakCompareAndSetObject(o, offset, v, newValue));
|
||||
v = getReferenceVolatile(o, offset);
|
||||
} while (!weakCompareAndSetReference(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final Object getAndSetObjectRelease(Object o, long offset, Object newValue) {
|
||||
public final Object getAndSetReferenceRelease(Object o, long offset, Object newValue) {
|
||||
Object v;
|
||||
do {
|
||||
v = getObject(o, offset);
|
||||
} while (!weakCompareAndSetObjectRelease(o, offset, v, newValue));
|
||||
v = getReference(o, offset);
|
||||
} while (!weakCompareAndSetReferenceRelease(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
public final Object getAndSetObjectAcquire(Object o, long offset, Object newValue) {
|
||||
public final Object getAndSetReferenceAcquire(Object o, long offset, Object newValue) {
|
||||
Object v;
|
||||
do {
|
||||
v = getObjectAcquire(o, offset);
|
||||
} while (!weakCompareAndSetObjectAcquire(o, offset, v, newValue));
|
||||
v = getReferenceAcquire(o, offset);
|
||||
} while (!weakCompareAndSetReferenceAcquire(o, offset, v, newValue));
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl {
|
|||
|
||||
public Object get(Object obj) throws IllegalArgumentException {
|
||||
ensureObj(obj);
|
||||
return unsafe.getObject(obj, fieldOffset);
|
||||
return unsafe.getReference(obj, fieldOffset);
|
||||
}
|
||||
|
||||
public boolean getBoolean(Object obj) throws IllegalArgumentException {
|
||||
|
@ -81,7 +81,7 @@ class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl {
|
|||
throwSetIllegalArgumentException(value);
|
||||
}
|
||||
}
|
||||
unsafe.putObject(obj, fieldOffset, value);
|
||||
unsafe.putReference(obj, fieldOffset, value);
|
||||
}
|
||||
|
||||
public void setBoolean(Object obj, boolean z)
|
||||
|
|
|
@ -36,7 +36,7 @@ class UnsafeQualifiedObjectFieldAccessorImpl
|
|||
|
||||
public Object get(Object obj) throws IllegalArgumentException {
|
||||
ensureObj(obj);
|
||||
return unsafe.getObjectVolatile(obj, fieldOffset);
|
||||
return unsafe.getReferenceVolatile(obj, fieldOffset);
|
||||
}
|
||||
|
||||
public boolean getBoolean(Object obj) throws IllegalArgumentException {
|
||||
|
@ -83,7 +83,7 @@ class UnsafeQualifiedObjectFieldAccessorImpl
|
|||
throwSetIllegalArgumentException(value);
|
||||
}
|
||||
}
|
||||
unsafe.putObjectVolatile(obj, fieldOffset, value);
|
||||
unsafe.putReferenceVolatile(obj, fieldOffset, value);
|
||||
}
|
||||
|
||||
public void setBoolean(Object obj, boolean z)
|
||||
|
|
|
@ -35,7 +35,7 @@ class UnsafeQualifiedStaticObjectFieldAccessorImpl
|
|||
}
|
||||
|
||||
public Object get(Object obj) throws IllegalArgumentException {
|
||||
return unsafe.getObjectVolatile(base, fieldOffset);
|
||||
return unsafe.getReferenceVolatile(base, fieldOffset);
|
||||
}
|
||||
|
||||
public boolean getBoolean(Object obj) throws IllegalArgumentException {
|
||||
|
@ -81,7 +81,7 @@ class UnsafeQualifiedStaticObjectFieldAccessorImpl
|
|||
throwSetIllegalArgumentException(value);
|
||||
}
|
||||
}
|
||||
unsafe.putObjectVolatile(base, fieldOffset, value);
|
||||
unsafe.putReferenceVolatile(base, fieldOffset, value);
|
||||
}
|
||||
|
||||
public void setBoolean(Object obj, boolean z)
|
||||
|
|
|
@ -33,7 +33,7 @@ class UnsafeStaticObjectFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl
|
|||
}
|
||||
|
||||
public Object get(Object obj) throws IllegalArgumentException {
|
||||
return unsafe.getObject(base, fieldOffset);
|
||||
return unsafe.getReference(base, fieldOffset);
|
||||
}
|
||||
|
||||
public boolean getBoolean(Object obj) throws IllegalArgumentException {
|
||||
|
@ -79,7 +79,7 @@ class UnsafeStaticObjectFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl
|
|||
throwSetIllegalArgumentException(value);
|
||||
}
|
||||
}
|
||||
unsafe.putObject(base, fieldOffset, value);
|
||||
unsafe.putReference(base, fieldOffset, value);
|
||||
}
|
||||
|
||||
public void setBoolean(Object obj, boolean z)
|
||||
|
|
|
@ -624,12 +624,12 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
|||
|
||||
static void setType(AnnotationInvocationHandler o,
|
||||
Class<? extends Annotation> type) {
|
||||
unsafe.putObject(o, typeOffset, type);
|
||||
unsafe.putReference(o, typeOffset, type);
|
||||
}
|
||||
|
||||
static void setMemberValues(AnnotationInvocationHandler o,
|
||||
Map<String, Object> memberValues) {
|
||||
unsafe.putObject(o, memberValuesOffset, memberValues);
|
||||
unsafe.putReference(o, memberValuesOffset, memberValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -356,12 +356,12 @@ enum SignatureScheme {
|
|||
} else if (SSLLogger.isOn &&
|
||||
SSLLogger.isOn("ssl,handshake,verbose")) {
|
||||
SSLLogger.finest(
|
||||
"Ignore disabled signature sheme: " + ss.name);
|
||||
"Ignore disabled signature scheme: " + ss.name);
|
||||
}
|
||||
} else if (SSLLogger.isOn &&
|
||||
SSLLogger.isOn("ssl,handshake,verbose")) {
|
||||
SSLLogger.finest(
|
||||
"Ignore inactive signature sheme: " + ss.name);
|
||||
"Ignore inactive signature scheme: " + ss.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue