FileDocCategorySizeDatePackage
EVMClass.javaAPI DocphoneME MR2 API (J2ME)4601Wed May 02 17:59:48 BST 2007vm

EVMClass

public class EVMClass extends ClassClass implements jcc.EVMConst, jcc.Const

Fields Summary
public EVMMethodInfo[]
methods
private String
myNativeName
protected int
typeCode
public int
nStaticWords
public int
nStaticRef
public FieldInfo[]
statics
Constructors Summary
public EVMClass(ClassInfo c)


        
	ci = c;
	c.vmClass = this;

	if ( c.methods != null ){
	    // per-method, EVM-specific info.
	    methods = new EVMMethodInfo[ c.methods.length ];
	    for( int i = 0; i < methods.length; i++ ){
		components.MethodInfo m = c.methods[i];
		methods[i] = new EVMMethodInfo( m );
		if (!hasStaticInitializer &&
		    m.isStaticMember() &&
		    m.name.string.equals(/*NOI18N*/"<clinit>")) {
		    hasStaticInitializer = true;
		}
	    }
	}
    
Methods Summary
public intEVMflags()

	int flagval = 0;
	int a = ci.access;
	if ( (a&ACC_PUBLIC) != 0 ) flagval |= EVM_CLASS_ACC_PUBLIC;
	if ( (a&ACC_FINAL) != 0 ) flagval |= EVM_CLASS_ACC_FINAL;
	if ( (a&ACC_SUPER) != 0 ) flagval |= EVM_CLASS_ACC_SUPER;
	if ( (a&ACC_INTERFACE) != 0 ) flagval |= EVM_CLASS_ACC_INTERFACE;
	if ( (a&ACC_ABSTRACT) != 0 ) flagval |= EVM_CLASS_ACC_ABSTRACT;
	return flagval;

    
public java.lang.StringgetNativeName()

	if ( myNativeName == null ){
	    if ( ci instanceof ArrayClassInfo ){
		ArrayClassInfo aci = (ArrayClassInfo)ci;
		if (aci.depth == 1) {
		    /*
		     * There are some special arrays of well-known basic
		     * types here.
		     */
		    if (aci.baseClass == null) {
			myNativeName = "manufacturedArrayOf"+
			    aci.baseName;
		    } else if (aci.baseClass.find().superClassInfo == null) {
			myNativeName = "manufacturedArrayOfObject";
		    } else {
		        myNativeName = "manufacturedArrayClass"+
			    aci.arrayClassNumber;
		    }
		} else {
		    myNativeName = "manufacturedArrayClass"+
			aci.arrayClassNumber;
		}
	    } else {
		myNativeName = ci.getGenericNativeName();
	    }
	}
	return myNativeName;
    
public voidorderStatics()

	// count statics.
	// arranged them ref-first
	// do not assign offsets.
	FieldInfo f[] = ci.fields;
	nStaticWords = 0;
	if ( (f == null) || (f.length == 0 ) ) return; // nothing to do.
	int nFields = f.length;
	int nStatic = 0;
	int nRef = 0;
	for ( int i = 0; i < nFields; i++ ){
	    FieldInfo fld = f[i];
	    if ( fld.isStaticMember() ){
		nStatic += 1;
		char toptype =  fld.type.string.charAt(0);
		if ( (toptype == 'L") || (toptype=='["))
		    nRef += 1;
	    }
	}
	int refOff     = 0;
	int scalarOff = nRef;
	int totalStaticWords = nRef;
	statics = new FieldInfo[ nStatic ];
	for ( int i = 0; i < nFields; i++ ){
	    FieldInfo fld = f[i];
	    if ( fld.isStaticMember() ){
		char toptype =  fld.type.string.charAt(0);
		if ( (toptype == 'L") || (toptype=='[")){
		    statics[refOff] = fld;
		    refOff += 1;
		} else {
		    statics[scalarOff] = fld;
		    scalarOff += 1;
		    totalStaticWords += fld.nSlots;
		}
	    }
	}
	nStaticWords = totalStaticWords;
	nStaticRef   = nRef;
    
public inttypecode()

	return typeCode;