Merge pull request #4155 from BrzVlad/fix-tls-lmf-addr
[mono-project.git] / mcs / class / dlr / Runtime / Microsoft.Dynamic / Interpreter / Instructions / Instruction.cs
blob6f67063353b7036211324e7a0442ee5ebbab5705
1 /* ****************************************************************************
3 * Copyright (c) Microsoft Corporation.
5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
6 * copy of the license can be found in the License.html file at the root of this distribution. If
7 * you cannot locate the Apache License, Version 2.0, please send an email to
8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
9 * by the terms of the Apache License, Version 2.0.
11 * You must not remove this notice, or any other, from this software.
14 * ***************************************************************************/
16 using System;
17 using System.Collections.Generic;
18 using System.Diagnostics;
19 using System.Reflection;
20 using System.Runtime.CompilerServices;
21 using Microsoft.Scripting.Runtime;
22 using Microsoft.Scripting.Utils;
24 namespace Microsoft.Scripting.Interpreter {
25 public interface IInstructionProvider {
26 void AddInstructions(LightCompiler compiler);
29 public abstract partial class Instruction {
30 public virtual int ConsumedStack { get { return 0; } }
31 public virtual int ProducedStack { get { return 0; } }
32 public virtual int ConsumedContinuations { get { return 0; } }
33 public virtual int ProducedContinuations { get { return 0; } }
35 public int StackBalance {
36 get { return ProducedStack - ConsumedStack; }
39 public int ContinuationsBalance {
40 get { return ProducedContinuations - ConsumedContinuations; }
43 public abstract int Run(InterpretedFrame frame);
45 public virtual string InstructionName {
46 get { return GetType().Name.Replace("Instruction", ""); }
49 public override string ToString() {
50 return InstructionName + "()";
53 public virtual string ToDebugString(int instructionIndex, object cookie, Func<int, int> labelIndexer, IList<object> objects) {
54 return ToString();
57 public virtual object GetDebugCookie(LightCompiler compiler) {
58 return null;