本文整理了Java中sun.misc.Unsafe.arrayIndexScale()
方法的一些代码示例,展示了Unsafe.arrayIndexScale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unsafe.arrayIndexScale()
方法的具体详情如下:
包路径:sun.misc.Unsafe
类名称:Unsafe
方法名:arrayIndexScale
[英]Gets the size of each element of the given array class.
[中]获取给定数组类的每个元素的大小。
代码示例来源:origin: fengjiachun/Jupiter
/**
* Reports the scale factor for addressing elements in the storage
* allocation of a given array class.
*/
public static int arrayIndexScale(Class<?> clazz) {
return unsafe != null ? unsafe.arrayIndexScale(clazz) : -1;
}
代码示例来源:origin: neo4j/neo4j
public static int arrayIndexScale( Class klass )
{
int scale = unsafe.arrayIndexScale( klass );
if ( scale == 0 )
{
throw new AssertionError( "Array type too narrow for unsafe access: " + klass );
}
return scale;
}
代码示例来源:origin: fengjiachun/Jupiter
/**
* Reports the scale factor for addressing elements in the storage
* allocation of a given array class.
*/
public static int arrayIndexScale(Class<?> clazz) {
return unsafe != null ? unsafe.arrayIndexScale(clazz) : -1;
}
代码示例来源:origin: com.google.protobuf/protobuf-java
public final int arrayIndexScale(Class<?> clazz) {
return unsafe.arrayIndexScale(clazz);
}
代码示例来源:origin: apache/geode
public int arrayScaleIndex(Class c) {
return this.unsafe.arrayIndexScale(c);
}
代码示例来源:origin: prestodb/presto
U.arrayIndexScale(Object[].class),
U.arrayIndexScale(boolean[].class),
U.arrayIndexScale(byte[].class),
U.arrayIndexScale(char[].class),
U.arrayIndexScale(short[].class),
U.arrayIndexScale(int[].class),
U.arrayIndexScale(float[].class),
U.arrayIndexScale(long[].class),
U.arrayIndexScale(double[].class)
);
代码示例来源:origin: stackoverflow.com
long last = 0;
int offset = unsafe.arrayBaseOffset(objects.getClass());
int scale = unsafe.arrayIndexScale(objects.getClass());
switch (scale) {
case 4:
代码示例来源:origin: prestodb/presto
int scale = VMSupport.U.arrayIndexScale(Class.forName(data.arrayClass()));
代码示例来源:origin: facebook/jcommon
return (int) (maxOffset + unsafe.arrayIndexScale(arrayType));
代码示例来源:origin: net.sf.ehcache/ehcache
Class<?> klazz = obj.getClass();
int base = UNSAFE.arrayBaseOffset(klazz);
int scale = UNSAFE.arrayIndexScale(klazz);
long size = base + (scale * Array.getLength(obj));
size += CURRENT_JVM_INFORMATION.getFieldOffsetAdjustment();
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static long arrayObjectIndexScale() {
if(U == null)
return 0;
return U.arrayIndexScale(Object[].class);
}
代码示例来源:origin: org.jupiter-rpc/jupiter-all
/**
* Reports the scale factor for addressing elements in the storage
* allocation of a given array class.
*/
public static int arrayIndexScale(Class<?> clazz) {
return unsafe != null ? unsafe.arrayIndexScale(clazz) : -1;
}
代码示例来源:origin: org.apache.geode/gemfire-core
public int arrayScaleIndex(Class c) {
return this.unsafe.arrayIndexScale(c);
}
public long fieldOffset(Field f) {
代码示例来源:origin: org.jupiter-rpc/jupiter-common
/**
* Reports the scale factor for addressing elements in the storage
* allocation of a given array class.
*/
public static int arrayIndexScale(Class<?> clazz) {
return unsafe != null ? unsafe.arrayIndexScale(clazz) : -1;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static long arrayObjectIndexScale() {
if(U == null)
return 0;
return U.arrayIndexScale(Object[].class);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public int arrayIndexScale(Class<?> arrayClass) {
return UNSAFE.arrayIndexScale(arrayClass);
}
代码示例来源:origin: com.hazelcast/hazelcast-all
@Override
public int arrayIndexScale(Class<?> arrayClass) {
return UNSAFE.arrayIndexScale(arrayClass);
}
代码示例来源:origin: org.openjdk.jol/jol-core
@Override
public int arrayIndexScale(String arrayComponentKlass) {
if (arrayComponentKlass.equals("byte")) return U.arrayIndexScale(byte[].class);
if (arrayComponentKlass.equals("boolean")) return U.arrayIndexScale(boolean[].class);
if (arrayComponentKlass.equals("short")) return U.arrayIndexScale(short[].class);
if (arrayComponentKlass.equals("char")) return U.arrayIndexScale(char[].class);
if (arrayComponentKlass.equals("int")) return U.arrayIndexScale(int[].class);
if (arrayComponentKlass.equals("float")) return U.arrayIndexScale(float[].class);
if (arrayComponentKlass.equals("long")) return U.arrayIndexScale(long[].class);
if (arrayComponentKlass.equals("double")) return U.arrayIndexScale(double[].class);
return U.arrayIndexScale(Object[].class);
}
代码示例来源:origin: org.neo4j/neo4j-unsafe
public static int arrayIndexScale( Class klass )
{
int scale = unsafe.arrayIndexScale( klass );
if ( scale == 0 )
{
throw new AssertionError( "Array type too narrow for unsafe access: " + klass );
}
return scale;
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
sun.misc.Unsafe unsafe = org.apache.ignite.internal.util.GridUnsafe.unsafe();
System.out.println(unsafe.arrayBaseOffset(byte[].class));
System.out.println(unsafe.arrayIndexScale(byte[].class));
}
内容来源于网络,如有侵权,请联系作者删除!