public static long firstFieldOffset(Class clazz){
  long minSize=roundUpTo8(headerSize(clazz));
  while (clazz != Object.class) {
    for (    Field f : clazz.getDeclaredFields()) {
      if ((f.getModifiers() & Modifier.STATIC) == 0) {
        long offset=unsafe.objectFieldOffset(f);
        if (offset < minSize) {
          minSize=offset;
        }
      }
    }
    clazz=clazz.getSuperclass();
  }
  return minSize;
}

public static long firstFieldOffset ( Class clazz ) { long minSize = roundUpTo8 ( headerSize ( clazz ) ) ; while ( clazz != Object . class ) { for ( Field f : clazz . getDeclaredFields ( ) ) { if ( ( f . getModifiers ( ) & Modifier . STATIC ) == 0 ) { long offset = unsafe . objectFieldOffset ( f ) ; if ( offset < minSize ) { minSize = offset ; } } } clazz = clazz . getSuperclass ( ) ; } return minSize ; }
returns the offset of the first field in the range [ headersize , sizeof ] .
