本文整理汇总了Java中com.sun.max.vm.reference.Reference类的典型用法代码示例。如果您正苦于以下问题:Java Reference类的具体用法?Java Reference怎么用?Java Reference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Reference类属于com.sun.max.vm.reference包,在下文中一共展示了Reference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyMemory
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Sets all bytes in a given block of memory to a copy of another
* block.
*
* <p>This method determines each block's base address by means of two parameters,
* and so it provides (in effect) a <em>double-register</em> addressing mode,
* as discussed in {@link #getInt(Object,long)}. When the object reference is null,
* the offset supplies an absolute base address.
*
* <p>The transfers are in coherent (atomic) units of a size determined
* by the address and length parameters. If the effective addresses and
* length are all even modulo 8, the transfer takes place in 'long' units.
* If the effective addresses and length are (resp.) even modulo 4 or 2,
* the transfer takes place in units of 'int' or 'short'.
*
* @since 1.7
*/
@SUBSTITUTE(optional = true)
public void copyMemory(Object srcBase, long srcOffset,
Object destBase, long destOffset,
long bytes) {
Pointer src;
if (srcBase == null) {
src = Pointer.fromLong(srcOffset);
} else {
src = Reference.fromJava(srcBase).toOrigin().plus(srcOffset);
}
Pointer dest;
if (destBase == null) {
dest = Pointer.fromLong(destOffset);
} else {
dest = Reference.fromJava(destBase).toOrigin().plus(destOffset);
}
Memory.copyBytes(src, dest, Size.fromLong(bytes));
}
示例2: enqueue
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Note: Must be kept in sync with the original JDK source.
*/
@SUBSTITUTE
boolean enqueue(java.lang.ref.Reference r) {
synchronized (r) {
JLRRAlias rAlias = asJLRRAlias(r);
if (rAlias.queue == ENQUEUED) {
return false;
}
synchronized (lock) {
rAlias.queue = ENQUEUED;
rAlias.next = (head == null) ? r : head;
head = r;
queueLength++;
if (ClassRegistry.JLR_FINAL_REFERENCE.isInstance(r)) {
sun.misc.VM.addFinalRefCount(1);
}
lock.notifyAll();
if (SpecialReferenceManager.specialReferenceLogger.enabled()) {
SpecialReferenceManager.specialReferenceLogger.logEnqueue(ObjectAccess.readClassActor(r), Reference.fromJava(r).toOrigin(), Reference.fromJava(this).toOrigin());
}
return true;
}
}
}
示例3: getInt
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Reads an int field from the specified offset of the specified object.
* @see sun.misc.Unsafe#getInt(Object, long)
* @param object the object
* @param offset the offset from the beginning of the object
* @return the value at the specified offset
*/
@SUBSTITUTE
public int getInt(Object object, long offset) {
if (object == null) {
return Pointer.fromLong(offset).readInt(0);
}
return Reference.fromJava(object).readInt(Offset.fromLong(offset));
}
示例4: putInt
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Writes an int into the object at the specified offset.
* @see sun.misc.Unsafe#putInt(Object, long, int)
* @param object the object
* @param offset the offset from the beginning of the object
* @param value the value to write at the specified offset
*/
@SUBSTITUTE
public void putInt(Object object, long offset, int value) {
if (object == null) {
Pointer.fromLong(offset).writeInt(0, value);
}
Reference.fromJava(object).writeInt(Offset.fromLong(offset), value);
}
示例5: putObject
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Writes an object reference into the object at the specified offset.
* @see sun.misc.Unsafe#putObject(Object, long, Object)
* @param object the object
* @param offset the offset from the beginning of the object
* @param value the value to write at the specified offset
*/
@SUBSTITUTE
public void putObject(Object object, long offset, Object value) {
if (object == null) {
Pointer.fromLong(offset).writeReference(0, Reference.fromJava(value));
}
Reference.fromJava(object).writeReference(Offset.fromLong(offset), Reference.fromJava(value));
}
示例6: getBoolean
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Reads a boolean field from the specified offset of the specified object.
* @see sun.misc.Unsafe#getBoolean(Object, long)
* @param object the object
* @param offset the offset from the beginning of the object
* @return the value at the specified offset
*/
@SUBSTITUTE
public boolean getBoolean(Object object, long offset) {
if (object == null) {
return Pointer.fromLong(offset).readBoolean(0);
}
return Reference.fromJava(object).readBoolean(Offset.fromLong(offset));
}
示例7: putBoolean
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Writes a boolean into the object at the specified offset.
* @see sun.misc.Unsafe#putBoolean(Object, long, boolean)
* @param object the object
* @param offset the offset from the beginning of the object
* @param value the value to write at the specified offset
*/
@SUBSTITUTE
public void putBoolean(Object object, long offset, boolean value) {
if (object == null) {
Pointer.fromLong(offset).writeBoolean(0, value);
}
Reference.fromJava(object).writeBoolean(Offset.fromLong(offset), value);
}
示例8: getByte
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Reads a byte field from the specified offset of the specified object.
* @see sun.misc.Unsafe#getByte(Object, long)
* @param object the object
* @param offset the offset from the beginning of the object
* @return the value at the specified offset
*/
@SUBSTITUTE
public byte getByte(Object object, long offset) {
if (object == null) {
return Pointer.fromLong(offset).readByte(0);
}
return Reference.fromJava(object).readByte(Offset.fromLong(offset));
}
示例9: putByte
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Writes a byte into the object at the specified offset.
* @see sun.misc.Unsafe#putByte(Object, long, byte)
* @param object the object
* @param offset the offset from the beginning of the object
* @param value the value to write at the specified offset
*/
@SUBSTITUTE
public void putByte(Object object, long offset, byte value) {
if (object == null) {
Pointer.fromLong(offset).writeByte(0, value);
}
Reference.fromJava(object).writeByte(Offset.fromLong(offset), value);
}
示例10: compareAndSwapReference
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
@INLINE
public Reference compareAndSwapReference(Reference ref, Offset offset, Reference expectedValue, Reference newValue) {
heapScheme().preWriteBarrier(ref, offset, newValue);
final Reference result = toOrigin(ref).compareAndSwapReference(offset, expectedValue, newValue);
heapScheme().postWriteBarrier(ref, offset, newValue);
return result;
}
示例11: putShort
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Writes a short into the object at the specified offset.
* @see sun.misc.Unsafe#putShort(Object, long, short)
* @param object the object
* @param offset the offset from the beginning of the object
* @param value the value to write at the specified offset
*/
@SUBSTITUTE
public void putShort(Object object, long offset, short value) {
if (object == null) {
Pointer.fromLong(offset).writeShort(0, value);
}
Reference.fromJava(object).writeShort(Offset.fromLong(offset), value);
}
示例12: getChar
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Reads a char field from the specified offset of the specified object.
* @see sun.misc.Unsafe#getChar(Object, long)
* @param object the object
* @param offset the offset from the beginning of the object
* @return the value at the specified offset
*/
@SUBSTITUTE
public char getChar(Object object, long offset) {
if (object == null) {
return Pointer.fromLong(offset).readChar(0);
}
return Reference.fromJava(object).readChar(Offset.fromLong(offset));
}
示例13: putChar
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Writes a char into the object at the specified offset.
* @see sun.misc.Unsafe#putChar(Object, long, char)
* @param object the object
* @param offset the offset from the beginning of the object
* @param value the value to write at the specified offset
*/
@SUBSTITUTE
public void putChar(Object object, long offset, char value) {
if (object == null) {
Pointer.fromLong(offset).writeChar(0, value);
}
Reference.fromJava(object).writeChar(Offset.fromLong(offset), value);
}
示例14: getLong
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Reads a long field from the specified offset of the specified object.
* @see sun.misc.Unsafe#getLong(Object, long)
* @param object the object
* @param offset the offset from the beginning of the object
* @return the value at the specified offset
*/
@SUBSTITUTE
public long getLong(Object object, long offset) {
if (object == null) {
return Pointer.fromLong(offset).readLong(0);
}
return Reference.fromJava(object).readLong(Offset.fromLong(offset));
}
示例15: putLong
import com.sun.max.vm.reference.Reference; //导入依赖的package包/类
/**
* Writes a long into the object at the specified offset.
* @see sun.misc.Unsafe#putLong(Object, long, long)
* @param object the object
* @param offset the offset from the beginning of the object
* @param value the value to write at the specified offset
*/
@SUBSTITUTE
public void putLong(Object object, long offset, long value) {
if (object == null) {
Pointer.fromLong(offset).writeLong(0, value);
}
Reference.fromJava(object).writeLong(Offset.fromLong(offset), value);
}