コード例 #1
0
        public void EmitPutstatic(short f, Field field)
        {
            EmitOp(OpCodeValue.putstatic);

            if (!alive) return;
            EmitShort(f);

            state.Pop(field.ReturnType);
        }
コード例 #2
0
        public short AddConstantFieldref(Field field)
        {
            if (field == null) return 0;

            short classIndex = AddConstantClass(field.DeclaringType);
            short nameAndTypeIndex = AddConstantNameAndType(field.Name, field);

            CompileConstantFieldref fieldConst =
                ConstantPool.OfType<CompileConstantFieldref>().FirstOrDefault(
                    x => x.ClassIndex == classIndex && x.NameAndTypeIndex == nameAndTypeIndex);

            if (fieldConst == null)
            {
                fieldConst = new CompileConstantFieldref
                                 {
                                     PoolIndex = nextConstantIndex++,
                                     ClassIndex = classIndex,
                                     NameAndTypeIndex = nameAndTypeIndex
                                 };

                ConstantPool.Add(fieldConst);
            }

            return fieldConst.PoolIndex;
        }
コード例 #3
0
        public void EmitPutfield(short f, Field field)
        {
            EmitOp(OpCodeValue.putfield);

            if (!alive) return;
            EmitShort(f);

            state.Pop(field.ReturnType);
            state.Pop(1); // object ref
        }