Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs')
-rw-r--r--src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs
new file mode 100644
index 000000000..f5f947c74
--- /dev/null
+++ b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+
+using Internal.IL;
+using Internal.Runtime.CallInterceptor;
+using Internal.TypeSystem;
+
+namespace Internal.Runtime.Interpreter
+{
+ internal unsafe class ILInterpreter
+ {
+ private readonly MethodDesc _method;
+ private readonly MethodIL _methodIL;
+ private readonly TypeSystemContext _context;
+ private readonly LowLevelStack<StackItem> _stack;
+
+ private CallInterceptorArgs _callInterceptorArgs;
+
+ public LowLevelStack<StackItem> EvaluationStack => _stack;
+
+ public TypeSystemContext TypeSystemContext => _context;
+
+ public ILInterpreter(TypeSystemContext context, MethodDesc method, MethodIL methodIL)
+ {
+ _context = context;
+ _method = method;
+ _methodIL = methodIL;
+ _stack = new LowLevelStack<StackItem>();
+ }
+
+ public void InterpretMethod(ref CallInterceptorArgs callInterceptorArgs)
+ {
+ _callInterceptorArgs = callInterceptorArgs;
+ ILImporter importer = new ILImporter(this, _method, _methodIL);
+ importer.Interpret();
+ }
+
+ public void SetReturnValue<T>(T value)
+ {
+ _callInterceptorArgs.ArgumentsAndReturnValue.SetVar<T>(0, value);
+ }
+ }
+}