private void Evaluate(TracingILGenerator il, bool shouldBeAddress)
        {
            if (!this._isBound)
            {
                this._binding.Evaluate(il);
                this._isBound = true;
            }

            this._expression.LoadValue(il, shouldBeAddress);
        }
Ejemplo n.º 2
0
 public override void Evaluate(TracingILGenerator il)
 {
     il.TraceWriteLine("// Eval->: {0}", this);
     this.DoConditionalInstruction(
         il,
         () => this._thenExpression.Evaluate(il),
         () => this._elseExpression.Evaluate(il)
         );
     il.TraceWriteLine("// ->Eval: {0}", this);
 }
Ejemplo n.º 3
0
        public override void StoreValue(TracingILGenerator il)
        {
            il.TraceWriteLine("// Stor->: {0}", this);
            if (!this._isLocal)
            {
                throw new InvalidOperationException("Cannot overwrite argument.");
            }

            il.EmitAnyStloc(this._index);
            il.TraceWriteLine("// ->Stor: {0}", this);
        }
Ejemplo n.º 4
0
 private static void EmitLoadTarget(Type targetType, TracingILGenerator il, LocalBuilder local)
 {
     if (targetType.IsValueType)
     {
         il.EmitAnyLdloca(local);
     }
     else
     {
         il.EmitAnyLdloc(local);
     }
 }
Ejemplo n.º 5
0
 private static void EmitLoadTarget(Type targetType, TracingILGenerator il, int parameterIndex)
 {
     if (targetType.IsValueType)
     {
         il.EmitAnyLdarga(parameterIndex);
     }
     else
     {
         il.EmitAnyLdarg(parameterIndex);
     }
 }
Ejemplo n.º 6
0
        public static void EmitGeneralRead(TracingILGenerator il, int unpackerArgumentIndex)
        {
            il.EmitAnyLdarg(unpackerArgumentIndex);
            il.EmitAnyCall(_Unpacker.Read);
            Label target = il.DefineLabel("END_IF");

            il.EmitBrtrue_S(target);
            il.EmitAnyCall(SerializationExceptions.NewUnexpectedEndOfStreamMethod);
            il.EmitThrow();
            il.MarkLabel(target);
        }
Ejemplo n.º 7
0
        public override void Evaluate(TracingILGenerator il)
        {
            il.TraceWriteLine("// Eval->: {0}", this);

            foreach (var statement in this._statements)
            {
                statement.Evaluate(il);
            }

            il.TraceWriteLine("// ->Eval: {0}", this);
        }
        public override void Branch(TracingILGenerator il, Label @else)
        {
            il.TraceWriteLine("// Brnc->: {0}", this);
            foreach (var expression in this._expressions)
            {
                expression.LoadValue(il, false);
                il.EmitBrfalse(@else);
            }

            il.TraceWriteLine("// ->Brnc: {0}", this);
        }
Ejemplo n.º 9
0
        public override void Evaluate(TracingILGenerator il)
        {
            if (this._isLocal && this._index < 0)
            {
                il.TraceWriteLine("// Eval->: {0}", this);

                this._index = il.DeclareLocal(this.ContextType.ResolveRuntimeType(), this._name).LocalIndex;

                il.TraceWriteLine("// ->Eval: {0}", this);
            }
        }
Ejemplo n.º 10
0
        public static void EmitConstruction(TracingILGenerator il, LocalBuilder target, Action <TracingILGenerator> initialCountLoadingEmitter)
        {
            Contract.Requires(il != null);
            Contract.Requires(target != null);

            // TODO: For collection, supports .ctor(IEnumerable<> other)

            if (target.LocalType.IsArray)
            {
                Contract.Assert(initialCountLoadingEmitter != null);
                initialCountLoadingEmitter(il);
                il.EmitNewarr(target.LocalType.GetElementType());
                il.EmitAnyStloc(target);
                return;
            }

            ConstructorInfo ctor = target.LocalType.GetConstructor(_ctor_Int32_ParameterTypes);

            if (ctor != null && initialCountLoadingEmitter != null && typeof(IEnumerable).IsAssignableFrom(target.LocalType))
            {
                if (target.LocalType.IsValueType)
                {
                    // Same as general method call
                    var capacity = il.DeclareLocal(typeof(int), "capacity");
                    initialCountLoadingEmitter(il);
                    il.EmitAnyStloc(capacity);
                    il.EmitAnyLdloca(target);
                    il.EmitAnyLdloc(capacity);
                    il.EmitCallConstructor(ctor);
                }
                else
                {
                    initialCountLoadingEmitter(il);
                    il.EmitNewobj(ctor);
                    il.EmitAnyStloc(target);
                }
                return;
            }

            if (target.LocalType.IsValueType)
            {
                // ValueType instance has been initialized by the runtime.
                return;
            }

            ctor = target.LocalType.GetConstructor(Type.EmptyTypes);
            if (ctor == null)
            {
                throw SerializationExceptions.NewTargetDoesNotHavePublicDefaultConstructorNorInitialCapacity(target.LocalType);
            }

            il.EmitNewobj(ctor);
            il.EmitAnyStloc(target);
        }
        private void EvaluateCore(TracingILGenerator il)
        {
            for (int i = 0; i < this._expressions.Count; i++)
            {
                this._expressions[i].LoadValue(il, false);

                if (i > 0)
                {
                    il.EmitAnd();
                }
            }
        }
Ejemplo n.º 12
0
        private void Invoke(TracingILGenerator il)
        {
            ConstructorInfo asConsctructor;

            if ((asConsctructor = this._method as ConstructorInfo) != null)
            {
                if (asConsctructor.DeclaringType.GetIsValueType())
                {
                    this._target.LoadValue(il, true);
                    foreach (var argument in this._arguments)
                    {
                        argument.LoadValue(il, false);
                    }

                    il.EmitCallConstructor(asConsctructor);

                    // For compatibility to ref type.
                    this._target.LoadValue(il, false);
                }
                else
                {
                    foreach (var argument in this._arguments)
                    {
                        argument.LoadValue(il, false);
                    }

                    il.EmitNewobj(asConsctructor);
                }
            }
            else
            {
                // method
                if (!this._method.IsStatic)
                {
                    this._target.LoadValue(il, this._target.ContextType.GetIsValueType());
                }

                foreach (var argument in this._arguments)
                {
                    argument.LoadValue(il, false);
                }

                if (this._method.IsStatic || this._target.ContextType.GetIsValueType())
                {
                    il.EmitCall(this._method as MethodInfo);
                }
                else
                {
                    il.EmitCallvirt(this._method as MethodInfo);
                }
            }
        }
Ejemplo n.º 13
0
        public override void StoreValue(TracingILGenerator il)
        {
            il.TraceWriteLine("// Stor->: {0}", this);
            if (this._instance != null)
            {
                this._instance.LoadValue(il, this._instance.ContextType.ResolveRuntimeType().GetIsValueType());
            }

            this._value.LoadValue(il, false);

            il.EmitStfld(this._field);
            il.TraceWriteLine("// ->Stor: {0}", this);
        }
Ejemplo n.º 14
0
        public sealed override void Branch(TracingILGenerator il, Label @else)
        {
            il.TraceWriteLine("// Brnc->: {0}", this);
            if (this.ContextType.ResolveRuntimeType() != typeof(bool))
            {
                throw new InvalidOperationException(
                          String.Format(CultureInfo.CurrentCulture, "Cannot branch with non boolean type '{0}'.", this.ContextType)
                          );
            }

            this.BranchCore(il, @else);
            il.TraceWriteLine("// ->Brnc: {0}", this);
        }
Ejemplo n.º 15
0
        public static void EmitDeserializeValue(SerializerEmitter emitter, TracingILGenerator il, int unpackerArgumentIndex, LocalBuilder result, SerializingMember member, LocalVariableHolder localHolder)
        {
            LocalBuilder deserializedValue;

            Contract.Requires(emitter != null);
            Contract.Requires(il != null);
            Contract.Requires(unpackerArgumentIndex >= 0);
            Contract.Requires(result != null);
            Label endOfDeserialization = il.DefineLabel("END_OF_DESERIALIZATION");
            bool  flag = false;

            if (member.Member.GetMemberValueType().GetIsValueType() && (Nullable.GetUnderlyingType(member.Member.GetMemberValueType()) == null))
            {
                deserializedValue = localHolder.GetDeserializedValue(typeof(Nullable <>).MakeGenericType(new Type[] { member.Member.GetMemberValueType() }));
                flag = true;
            }
            else
            {
                deserializedValue = localHolder.GetDeserializedValue(member.Member.GetMemberValueType());
            }
            if (deserializedValue.LocalType.GetIsValueType())
            {
                il.EmitAnyLdloca(deserializedValue);
                il.EmitInitobj(deserializedValue.LocalType);
            }
            else
            {
                il.EmitLdnull();
                il.EmitAnyStloc(deserializedValue);
            }
            EmitDeserializeValueCore(emitter, il, unpackerArgumentIndex, deserializedValue, result.LocalType, new SerializingMember?(member), member.Contract.Name, endOfDeserialization, localHolder);
            if (result.LocalType.IsValueType)
            {
                il.EmitAnyLdloca(result);
            }
            else
            {
                il.EmitAnyLdloc(result);
            }
            if (flag)
            {
                il.EmitAnyLdloca(deserializedValue);
                il.EmitGetProperty(typeof(Nullable <>).MakeGenericType(new Type[] { member.Member.GetMemberValueType() }).GetProperty("Value"));
            }
            else
            {
                il.EmitAnyLdloc(deserializedValue);
            }
            EmitStoreValue(il, member.Member);
            il.MarkLabel(endOfDeserialization);
        }
        private static void CreateArrayUnpackTo(Type targetType, SerializerEmitter emitter, CollectionTraits traits)
        {
            TracingILGenerator unpackToMethodILGenerator = emitter.GetUnpackToMethodILGenerator();

            try
            {
                EmitInvokeArrayUnpackToHelper(targetType, emitter, traits, unpackToMethodILGenerator, 1, il0 => il0.EmitAnyLdarg(2));
                unpackToMethodILGenerator.EmitRet();
            }
            finally
            {
                unpackToMethodILGenerator.FlushTrace();
            }
        }
Ejemplo n.º 17
0
        public static void EmitUnpackerEndReadSubtree(TracingILGenerator il, LocalBuilder subtreeUnpacker)
        {
            Contract.Requires(il != null);
            Contract.Requires(subtreeUnpacker != null);
            il.BeginFinallyBlock();
            il.EmitAnyLdloc(subtreeUnpacker);
            Label target = il.DefineLabel("END_IF");

            il.EmitBrfalse_S(target);
            il.EmitAnyLdloc(subtreeUnpacker);
            il.EmitAnyCall(_IDisposable.Dispose);
            il.MarkLabel(target);
            il.EndExceptionBlock();
        }
        private static void EmitExceptionHandling(
            TracingILGenerator il,
            Type returnType,
            Label endOfMethod,
            Action <TracingILGenerator, LocalBuilder> exceptionHandlerInvocation
            )
        {
            il.BeginCatchBlock(typeof(Exception));
            var exception = il.DeclareLocal(typeof(Exception), "exception");

            il.EmitAnyStloc(exception);
            exceptionHandlerInvocation(il, exception);
            il.EmitLeave(endOfMethod);
            il.EndExceptionBlock();
        }
Ejemplo n.º 19
0
        public static void EmitUnpackerBeginReadSubtree(TracingILGenerator il, int unpackerArgumentIndex, LocalBuilder subtreeUnpacker)
        {
            Contract.Requires(il != null);
            Contract.Requires(unpackerArgumentIndex >= 0);
            Contract.Requires(subtreeUnpacker != null);

            /*
             * subtreeUnpacker = unpacker.ReadSubtree()
             */

            il.EmitAnyLdarg(unpackerArgumentIndex);
            il.EmitAnyCall(Metadata._Unpacker.ReadSubtree);
            il.EmitAnyStloc(subtreeUnpacker);
            il.BeginExceptionBlock();
        }
Ejemplo n.º 20
0
        public static void EmitLoadValue(TracingILGenerator il, MemberInfo member)
        {
            Contract.Requires(il != null);
            Contract.Requires(member != null);
            PropertyInfo property = member as PropertyInfo;

            if (property != null)
            {
                il.EmitGetProperty(property);
            }
            else
            {
                Contract.Assert(member is FieldInfo, member.ToString() + ":" + member.MemberType);
                il.EmitLdfld(member as FieldInfo);
            }
        }
        protected sealed override void EmitPackMembers(SerializerEmitter emitter, TracingILGenerator packerIL, SerializingMember[] entries)
        {
            var localHolder = new LocalVariableHolder(packerIL);

            packerIL.EmitAnyLdarg(1);
            packerIL.EmitAnyLdc_I4(entries.Length);
            packerIL.EmitAnyCall(Metadata._Packer.PackMapHeader);
            packerIL.EmitPop();

            foreach (var entry in entries)
            {
                if (entry.Member == null)
                {
                    // skip undefined member.
                    continue;
                }

                packerIL.EmitAnyLdarg(1);
                packerIL.EmitLdstr(entry.Contract.Name);
                packerIL.EmitAnyCall(Metadata._Packer.PackString);
                packerIL.EmitPop();
                Emittion.EmitSerializeValue(
                    emitter,
                    packerIL,
                    1,
                    entry.Member.GetMemberValueType(),
                    entry.Contract.Name,
                    entry.Contract.NilImplication,
                    il0 =>
                {
                    if (typeof(TObject).IsValueType)
                    {
                        il0.EmitAnyLdarga(2);
                    }
                    else
                    {
                        il0.EmitAnyLdarg(2);
                    }

                    Emittion.EmitLoadValue(il0, entry.Member);
                },
                    localHolder
                    );
            }

            packerIL.EmitRet();
        }
Ejemplo n.º 22
0
        protected override void EmitPackMembers(SerializerEmitter emitter, TracingILGenerator packerIL, SerializingMember[] entries)
        {
            var localHolder = new LocalVariableHolder(packerIL);

            packerIL.EmitAnyLdarg(1);
            packerIL.EmitAnyLdc_I4(entries.Length);
            packerIL.EmitAnyCall(Metadata._Packer.PackArrayHeader);
            packerIL.EmitPop();

            foreach (var member in entries)
            {
                if (member.Member == null)
                {
                    // missing member, always nil
                    packerIL.EmitAnyLdarg(1);
                    packerIL.EmitAnyCall(Metadata._Packer.PackNull);
                    packerIL.EmitPop();
                }
                else
                {
                    Emittion.EmitSerializeValue(
                        emitter,
                        packerIL,
                        1,
                        member.Member.GetMemberValueType(),
                        member.Member.Name,
                        member.Contract.NilImplication,
                        il =>
                    {
                        if (typeof(TObject).IsValueType)
                        {
                            il.EmitAnyLdarga(2);
                        }
                        else
                        {
                            il.EmitAnyLdarg(2);
                        }

                        Emittion.EmitLoadValue(il, member.Member);
                    },
                        localHolder
                        );
                }
            }

            packerIL.EmitRet();
        }
        private static void EmitUnpackMembersFromMap(SerializerEmitter emitter, TracingILGenerator unpackerIL, SerializingMember[] entries, LocalBuilder result, LocalVariableHolder localHolder)
        {
            Label label  = unpackerIL.DefineLabel("BEGIN_LOOP");
            Label target = unpackerIL.DefineLabel("END_LOOP");

            unpackerIL.MarkLabel(label);
            LocalBuilder memberName = localHolder.MemberName;

            unpackerIL.EmitAnyLdarg(1);
            unpackerIL.EmitAnyLdloca(memberName);
            unpackerIL.EmitAnyCall(_Unpacker.ReadString);
            unpackerIL.EmitBrfalse(target);
            LocalBuilder unpackedData      = localHolder.UnpackedData;
            LocalBuilder unpackedDataValue = localHolder.UnpackedDataValue;

            for (int i = 0; i < entries.Length; i++)
            {
                if (entries[i].Contract.Name != null)
                {
                    unpackerIL.EmitAnyLdloc(memberName);
                    unpackerIL.EmitLdstr(entries[i].Contract.Name);
                    unpackerIL.EmitAnyCall(_String.op_Equality);
                    Label label3 = unpackerIL.DefineLabel("END_IF_MEMBER_" + i);
                    unpackerIL.EmitBrfalse(label3);
                    if (entries[i].Member == null)
                    {
                        Emittion.EmitGeneralRead(unpackerIL, 1);
                    }
                    else if (UnpackHelpers.IsReadOnlyAppendableCollectionMember(entries[i].Member))
                    {
                        Emittion.EmitDeserializeCollectionValue(emitter, unpackerIL, 1, result, entries[i].Member, entries[i].Member.GetMemberValueType(), entries[i].Contract.NilImplication, localHolder);
                    }
                    else
                    {
                        Emittion.EmitDeserializeValue(emitter, unpackerIL, 1, result, entries[i], localHolder);
                    }
                    unpackerIL.EmitBr(label);
                    unpackerIL.MarkLabel(label3);
                }
            }
            unpackerIL.EmitAnyLdarg(1);
            unpackerIL.EmitCallvirt(_Unpacker.Read);
            unpackerIL.EmitPop();
            unpackerIL.EmitBr(label);
            unpackerIL.MarkLabel(target);
        }
Ejemplo n.º 24
0
        public override Func <SerializationContext, EnumSerializationMethod, MessagePackSerializer <T> > CreateConstructor <T>()
        {
            if (!this._typeBuilder.IsCreated())
            {
                /*
                 *	.ctor( PackerCompatibilityOptions c, EnumSerializerMethod method )
                 *	  : base( c, method )
                 *	{
                 *	}
                 */
                var il = new TracingILGenerator(this._contextConstructorBuilder, TextWriter.Null, this._isDebuggable);
                // : base( c, method )
                il.EmitLdarg_0();
                il.EmitLdarg_1();
                il.EmitLdarg_2();

                Contract.Assert(this._typeBuilder.BaseType != null);

                il.EmitCallConstructor(
                    this._typeBuilder.BaseType.GetConstructor(
                        BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, this._constructorParameterTypes, null
                        )
                    );

                il.EmitRet();
            }

            var ctor             = this._typeBuilder.CreateType().GetConstructor(this._constructorParameterTypes);
            var contextParameter = Expression.Parameter(typeof(SerializationContext), "context");
            var methodParameter  = Expression.Parameter(typeof(EnumSerializationMethod), "method");

#if DEBUG
            Contract.Assert(ctor != null, "ctor != null");
#endif
            return
                (Expression.Lambda <Func <SerializationContext, EnumSerializationMethod, MessagePackSerializer <T> > >(
                     Expression.New(
                         ctor,
                         contextParameter,
                         methodParameter
                         ),
                     contextParameter,
                     methodParameter
                     ).Compile());
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Emits gets <see cref="Unpacker.ItemsCount"/> with exception handling.
        /// Note that final state is the value is pushed top of the evaluation stack.
        /// </summary>
        /// <param name="il">IL generator.</param>
        /// <param name="unpackerArgumentIndex">Argument index of the unpacker.</param>
        /// <param name="localHolder">The <see cref="LocalVariableHolder"/> which holds shared local variable information.</param>
        public static void EmitGetUnpackerItemsCountAsInt32(TracingILGenerator il, int unpackerArgumentIndex, LocalVariableHolder localHolder)
        {
            Contract.Requires(il != null);
            Contract.Requires(unpackerArgumentIndex >= 0);

            /*
             *	long rawItemsCount;
             *	try
             *	{
             *		rawItemsCount = unpacker.ItemsCount;
             *	}
             *	catch ( InvalidOperationException ex )
             *	{
             *		throw SerializationExceptions.NewIsIncorrectStream( ex );
             *	}
             *
             *	if( rawItemsCount > Int32.MaxValue )
             *	{
             *		throw SerializationException.NewIsTooLargeCollection();
             *	}
             *
             *	... unchecked( ( int )rawItemsCount );
             */
            il.EmitAnyLdloca(localHolder.RawItemsCount);
            il.EmitInitobj(typeof(long));
            il.BeginExceptionBlock();
            il.EmitAnyLdarg(unpackerArgumentIndex);
            il.EmitGetProperty(Metadata._Unpacker.ItemsCount);
            il.EmitAnyStloc(localHolder.RawItemsCount);
            il.BeginCatchBlock(typeof(InvalidOperationException));
            il.EmitAnyCall(SerializationExceptions.NewIsIncorrectStreamMethod);
            il.EmitThrow();
            il.EndExceptionBlock();

            il.EmitAnyLdloc(localHolder.RawItemsCount);
            il.EmitLdc_I8(Int32.MaxValue);
            var endIf = il.DefineLabel();

            il.EmitBle_S(endIf);
            il.EmitAnyCall(SerializationExceptions.NewIsTooLargeCollectionMethod);
            il.EmitThrow();
            il.MarkLabel(endIf);
            il.EmitAnyLdloc(localHolder.RawItemsCount);
            il.EmitConv_I4();
        }
Ejemplo n.º 26
0
        public override void LoadValue(TracingILGenerator il, bool shouldBeAddress)
        {
            il.TraceWriteLine("// Load->: {0}", this);
            if (this._instance != null)
            {
                this._instance.LoadValue(il, this._instance.ContextType.GetIsValueType());
            }

            if (shouldBeAddress)
            {
                il.EmitLdflda(this._field);
            }
            else
            {
                il.EmitLdfld(this._field);
            }
            il.TraceWriteLine("// ->Load: {0}", this);
        }
        private static void EmitUnpackMembers(SerializerEmitter emitter, TracingILGenerator unpackerIL, SerializingMember[] entries, LocalBuilder result)
        {
            LocalVariableHolder localHolder = new LocalVariableHolder(unpackerIL);

            unpackerIL.EmitAnyLdarg(1);
            unpackerIL.EmitGetProperty(_Unpacker.IsArrayHeader);
            Label target = unpackerIL.DefineLabel("ELSE");
            Label label2 = unpackerIL.DefineLabel("END_IF");

            unpackerIL.EmitBrfalse(target);
            EmittingSerializerBuilder <TObject> .EmitUnpackMembersFromArray(emitter, unpackerIL, entries, result, localHolder);

            unpackerIL.EmitBr(label2);
            unpackerIL.MarkLabel(target);
            EmittingSerializerBuilder <TObject> .EmitUnpackMembersFromMap(emitter, unpackerIL, entries, result, localHolder);

            unpackerIL.MarkLabel(label2);
        }
Ejemplo n.º 28
0
 public static void EmitConstruction(TracingILGenerator il, LocalBuilder target, Action <TracingILGenerator> initialCountLoadingEmitter)
 {
     Contract.Requires(il != null);
     Contract.Requires(target != null);
     if (target.LocalType.IsArray)
     {
         Contract.Assert(initialCountLoadingEmitter != null);
         initialCountLoadingEmitter(il);
         il.EmitNewarr(target.LocalType.GetElementType());
         il.EmitAnyStloc(target);
     }
     else
     {
         ConstructorInfo constructor = target.LocalType.GetConstructor(_ctor_Int32_ParameterTypes);
         if (((constructor != null) && (initialCountLoadingEmitter != null)) && typeof(IEnumerable).IsAssignableFrom(target.LocalType))
         {
             if (target.LocalType.IsValueType)
             {
                 LocalBuilder local = il.DeclareLocal(typeof(int), "capacity");
                 initialCountLoadingEmitter(il);
                 il.EmitAnyStloc(local);
                 il.EmitAnyLdloca(target);
                 il.EmitAnyLdloc(local);
                 il.EmitCallConstructor(constructor);
             }
             else
             {
                 initialCountLoadingEmitter(il);
                 il.EmitNewobj(constructor);
                 il.EmitAnyStloc(target);
             }
         }
         else if (!target.LocalType.IsValueType)
         {
             constructor = target.LocalType.GetConstructor(Type.EmptyTypes);
             if (constructor == null)
             {
                 throw SerializationExceptions.NewTargetDoesNotHavePublicDefaultConstructorNorInitialCapacity(target.LocalType);
             }
             il.EmitNewobj(constructor);
             il.EmitAnyStloc(target);
         }
     }
 }
Ejemplo n.º 29
0
        public override void LoadValue(TracingILGenerator il, bool shouldBeAddress)
        {
            if (this._statements.Length == 0)
            {
                base.LoadValue(il, shouldBeAddress);
                return;
            }

            il.TraceWriteLine("// Eval(Load)->: {0}", this);

            for (var i = 0; i < this._statements.Length - 1; i++)
            {
                this._statements[i].Evaluate(il);
            }

            this._statements.Last().LoadValue(il, shouldBeAddress);

            il.TraceWriteLine("// ->Eval(Load): {0}", this);
        }
Ejemplo n.º 30
0
        public static void EmitNilImplication(TracingILGenerator il, int unpackerArgumentIndex, string memberName, NilImplication nilImplication, Label endOfDeserialization, LocalVariableHolder localHolder)
        {
            LocalBuilder unpackedData;
            LocalBuilder unpackedDataValue;

            switch (nilImplication)
            {
            case NilImplication.MemberDefault:
                il.EmitAnyLdarg(unpackerArgumentIndex);
                il.EmitGetProperty(_Unpacker.Data);
                unpackedData = localHolder.UnpackedData;
                il.EmitAnyStloc(unpackedData);
                il.EmitAnyLdloca(unpackedData);
                il.EmitGetProperty(_Nullable <MessagePackObject> .Value);
                unpackedDataValue = localHolder.UnpackedDataValue;
                il.EmitAnyStloc(unpackedDataValue);
                il.EmitAnyLdloca(unpackedDataValue);
                il.EmitGetProperty(_MessagePackObject.IsNil);
                il.EmitBrtrue(endOfDeserialization);
                break;

            case NilImplication.Prohibit:
            {
                il.EmitAnyLdarg(unpackerArgumentIndex);
                il.EmitGetProperty(_Unpacker.Data);
                unpackedData = localHolder.UnpackedData;
                il.EmitAnyStloc(unpackedData);
                il.EmitAnyLdloca(unpackedData);
                il.EmitGetProperty(_Nullable <MessagePackObject> .Value);
                unpackedDataValue = localHolder.UnpackedDataValue;
                il.EmitAnyStloc(unpackedDataValue);
                il.EmitAnyLdloca(unpackedDataValue);
                il.EmitGetProperty(_MessagePackObject.IsNil);
                Label target = il.DefineLabel("END_IF0");
                il.EmitBrfalse_S(target);
                il.EmitLdstr(memberName);
                il.EmitAnyCall(SerializationExceptions.NewNullIsProhibitedMethod);
                il.EmitThrow();
                il.MarkLabel(target);
                break;
            }
            }
        }