Exemplo n.º 1
0
        internal sealed override void CompileIKVM(IKVMCompilationContext context, IKVM.Reflection.Universe universe)
        {
            var loopStart = context.DefineLabel();

            context.Labels.Add(checked ((uint)context.Depth.Count), loopStart);
            context.Depth.Push(Type);
            context.MarkLabel(loopStart);
            context.LoopLabels.Add(loopStart);
        }
Exemplo n.º 2
0
        internal sealed override void CompileIKVM(IKVMCompilationContext context, IKVM.Reflection.Universe universe)
        {
            var afterElse = context.DefineLabel();

            context.Emit(IKVM.Reflection.Emit.OpCodes.Br, afterElse);

            var target = checked ((uint)context.Depth.Count) - 1;

            context.MarkLabel(context.Labels[target]);
            context.Labels[target] = afterElse;
        }
Exemplo n.º 3
0
        internal sealed override void CompileIKVM(IKVMCompilationContext context, IKVM.Reflection.Universe universe)
        {
            var stack = context.Stack;

            if (stack.Count == 0)
            {
                throw new StackTooSmallException(OpCode.If, 1, 0);
            }

            var type = stack.Pop();

            if (type != ValueType.Int32)
            {
                throw new StackTypeInvalidException(OpCode.If, ValueType.Int32, type);
            }

            var label = context.DefineLabel();

            context.Labels.Add(checked ((uint)context.Depth.Count), label);
            context.Depth.Push(Type);
            context.Emit(IKVM.Reflection.Emit.OpCodes.Brfalse, label);
        }
Exemplo n.º 4
0
 internal sealed override void CompileIKVM(IKVMCompilationContext context, IKVM.Reflection.Universe universe)
 {
     context.Labels.Add(checked ((uint)context.Depth.Count), context.DefineLabel());
     context.Depth.Push(Type);
 }