os.writeWord(uobj.toLong());
os.setWord(fldOffset, uobj.toLong()); } else if (value instanceof Label) { final Label lbl = (Label)value; bis.setObjectRef(fldOffset, lbl);
    private void storeObject(int offset, Class<?> cls, Object obj,            VmClassType<?> vmType) throws BuildException,            ClassNotFoundException, JNodeClassNotFoundException {        final Class< ? > sCls = cls.getSuperclass();        if (sCls != null) {            final VmClassType< ? > vmSuperType = (VmClassType< ? >) loaderContext                    .loadClass(sCls.getName(), true);            storeObject(offset, sCls, obj, vmSuperType);        }        try {            final FieldInfo fieldInfo = getFieldInfo(cls);            // final Field fields[] = cls.getDeclaredFields();            final Field[] fields = fieldInfo.getJdkInstanceFields();            final int len = fields.length;            // AccessibleObject.setAccessible(fields, true);            for (int i = 0; i < len; i++) {                final VmField jnodeField = fieldInfo.getJNodeInstanceField(i);                final Field jdkField = fields[i];                final int modifiers = jnodeField.getModifiers();                if ((modifiers & Modifier.STATIC) != 0) {                    throw new BuildException("Static field in instance list");                }                final int fldOffset = offset                        + ((VmInstanceField) jnodeField).getOffset();                if ((jdkField == null)                        || ((modifiers & Modifier.TRANSIENT) != 0)) {                    if (jnodeField.isWide()) {                        os.set64(fldOffset, 0);                    } else if (!jnodeField.isPrimitive()) {                        os.setWord(fldOffset, 0);                    } else {                        switch (jnodeField.getTypeSize()) {                        case 1:                            os.set8(fldOffset, 0);                            break;                        case 2:                            os.set16(fldOffset, 0);                            break;                        case 4:                            os.set32(fldOffset, 0);                            break;                        default:                            throw new BuildException("Invalid typesize in: " + jnodeField);                            }                    }                    if (debugWriter != null) {                        debugWriter.println(jnodeField.getName()                                + " transient: 0");                    }                } else if (jnodeField.isPrimitive()) {                    final Class< ? > fType = jdkField.getType();                    if (debugWriter != null) {                        debugWriter.println(jdkField.getName() + " "                                + jdkField.get(obj));                    }                    if (fType == byte.class) {                        os.set8(fldOffset, jdkField.getByte(obj));                    } else if (fType == boolean.class) {                        os.set8(fldOffset, (jdkField.getBoolean(obj)) ? 1 : 0);                    } else if (fType == char.class) {                        os.set16(fldOffset, jdkField.getChar(obj));                    } else if (fType == short.class) {                        os.set16(fldOffset, jdkField.getShort(obj));                    } else if (fType == int.class) {                        os.set32(fldOffset, jdkField.getInt(obj));                    } else if (fType == float.class) {                        os.set32(fldOffset, Float.floatToIntBits(jdkField                                .getFloat(obj)));                    } else if (fType == long.class) {                        os.set64(fldOffset, jdkField.getLong(obj));                    } else if (fType == double.class) {                        os.set64(fldOffset, Double.doubleToLongBits(jdkField                                .getDouble(obj)));                    } else {                        throw new BuildException("Unknown primitive class "                                + fType.getName());                    }                } else if (jnodeField.getDeclaringClass().isMagicType()) {                    final Object value = jdkField.get(obj);                    if (value == null) {                        os.writeWord(0);                    } else if (value instanceof UnboxedObject) {                        final UnboxedObject uobj = (UnboxedObject)value;                        os.writeWord(uobj.toLong());                    } else {                        throw new BuildException("Cannot handle magic type " + value.getClass().getName());                    }                                    } else {                    Object value = jdkField.get(obj);                    try {                        testForValidEmit(value, cls.getName());                    } catch (BuildException ex) {                        throw new BuildException("Cannot emit field "                                + jdkField.getName() + " of class "                                + cls.getName(), ex);                    } catch (JNodeClassNotFoundException ex) {                        BootLog                                .warn("JNode class not found "                                        + ex.getMessage());                        value = null;                    }                    bis.setObjectRef(fldOffset, value);                }            }        } catch (IllegalAccessException ex) {            throw new BuildException("emitting object: [" + obj + "]", ex);        } catch (SecurityException ex) {            throw new BuildException("emitting object: [" + obj + "]", ex);        }    }