VM_Statics.findOrCreateStringLiteral(VM_Atom.findOrCreateUnicodeAtom((String)value));
packCPEntry(CP_STRING, VM_Statics.findOrCreateStringLiteral(VM_Atom.findOrCreateUnicodeAtom((String)value)));
  private static VM_Class createAnnotationClass(VM_Class annotationInterface) {    // Compute name of class based on the name of the annotation interface    VM_Atom annotationClassName;    {      byte annotationName[] = annotationInterface.getDescriptor().toByteArray();      byte annotationClassName_tmp[] = new byte[annotationName.length+2];      System.arraycopy(annotationName, 0, annotationClassName_tmp, 0, annotationName.length-1);      System.arraycopy(new byte[]{'$','$',';'}, 0, annotationClassName_tmp, annotationName.length-1, 3);      annotationClassName = VM_Atom.findOrCreateUtf8Atom(annotationClassName_tmp);    }    // Create a handle to the new synthetic type    VM_TypeReference annotationClass = VM_TypeReference.findOrCreateInternal(annotationInterface.getClassLoader(),                                                                             annotationClassName);    if (VM.TraceClassLoading && VM.runningVM)      VM.sysWrite("VM_Class: (begin) create (load) annotation " + annotationClass.getName() + "\n");    // Count the number of default values for this class    int numDefaultFields = 0;    for(int i=0; i < annotationInterface.declaredMethods.length; i++) {      if(annotationInterface.declaredMethods[i].annotationDefault != null) {        numDefaultFields++;      }    }    // The constant pool that will be used by bytecodes in our    // synthetic methods. The constant pool is laid out as:    // * 1 - the fields holding the annotation values    // * 2 - the methods implementing those in the interface    // * 3 - the default values to initialise the class fields to    // * 4 - the object initialiser method    int numFields = annotationInterface.declaredMethods.length;    int numMethods = annotationInterface.declaredMethods.length+1;    int constantPoolSize = numFields + numMethods + numDefaultFields;    int constantPool[] = new int[constantPoolSize];    // Create fields for class    VM_Field annotationFields[] = new VM_Field[numFields];    for(int i=0; i < numFields; i++) {      VM_Method currentAnnotationValue = annotationInterface.declaredMethods[i];      VM_Atom newFieldName = VM_Atom.findOrCreateAsciiAtom(currentAnnotationValue.getName().toString() + "_field");      VM_Atom newFieldDescriptor = currentAnnotationValue.getReturnType().getName();      VM_MemberReference newFieldRef = VM_MemberReference.findOrCreate(annotationClass, newFieldName, newFieldDescriptor);      annotationFields[i] = VM_Field.createAnnotationField(annotationClass, newFieldRef);      constantPool[i] = newFieldRef.getId();    }    // Create copy of methods from the annotation    VM_Method annotationMethods[] = new VM_Method[numMethods];    for (int i=0; i < annotationInterface.declaredMethods.length; i++) {      VM_Method currentAnnotationValue = annotationInterface.declaredMethods[i];      VM_Atom newMethodName = currentAnnotationValue.getName();      VM_Atom newMethodDescriptor = currentAnnotationValue.getDescriptor();      VM_MemberReference newMethodRef = VM_MemberReference.findOrCreate(annotationClass, newMethodName, newMethodDescriptor);                                          annotationMethods[i] =        VM_Method.createAnnotationMethod(annotationClass, constantPool,                                         newMethodRef, annotationInterface.declaredMethods[i], i);      constantPool[numFields+i] = annotationMethods[i].getMemberRef().getId();          }    // Create default value constants    int nextFreeConstantPoolSlot = numFields + annotationInterface.declaredMethods.length;    int defaultConstants[] = new int[numDefaultFields];    for(int i=0, j=0; i < annotationInterface.declaredMethods.length; i++) {      Object value = annotationInterface.declaredMethods[i].annotationDefault;      if(value != null) {        if(value instanceof Integer) {          constantPool[nextFreeConstantPoolSlot] =            VM_Statics.findOrCreateIntSizeLiteral(((Integer)value).intValue());          defaultConstants[j] = nextFreeConstantPoolSlot;          j++;          nextFreeConstantPoolSlot++;        }        else if(value instanceof Boolean) {          constantPool[nextFreeConstantPoolSlot] =            VM_Statics.findOrCreateIntSizeLiteral(((Boolean)value).booleanValue() ? 1 : 0);          defaultConstants[j] = nextFreeConstantPoolSlot;          j++;          nextFreeConstantPoolSlot++;        }        else if(value instanceof String) {          try {            constantPool[nextFreeConstantPoolSlot] =              VM_Statics.findOrCreateStringLiteral(VM_Atom.findOrCreateUnicodeAtom((String)value));          } catch (UTFDataFormatException e) {            throw new Error(e);          }          defaultConstants[j] = nextFreeConstantPoolSlot;          j++;          nextFreeConstantPoolSlot++;        }        else {          throw new Error("Unhandled default assignment: " + value);        }      }    }    // Create initialiser    int objectInitIndex = nextFreeConstantPoolSlot;    VM_MethodReference baInitMemRef = VM_Annotation.getBaseAnnotationInitMemberReference();    constantPool[objectInitIndex] = baInitMemRef.getId();    VM_MemberReference initMethodRef =      VM_MemberReference.findOrCreate(annotationClass,                                      baInitMemRef.getName(),                                      baInitMemRef.getDescriptor()                                      );    annotationMethods[annotationInterface.declaredMethods.length] =      VM_Method.createAnnotationInit(annotationClass, constantPool, initMethodRef,                                     objectInitIndex, annotationFields,                                     annotationInterface.declaredMethods,                                     defaultConstants);    // Create class    VM_Class klass = new VM_Class(annotationClass, constantPool,                                  ACC_SYNTHETIC|ACC_PUBLIC|ACC_FINAL, // modifiers                                  baInitMemRef.resolveMember().getDeclaringClass(), // superClass                                  new VM_Class[]{annotationInterface}, // declaredInterfaces                                  annotationFields, annotationMethods,                                  null, null, null, null, null, null, null, null, null                                  );    annotationClass.setResolvedType(klass);    return klass;  }