Esempio n. 1
0
        public VMSlot GetValue(VMContext ctx, PointerType type)
        {
            var inst = instance;

            if (field.DeclaringType.IsValueType && instance is IReference)
            {
                inst = ((IReference)instance).GetValue(ctx, PointerType.OBJECT).ToObject(field.DeclaringType);
            }
            return(VMSlot.FromObject(field.GetValue(inst), field.FieldType));
        }
Esempio n. 2
0
 public unsafe void SetValue(VMContext ctx, VMSlot slot, PointerType type)
 {
     if (field.DeclaringType.IsValueType && instance is IReference)
     {
         TypedReference typedRef;
         ((IReference)instance).ToTypedReference(ctx, &typedRef, field.DeclaringType);
         field.SetValueDirect(typedRef, slot.ToObject(field.FieldType));
     }
     else
     {
         field.SetValue(instance, slot.ToObject(field.FieldType));
     }
 }
Esempio n. 3
0
        public VMSlot GetValue(VMContext ctx, PointerType type)
        {
            TypedReference typedRef;

            if (_ptr != null)
            {
                *&typedRef = *(TypedReference *)_ptr.Value;
            }
            else
            {
                *(PseudoTypedRef *)&typedRef = _typedRef;
            }
            return(VMSlot.FromObject(TypedReference.ToObject(typedRef), __reftype(typedRef)));
        }
Esempio n. 4
0
 public void SetValue(VMContext ctx, VMSlot slot, PointerType type)
 {
     if (type == PointerType.BYTE)
     {
         slot.U8 = slot.U1;
     }
     else if (type == PointerType.WORD)
     {
         slot.U8 = slot.U2;
     }
     else if (type == PointerType.DWORD)
     {
         slot.U8 = slot.U4;
     }
     ctx.Stack[StackPos] = slot;
 }
Esempio n. 5
0
        public void SetValue(VMContext ctx, VMSlot slot, PointerType type)
        {
            TypedReference typedRef;

            if (_ptr != null)
            {
                *&typedRef = *(TypedReference *)_ptr.Value;
            }
            else
            {
                *(PseudoTypedRef *)&typedRef = _typedRef;
            }

            var refType = __reftype(typedRef);
            var value   = slot.ToObject(refType);

            TypedReferenceHelpers.SetTypedRef(value, &typedRef);
        }
Esempio n. 6
0
 public void SetValue(VMContext ctx, VMSlot slot, PointerType type)
 {
     throw new NotSupportedException();
 }