Jurassic.Compiler.DynamicILGenerator.Emit1ByteOpCode C# (CSharp) Method

Emit1ByteOpCode() private method

Emits a one byte opcode.
private Emit1ByteOpCode ( byte opCode, int popCount, int pushCount ) : void
opCode byte The opcode to emit.
popCount int The number of items to pop from the stack.
pushCount int The number of items to push onto the stack.
return void
        private void Emit1ByteOpCode(byte opCode, int popCount, int pushCount)
        {
            // Enlarge the array if necessary.
            const int instructionSize = 1;
            if (this.offset + instructionSize >= this.bytes.Length)
                EnlargeArray(instructionSize);

            // Emit the instruction bytes.
            this.bytes[this.offset++] = opCode;

            // Update the stack.
            if (this.stackSize < popCount)
                throw new InvalidOperationException("Stack underflow");
            this.stackSize += pushCount - popCount;
            this.maxStackSize = Math.Max(this.stackSize, this.maxStackSize);
        }
DynamicILGenerator