コード例 #1
0
 public override void resolve(ConstantPoolInfo[] pool)
 {
     theClass = (ConstantPoolInfo_Class)pool[classIndex - 1];
     nameAndType = (ConstantPoolInfo_NameAndType)pool[nameAndTypeIndex - 1];
     nameAndType.resolve(pool);
     deriveParameterCount();
 }
コード例 #2
0
        public override void resolve(ConstantPoolInfo[] pool)
        {
            theClass = (ConstantPoolInfo_Class)pool[classIndex - 1];
            nameAndType = (ConstantPoolInfo_NameAndType)pool[nameAndTypeIndex - 1];

            nameAndType.resolve(pool);
            if (nameAndType.getDescriptor().Equals("I")){
                fieldType = TYPE_INT;
            }
            else if (nameAndType.getDescriptor().Equals("F")){
                fieldType = TYPE_FLOAT;
            }
            else if (nameAndType.getDescriptor().Equals("Z")){
                fieldType = TYPE_BOOLEAN;
            }
            else if (nameAndType.getDescriptor().Equals("L")){
                fieldType = TYPE_LONG;
            }
            else {
                fieldType = TYPE_REF;
            }
        }
コード例 #3
0
ファイル: ClassFile.cs プロジェクト: jdewald/toyvm
 public MethodInfo getMethod(ConstantPoolInfo_NameAndType nameAndType)
 {
     return getMethod(nameAndType.getRefName(),nameAndType.getDescriptor());
 }
コード例 #4
0
ファイル: ClassFile.cs プロジェクト: jdewald/toyvm
 public void execute(ConstantPoolInfo_NameAndType nameAndType, StackFrame frame)
 {
     execute(nameAndType.getRefName(),nameAndType.getDescriptor(),frame);
 }
コード例 #5
0
        public static ConstantPoolInfo readConstantPoolEntry(MSBBinaryReaderWrapper reader)
        {
            byte tag = reader.ReadByte();

            ConstantPoolInfo info = null;
            switch (tag)
            {
                case TYPE_CLASS:
                {
                    info = new ConstantPoolInfo_Class(tag);
                    break;
                }
                case TYPE_METHOD_REF:
                {
                    info = new ConstantPoolInfo_MethodRef(tag);
                    break;
                }
            case TYPE_INTERFACE_METHOD_REF:
            {
                info = new ConstantPoolInfo_InterfaceMethodRef(tag);
                break;
            }
                case TYPE_FIELD_REF:
                {
                    info = new ConstantPoolInfo_FieldRef(tag);
                    break;
                }
                case TYPE_STRING:
                {
                    info = new ConstantPoolInfo_String(tag);
                    break;
                }
                case TYPE_UTF8:
                {
                    info = new ConstantPoolInfo_UTF8(tag);
                    break;
                }
                case TYPE_NAME_AND_TYPE:
                {
                    info = new ConstantPoolInfo_NameAndType(tag);
                    break;
                }
            case TYPE_INTEGER:
            {
                info = new ConstantPoolInfo_Integer(tag);
                break;
            }
            case TYPE_FLOAT:
            {
                info = new ConstantPoolInfo_Float(tag);
                break;
            }
            case TYPE_DOUBLE:
            {
                info = new ConstantPoolInfo_Double(tag);
                break;
            }
            case TYPE_LONG:
            {
                info = new ConstantPoolInfo_Long(tag);
                break;
            }

            default:
                {
                    throw new UnknownConstantPoolTypeException(String.Format("Do not know how to parse {0}",tag));
                }

            }

            info.parse(reader);

            return info;
        }