Added Mono for C# scripting

This commit is contained in:
Simon Lübeß
2023-03-26 13:11:44 +02:00
parent fd6826785a
commit 5e5134a607
57 changed files with 7466 additions and 4 deletions
+2
View File
@@ -5,3 +5,5 @@ build/
recovery/ recovery/
vendor/directx vendor/directx
imgui.ini imgui.ini
GlitchyEditor/resources/scripts/ScriptCore.dll
GlitchyEditor/resources/scripts/ScriptCore.pdb
+2 -2
View File
@@ -1,7 +1,7 @@
FileVersion = 1 FileVersion = 1
Projects = {Sandbox = {Path = "Sandbox"}, GlitchyEngine = {Path = "GlitchyEngine"}, GlitchLog = {Path = "GlitchLog"}, DirectX = {Path = "GlitchyEngine/vendor/directx/DirectX"}, LodePng = {Path = "vendor/lodepng-beef/lodepng-beef"}, FreeType = {Path = "GlitchyEngine/vendor/freetype"}, cgltf-beef = {Path = "GlitchyEngine/vendor/gltf/cgltf-beef"}, GlitchyEditor = {Path = "GlitchyEditor"}, msdfgen-beef = {Path = "GlitchyEngine/vendor/msdfgen/msdfgen-beef"}, ImGui = {Path = "GlitchyEngine/vendor/imgui/ImGui"}, ImGuiImplDX11 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplDX11"}, ImGuiImplWin32 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplWin32"}, ImGuizmo = {Path = "GlitchyEngine/vendor/imgui/ImGuizmo"}, GlitchyEngineHelper = {Path = "GlitchyEngineHelper"}, bon = {Path = "GlitchyEngine/vendor/bon"}, box2d-beef = {Path = "GlitchyEngine/vendor/box2D"}, "Beef.Linq" = {Path = "GlitchyEngine/vendor/Beef.Linq/src"}} Projects = {Sandbox = {Path = "Sandbox"}, GlitchyEngine = {Path = "GlitchyEngine"}, GlitchLog = {Path = "GlitchLog"}, DirectX = {Path = "GlitchyEngine/vendor/directx/DirectX"}, LodePng = {Path = "vendor/lodepng-beef/lodepng-beef"}, FreeType = {Path = "GlitchyEngine/vendor/freetype"}, cgltf-beef = {Path = "GlitchyEngine/vendor/gltf/cgltf-beef"}, GlitchyEditor = {Path = "GlitchyEditor"}, msdfgen-beef = {Path = "GlitchyEngine/vendor/msdfgen/msdfgen-beef"}, ImGui = {Path = "GlitchyEngine/vendor/imgui/ImGui"}, ImGuiImplDX11 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplDX11"}, ImGuiImplWin32 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplWin32"}, ImGuizmo = {Path = "GlitchyEngine/vendor/imgui/ImGuizmo"}, GlitchyEngineHelper = {Path = "GlitchyEngineHelper"}, bon = {Path = "GlitchyEngine/vendor/bon"}, box2d-beef = {Path = "GlitchyEngine/vendor/box2D"}, "Beef.Linq" = {Path = "GlitchyEngine/vendor/Beef.Linq/src"}, ScriptCore = {Path = "ScriptCore"}}
Unlocked = ["corlib"] Unlocked = ["corlib"]
WorkspaceFolders = {GlitchyEngine = ["GlitchyEngine", "GlitchLog", "GlitchyEngineHelper"], "GlitchyEngine/Dependencies" = ["cgltf-beef", "DirectX", "FreeType", "ImGui", "ImGuiImplDX11", "ImGuiImplWin32", "ImGuizmo", "LodePng", "msdfgen-beef", "bon", "box2d-beef", "Beef.Linq"]} WorkspaceFolders = {GlitchyEngine = ["GlitchyEngine", "GlitchLog", "GlitchyEngineHelper", "ScriptCore"], "GlitchyEngine/Dependencies" = ["cgltf-beef", "DirectX", "FreeType", "ImGui", "ImGuiImplDX11", "ImGuiImplWin32", "ImGuizmo", "LodePng", "msdfgen-beef", "bon", "box2d-beef", "Beef.Linq"]}
[Workspace] [Workspace]
StartupProject = "GlitchyEditor" StartupProject = "GlitchyEditor"
+1
View File
@@ -0,0 +1 @@
4.5/
+1
View File
@@ -0,0 +1 @@
Install mono and copy the folder `lib/mono/4.5` here!
+4
View File
@@ -4,6 +4,7 @@ using GlitchyEngine.ImGui;
using GlitchyEngine.Renderer; using GlitchyEngine.Renderer;
using GlitchyEngine.Debug; using GlitchyEngine.Debug;
using GlitchyEngine.Content; using GlitchyEngine.Content;
using GlitchyEngine.Scripting;
namespace GlitchyEngine namespace GlitchyEngine
{ {
@@ -68,6 +69,7 @@ namespace GlitchyEngine
RenderCommand.RendererAPI = _rendererApi; RenderCommand.RendererAPI = _rendererApi;
Renderer.Init(); Renderer.Init();
ScriptEngine.Init();
#if IMGUI #if IMGUI
_imGuiLayer = new ImGuiLayer(); _imGuiLayer = new ImGuiLayer();
@@ -90,6 +92,8 @@ namespace GlitchyEngine
Profiler.ProfileFunction!(); Profiler.ProfileFunction!();
SamplerStateManager.Uninit(); SamplerStateManager.Uninit();
ScriptEngine.Shutdown();
Renderer.Deinit(); Renderer.Deinit();
delete _contentManager; delete _contentManager;
+130
View File
@@ -0,0 +1,130 @@
using Mono;
using System;
using System.IO;
using System.Collections;
namespace GlitchyEngine.Scripting;
static class ScriptEngine
{
private static MonoDomain* s_RootDomain;
private static MonoDomain* s_AppDomain;
private static MonoAssembly* s_CoreAssembly;
public static void Init()
{
Mono.mono_set_assemblies_path("mono/lib");
s_RootDomain = Mono.mono_jit_init("GlitchyEngineJITRuntime");
Log.EngineLogger.Assert(s_RootDomain != null, "Failed to initialize mono root domain");
// Create an App Domain
s_AppDomain = Mono.mono_domain_create_appdomain("GlitchyEngineScriptRuntime", null);
Mono.mono_domain_set(s_AppDomain, true);
s_CoreAssembly = LoadCSharpAssembly("resources/scripts/ScriptCore.dll");
PrintAssemblyTypes(s_CoreAssembly);
function MonoString*() v = => Sample;
Mono.mono_add_internal_call("GlitchyEngine.CSharpTesting::Sample", v);
// Create object
MonoImage* image = Mono.mono_assembly_get_image(s_CoreAssembly);
MonoClass* monoClass = Mono.mono_class_from_name(image, "GlitchyEngine", "CSharpTesting");
MonoObject* instance = Mono.mono_object_new(s_AppDomain, monoClass);
Mono.mono_runtime_object_init(instance);
MonoMethod* simpleMethod = Mono.mono_class_get_method_from_name(monoClass, "PrintFloatVar", 0);
Mono.mono_runtime_invoke(simpleMethod, instance, null, null);
MonoMethod* methodWithArg = Mono.mono_class_get_method_from_name(monoClass, "IncrementFloatVar", 1);
float increment = 2.0f;
void*[1] args = .(&increment);
MonoObject* returnValue = Mono.mono_runtime_invoke(methodWithArg, instance, &args, null);
float returnedValue = *(float*)Mono.mono_object_unbox(returnValue);
Log.EngineLogger.Info($"C# returned: {returnedValue}");
Mono.mono_runtime_invoke(simpleMethod, instance, null, null);
}
[LinkName(.C), AlwaysInclude, Export]
public static void DoSomething()
{
Console.WriteLine("P/Invoke: Hallo von der Engine!");
}
[LinkName(.C), AlwaysInclude]
public static MonoString* Sample()
{
return Mono.mono_string_new(Mono.mono_domain_get(), "Hello!");
}
private static MonoAssembly* LoadCSharpAssembly(StringView assemblyPath)
{
List<uint8> data = new:ScopedAlloc! List<uint8>(1024);
File.ReadAll(assemblyPath, data);
// NOTE: We can't use this image for anything other than loading the assembly because this image doesn't have a reference to the assembly
MonoImageOpenStatus status = .ImageInvalid;
MonoImage* image = Mono.mono_image_open_from_data_full(data.Ptr, (.)data.Count, true, &status, false);
if (status != .Ok)
{
char8* errorMessage = Mono.mono_image_strerror(status);
Log.EngineLogger.Error($"Failed to load C# Assembly: \"{StringView(errorMessage)}\"");
return null;
}
MonoAssembly* assembly = Mono.mono_assembly_load_from_full(image, assemblyPath.ToScopeCStr!(), &status, 0);
Mono.mono_image_close(image);
// Create object
// call simple method
// call method with args
return assembly;
}
private static void PrintAssemblyTypes(MonoAssembly* assembly)
{
MonoImage* image = Mono.mono_assembly_get_image(assembly);
MonoTableInfo* typeDefinitionsTable = Mono.mono_image_get_table_info(image, .MONO_TABLE_TYPEDEF);
int32 numTypes = Mono.mono_table_info_get_rows(typeDefinitionsTable);
for (int32 i = 0; i < numTypes; i++)
{
int32[(.)SOME_RANDOM_ENUM.MONO_TYPEDEF_SIZE] cols = .();
Mono.mono_metadata_decode_row(typeDefinitionsTable, i, (.)&cols, (.)SOME_RANDOM_ENUM.MONO_TYPEDEF_SIZE);
char8* nameSpace = Mono.mono_metadata_string_heap(image, (.)cols[(.)SOME_RANDOM_ENUM.MONO_TYPEDEF_NAMESPACE]);
char8* name = Mono.mono_metadata_string_heap(image, (.)cols[(.)SOME_RANDOM_ENUM.MONO_TYPEDEF_NAME]);
Log.EngineLogger.Info($"{StringView(nameSpace)}.{StringView(name)}");
}
}
public static void Shutdown()
{
/*Mono.mono_assembly_close(s_CoreAssembly);
s_CoreAssembly = null;
Mono.mono_domain_unload(s_AppDomain);
s_AppDomain = null;*/
Mono.mono_jit_cleanup(s_RootDomain);
s_RootDomain = null;
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ StartupObject = "GlitchyEngineHelper.Program"
[Configs.Debug.Win64] [Configs.Debug.Win64]
BuildCommandsOnCompile = "IfFilesChanged" BuildCommandsOnCompile = "IfFilesChanged"
BuildCommandsOnRun = "IfFilesChanged" BuildCommandsOnRun = "IfFilesChanged"
LibPaths = ["$(ProjectDir)/out/build/x64-debug/GlitchyEngineHelper.lib"] LibPaths = ["$(ProjectDir)/out/build/x64-debug/GlitchyEngineHelper.lib", "$(ProjectDir)/vendor/mono/lib/Windows/Debug/libmono-static-sgen.lib", "$(ProjectDir)/vendor/mono/lib/Windows/Debug/libmonoutils.lib", "$(ProjectDir)/vendor/mono/lib/Windows/Debug/libmonoruntime-sgen.lib", "ws2_32.lib", "Winmm.lib", "OleAut32.lib", "Bcrypt.lib"]
PreBuildCmds = ["$(ProjectDir)/../bin/vscmake.bat x64 $(ProjectDir) x64-debug"] PreBuildCmds = ["$(ProjectDir)/../bin/vscmake.bat x64 $(ProjectDir) x64-debug"]
[Configs.Release.Win64] [Configs.Release.Win64]
+5
View File
@@ -0,0 +1,5 @@
namespace Mono;
class Jit
{
}
@@ -0,0 +1,9 @@
using System;
namespace Mono.Metadata;
class Assembly
{
[LinkName(.C)]
public static extern void mono_set_assemblies_path(char8* path);
}
+198
View File
@@ -0,0 +1,198 @@
using System;
namespace Mono;
static class Mono
{
typealias mono_bool = System.Windows.IntBool;
[LinkName(.C)]
public static extern void mono_set_assemblies_path(char8* path);
[LinkName(.C)]
public static extern MonoDomain* mono_jit_init(char8* file);
[LinkName(.C)]
public static extern void mono_jit_cleanup(MonoDomain* domain);
[LinkName(.C)]
public static extern MonoDomain* mono_domain_create_appdomain(char8* friendly_name, char8* configuration_file);
[LinkName(.C)]
public static extern mono_bool mono_domain_set(MonoDomain* domain, mono_bool force);
[LinkName(.C)]
public static extern MonoImage* mono_image_open_from_data_full(uint8* data, uint32 data_len,
mono_bool need_copy, MonoImageOpenStatus* status, mono_bool refonly);
[LinkName(.C)]
public static extern MonoImage* mono_assembly_get_image(MonoAssembly* assembly);
[LinkName(.C)]
public static extern void mono_assembly_close(MonoAssembly* assembly);
[LinkName(.C)]
public static extern void mono_image_close(MonoImage* image);
[LinkName(.C)]
public static extern char8* mono_image_strerror(MonoImageOpenStatus status);
[LinkName(.C)]
public static extern MonoAssembly* mono_assembly_load_from_full(MonoImage* image, char8* fileName,
MonoImageOpenStatus* status, mono_bool refonly);
[LinkName(.C)]
public static extern MonoTableInfo* mono_image_get_table_info(MonoImage* image, MonoMetaTableEnum table_id);
[LinkName(.C)]
public static extern int32 mono_image_get_table_rows(MonoImage *image, MonoMetaTableEnum table_id);
[LinkName(.C)]
public static extern int32 mono_table_info_get_rows(MonoTableInfo* table);
[LinkName(.C)]
public static extern void mono_metadata_decode_row (MonoTableInfo* t,
int32 idx,
uint32* res,
int32 res_size);
[LinkName(.C)]
public static extern char8* mono_metadata_string_heap(MonoImage *meta, uint32 table_index);
typealias gconstpointer = void*;
[LinkName(.C)]
public static extern void mono_add_internal_call(char8* name, gconstpointer method);
[LinkName(.C)]
public static extern MonoString* mono_string_new(MonoDomain* domain, char8* text);
[LinkName(.C)]
public static extern MonoDomain* mono_domain_get();
[LinkName(.C)]
public static extern MonoClass* mono_class_from_name(MonoImage* image, char8* name_space,
char8* name);
[LinkName(.C)]
public static extern MonoClass* mono_class_load_from_name(MonoImage* image, char8* name_space,
char8* name);
[LinkName(.C)]
public static extern MonoObject* mono_object_new(MonoDomain* domain, MonoClass* klass);
[LinkName(.C)]
public static extern void mono_runtime_object_init(MonoObject* this_obj);
[LinkName(.C)]
public static extern MonoMethod* mono_class_get_method_from_name(MonoClass* klass, char8* name, int param_count);
[LinkName(.C)]
public static extern MonoObject* mono_runtime_invoke(MonoMethod* method, void* obj, void** param, MonoObject** exc);
[LinkName(.C)]
public static extern void* mono_object_unbox(MonoObject* obj);
[LinkName(.C)]
public static extern void* mono_domain_unload(MonoDomain* domain);
}
struct MonoDomain;
struct MonoAssembly;
struct MonoImage;
struct MonoTableInfo;
struct MonoString;
struct MonoClass;
struct MonoObject;
struct MonoMethod;
enum MonoImageOpenStatus
{
Ok,
Error_Errno,
MissingAssemblyRef,
ImageInvalid
}
enum SOME_RANDOM_ENUM{
MONO_TYPEDEF_FLAGS,
MONO_TYPEDEF_NAME,
MONO_TYPEDEF_NAMESPACE,
MONO_TYPEDEF_EXTENDS,
MONO_TYPEDEF_FIELD_LIST,
MONO_TYPEDEF_METHOD_LIST,
MONO_TYPEDEF_SIZE
}
enum MonoMetaTableEnum : int32
{
MONO_TABLE_MODULE,
MONO_TABLE_TYPEREF,
MONO_TABLE_TYPEDEF,
MONO_TABLE_FIELD_POINTER,
MONO_TABLE_FIELD,
MONO_TABLE_METHOD_POINTER,
MONO_TABLE_METHOD,
MONO_TABLE_PARAM_POINTER,
MONO_TABLE_PARAM,
MONO_TABLE_INTERFACEIMPL,
MONO_TABLE_MEMBERREF, /* 0xa */
MONO_TABLE_CONSTANT,
MONO_TABLE_CUSTOMATTRIBUTE,
MONO_TABLE_FIELDMARSHAL,
MONO_TABLE_DECLSECURITY,
MONO_TABLE_CLASSLAYOUT,
MONO_TABLE_FIELDLAYOUT, /* 0x10 */
MONO_TABLE_STANDALONESIG,
MONO_TABLE_EVENTMAP,
MONO_TABLE_EVENT_POINTER,
MONO_TABLE_EVENT,
MONO_TABLE_PROPERTYMAP,
MONO_TABLE_PROPERTY_POINTER,
MONO_TABLE_PROPERTY,
MONO_TABLE_METHODSEMANTICS,
MONO_TABLE_METHODIMPL,
MONO_TABLE_MODULEREF, /* 0x1a */
MONO_TABLE_TYPESPEC,
MONO_TABLE_IMPLMAP,
MONO_TABLE_FIELDRVA,
MONO_TABLE_ENCLOG,
MONO_TABLE_ENCMAP,
MONO_TABLE_ASSEMBLY, /* 0x20 */
MONO_TABLE_ASSEMBLYPROCESSOR,
MONO_TABLE_ASSEMBLYOS,
MONO_TABLE_ASSEMBLYREF,
MONO_TABLE_ASSEMBLYREFPROCESSOR,
MONO_TABLE_ASSEMBLYREFOS,
MONO_TABLE_FILE,
MONO_TABLE_EXPORTEDTYPE,
MONO_TABLE_MANIFESTRESOURCE,
MONO_TABLE_NESTEDCLASS,
MONO_TABLE_GENERICPARAM, /* 0x2a */
MONO_TABLE_METHODSPEC,
MONO_TABLE_GENERICPARAMCONSTRAINT,
MONO_TABLE_UNUSED8,
MONO_TABLE_UNUSED9,
MONO_TABLE_UNUSED10,
/* Portable PDB tables */
MONO_TABLE_DOCUMENT, /* 0x30 */
MONO_TABLE_METHODBODY,
MONO_TABLE_LOCALSCOPE,
MONO_TABLE_LOCALVARIABLE,
MONO_TABLE_LOCALCONSTANT,
MONO_TABLE_IMPORTSCOPE,
MONO_TABLE_STATEMACHINEMETHOD,
MONO_TABLE_CUSTOMDEBUGINFORMATION
//#define MONO_TABLE_LAST MONO_TABLE_CUSTOMDEBUGINFORMATION
//#define MONO_TABLE_NUM (MONO_TABLE_LAST + 1)
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,349 @@
/* GENERATED FILE, DO NOT EDIT. Edit cil-opcodes.xml instead and run "make opcode.def" to regenerate. */
OPDEF(CEE_NOP, "nop", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0x00, NEXT)
OPDEF(CEE_BREAK, "break", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0x01, ERROR)
OPDEF(CEE_LDARG_0, "ldarg.0", Pop0, Push1, InlineNone, 0, 1, 0xFF, 0x02, NEXT)
OPDEF(CEE_LDARG_1, "ldarg.1", Pop0, Push1, InlineNone, 1, 1, 0xFF, 0x03, NEXT)
OPDEF(CEE_LDARG_2, "ldarg.2", Pop0, Push1, InlineNone, 2, 1, 0xFF, 0x04, NEXT)
OPDEF(CEE_LDARG_3, "ldarg.3", Pop0, Push1, InlineNone, 3, 1, 0xFF, 0x05, NEXT)
OPDEF(CEE_LDLOC_0, "ldloc.0", Pop0, Push1, InlineNone, 0, 1, 0xFF, 0x06, NEXT)
OPDEF(CEE_LDLOC_1, "ldloc.1", Pop0, Push1, InlineNone, 1, 1, 0xFF, 0x07, NEXT)
OPDEF(CEE_LDLOC_2, "ldloc.2", Pop0, Push1, InlineNone, 2, 1, 0xFF, 0x08, NEXT)
OPDEF(CEE_LDLOC_3, "ldloc.3", Pop0, Push1, InlineNone, 3, 1, 0xFF, 0x09, NEXT)
OPDEF(CEE_STLOC_0, "stloc.0", Pop1, Push0, InlineNone, 0, 1, 0xFF, 0x0A, NEXT)
OPDEF(CEE_STLOC_1, "stloc.1", Pop1, Push0, InlineNone, 1, 1, 0xFF, 0x0B, NEXT)
OPDEF(CEE_STLOC_2, "stloc.2", Pop1, Push0, InlineNone, 2, 1, 0xFF, 0x0C, NEXT)
OPDEF(CEE_STLOC_3, "stloc.3", Pop1, Push0, InlineNone, 3, 1, 0xFF, 0x0D, NEXT)
OPDEF(CEE_LDARG_S, "ldarg.s", Pop0, Push1, ShortInlineVar, 0, 1, 0xFF, 0x0E, NEXT)
OPDEF(CEE_LDARGA_S, "ldarga.s", Pop0, PushI, ShortInlineVar, 0, 1, 0xFF, 0x0F, NEXT)
OPDEF(CEE_STARG_S, "starg.s", Pop1, Push0, ShortInlineVar, 0, 1, 0xFF, 0x10, NEXT)
OPDEF(CEE_LDLOC_S, "ldloc.s", Pop0, Push1, ShortInlineVar, 0, 1, 0xFF, 0x11, NEXT)
OPDEF(CEE_LDLOCA_S, "ldloca.s", Pop0, PushI, ShortInlineVar, 0, 1, 0xFF, 0x12, NEXT)
OPDEF(CEE_STLOC_S, "stloc.s", Pop1, Push0, ShortInlineVar, 0, 1, 0xFF, 0x13, NEXT)
OPDEF(CEE_LDNULL, "ldnull", Pop0, PushRef, InlineNone, 0, 1, 0xFF, 0x14, NEXT)
OPDEF(CEE_LDC_I4_M1, "ldc.i4.m1", Pop0, PushI, InlineNone, -1, 1, 0xFF, 0x15, NEXT)
OPDEF(CEE_LDC_I4_0, "ldc.i4.0", Pop0, PushI, InlineNone, 0, 1, 0xFF, 0x16, NEXT)
OPDEF(CEE_LDC_I4_1, "ldc.i4.1", Pop0, PushI, InlineNone, 1, 1, 0xFF, 0x17, NEXT)
OPDEF(CEE_LDC_I4_2, "ldc.i4.2", Pop0, PushI, InlineNone, 2, 1, 0xFF, 0x18, NEXT)
OPDEF(CEE_LDC_I4_3, "ldc.i4.3", Pop0, PushI, InlineNone, 3, 1, 0xFF, 0x19, NEXT)
OPDEF(CEE_LDC_I4_4, "ldc.i4.4", Pop0, PushI, InlineNone, 4, 1, 0xFF, 0x1A, NEXT)
OPDEF(CEE_LDC_I4_5, "ldc.i4.5", Pop0, PushI, InlineNone, 5, 1, 0xFF, 0x1B, NEXT)
OPDEF(CEE_LDC_I4_6, "ldc.i4.6", Pop0, PushI, InlineNone, 6, 1, 0xFF, 0x1C, NEXT)
OPDEF(CEE_LDC_I4_7, "ldc.i4.7", Pop0, PushI, InlineNone, 7, 1, 0xFF, 0x1D, NEXT)
OPDEF(CEE_LDC_I4_8, "ldc.i4.8", Pop0, PushI, InlineNone, 8, 1, 0xFF, 0x1E, NEXT)
OPDEF(CEE_LDC_I4_S, "ldc.i4.s", Pop0, PushI, ShortInlineI, 0, 1, 0xFF, 0x1F, NEXT)
OPDEF(CEE_LDC_I4, "ldc.i4", Pop0, PushI, InlineI, 0, 1, 0xFF, 0x20, NEXT)
OPDEF(CEE_LDC_I8, "ldc.i8", Pop0, PushI8, InlineI8, 0, 1, 0xFF, 0x21, NEXT)
OPDEF(CEE_LDC_R4, "ldc.r4", Pop0, PushR4, ShortInlineR, 0, 1, 0xFF, 0x22, NEXT)
OPDEF(CEE_LDC_R8, "ldc.r8", Pop0, PushR8, InlineR, 0, 1, 0xFF, 0x23, NEXT)
OPDEF(CEE_UNUSED99, "unused99", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0x24, NEXT)
OPDEF(CEE_DUP, "dup", Pop1, Push1+Push1, InlineNone, 0, 1, 0xFF, 0x25, NEXT)
OPDEF(CEE_POP, "pop", Pop1, Push0, InlineNone, 0, 1, 0xFF, 0x26, NEXT)
OPDEF(CEE_JMP, "jmp", Pop0, Push0, InlineMethod, 0, 1, 0xFF, 0x27, CALL)
OPDEF(CEE_CALL, "call", VarPop, VarPush, InlineMethod, 0, 1, 0xFF, 0x28, CALL)
OPDEF(CEE_CALLI, "calli", VarPop, VarPush, InlineSig, 0, 1, 0xFF, 0x29, CALL)
OPDEF(CEE_RET, "ret", VarPop, Push0, InlineNone, 0, 1, 0xFF, 0x2A, RETURN)
OPDEF(CEE_BR_S, "br.s", Pop0, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x2B, BRANCH)
OPDEF(CEE_BRFALSE_S, "brfalse.s", PopI, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x2C, COND_BRANCH)
OPDEF(CEE_BRTRUE_S, "brtrue.s", PopI, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x2D, COND_BRANCH)
OPDEF(CEE_BEQ_S, "beq.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x2E, COND_BRANCH)
OPDEF(CEE_BGE_S, "bge.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x2F, COND_BRANCH)
OPDEF(CEE_BGT_S, "bgt.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x30, COND_BRANCH)
OPDEF(CEE_BLE_S, "ble.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x31, COND_BRANCH)
OPDEF(CEE_BLT_S, "blt.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x32, COND_BRANCH)
OPDEF(CEE_BNE_UN_S, "bne.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x33, COND_BRANCH)
OPDEF(CEE_BGE_UN_S, "bge.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x34, COND_BRANCH)
OPDEF(CEE_BGT_UN_S, "bgt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x35, COND_BRANCH)
OPDEF(CEE_BLE_UN_S, "ble.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x36, COND_BRANCH)
OPDEF(CEE_BLT_UN_S, "blt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0x37, COND_BRANCH)
OPDEF(CEE_BR, "br", Pop0, Push0, InlineBrTarget, 0, 1, 0xFF, 0x38, BRANCH)
OPDEF(CEE_BRFALSE, "brfalse", PopI, Push0, InlineBrTarget, 0, 1, 0xFF, 0x39, COND_BRANCH)
OPDEF(CEE_BRTRUE, "brtrue", PopI, Push0, InlineBrTarget, 0, 1, 0xFF, 0x3A, COND_BRANCH)
OPDEF(CEE_BEQ, "beq", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x3B, COND_BRANCH)
OPDEF(CEE_BGE, "bge", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x3C, COND_BRANCH)
OPDEF(CEE_BGT, "bgt", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x3D, COND_BRANCH)
OPDEF(CEE_BLE, "ble", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x3E, COND_BRANCH)
OPDEF(CEE_BLT, "blt", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x3F, COND_BRANCH)
OPDEF(CEE_BNE_UN, "bne.un", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x40, COND_BRANCH)
OPDEF(CEE_BGE_UN, "bge.un", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x41, COND_BRANCH)
OPDEF(CEE_BGT_UN, "bgt.un", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x42, COND_BRANCH)
OPDEF(CEE_BLE_UN, "ble.un", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x43, COND_BRANCH)
OPDEF(CEE_BLT_UN, "blt.un", Pop1+Pop1, Push0, InlineBrTarget, 0, 1, 0xFF, 0x44, COND_BRANCH)
OPDEF(CEE_SWITCH, "switch", PopI, Push0, InlineSwitch, 0, 1, 0xFF, 0x45, COND_BRANCH)
OPDEF(CEE_LDIND_I1, "ldind.i1", PopI, PushI, InlineNone, 0, 1, 0xFF, 0x46, NEXT)
OPDEF(CEE_LDIND_U1, "ldind.u1", PopI, PushI, InlineNone, 0, 1, 0xFF, 0x47, NEXT)
OPDEF(CEE_LDIND_I2, "ldind.i2", PopI, PushI, InlineNone, 0, 1, 0xFF, 0x48, NEXT)
OPDEF(CEE_LDIND_U2, "ldind.u2", PopI, PushI, InlineNone, 0, 1, 0xFF, 0x49, NEXT)
OPDEF(CEE_LDIND_I4, "ldind.i4", PopI, PushI, InlineNone, 0, 1, 0xFF, 0x4A, NEXT)
OPDEF(CEE_LDIND_U4, "ldind.u4", PopI, PushI, InlineNone, 0, 1, 0xFF, 0x4B, NEXT)
OPDEF(CEE_LDIND_I8, "ldind.i8", PopI, PushI8, InlineNone, 0, 1, 0xFF, 0x4C, NEXT)
OPDEF(CEE_LDIND_I, "ldind.i", PopI, PushI, InlineNone, 0, 1, 0xFF, 0x4D, NEXT)
OPDEF(CEE_LDIND_R4, "ldind.r4", PopI, PushR4, InlineNone, 0, 1, 0xFF, 0x4E, NEXT)
OPDEF(CEE_LDIND_R8, "ldind.r8", PopI, PushR8, InlineNone, 0, 1, 0xFF, 0x4F, NEXT)
OPDEF(CEE_LDIND_REF, "ldind.ref", PopI, PushRef, InlineNone, 0, 1, 0xFF, 0x50, NEXT)
OPDEF(CEE_STIND_REF, "stind.ref", PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x51, NEXT)
OPDEF(CEE_STIND_I1, "stind.i1", PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x52, NEXT)
OPDEF(CEE_STIND_I2, "stind.i2", PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x53, NEXT)
OPDEF(CEE_STIND_I4, "stind.i4", PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x54, NEXT)
OPDEF(CEE_STIND_I8, "stind.i8", PopI+PopI8, Push0, InlineNone, 0, 1, 0xFF, 0x55, NEXT)
OPDEF(CEE_STIND_R4, "stind.r4", PopI+PopR4, Push0, InlineNone, 0, 1, 0xFF, 0x56, NEXT)
OPDEF(CEE_STIND_R8, "stind.r8", PopI+PopR8, Push0, InlineNone, 0, 1, 0xFF, 0x57, NEXT)
OPDEF(CEE_ADD, "add", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x58, NEXT)
OPDEF(CEE_SUB, "sub", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x59, NEXT)
OPDEF(CEE_MUL, "mul", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x5A, NEXT)
OPDEF(CEE_DIV, "div", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x5B, NEXT)
OPDEF(CEE_DIV_UN, "div.un", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x5C, NEXT)
OPDEF(CEE_REM, "rem", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x5D, NEXT)
OPDEF(CEE_REM_UN, "rem.un", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x5E, NEXT)
OPDEF(CEE_AND, "and", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x5F, NEXT)
OPDEF(CEE_OR, "or", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x60, NEXT)
OPDEF(CEE_XOR, "xor", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x61, NEXT)
OPDEF(CEE_SHL, "shl", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x62, NEXT)
OPDEF(CEE_SHR, "shr", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x63, NEXT)
OPDEF(CEE_SHR_UN, "shr.un", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x64, NEXT)
OPDEF(CEE_NEG, "neg", Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x65, NEXT)
OPDEF(CEE_NOT, "not", Pop1, Push1, InlineNone, 0, 1, 0xFF, 0x66, NEXT)
OPDEF(CEE_CONV_I1, "conv.i1", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x67, NEXT)
OPDEF(CEE_CONV_I2, "conv.i2", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x68, NEXT)
OPDEF(CEE_CONV_I4, "conv.i4", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x69, NEXT)
OPDEF(CEE_CONV_I8, "conv.i8", Pop1, PushI8, InlineNone, 0, 1, 0xFF, 0x6A, NEXT)
OPDEF(CEE_CONV_R4, "conv.r4", Pop1, PushR4, InlineNone, 0, 1, 0xFF, 0x6B, NEXT)
OPDEF(CEE_CONV_R8, "conv.r8", Pop1, PushR8, InlineNone, 0, 1, 0xFF, 0x6C, NEXT)
OPDEF(CEE_CONV_U4, "conv.u4", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x6D, NEXT)
OPDEF(CEE_CONV_U8, "conv.u8", Pop1, PushI8, InlineNone, 0, 1, 0xFF, 0x6E, NEXT)
OPDEF(CEE_CALLVIRT, "callvirt", VarPop, VarPush, InlineMethod, 0, 1, 0xFF, 0x6F, CALL)
OPDEF(CEE_CPOBJ, "cpobj", PopI+PopI, Push0, InlineType, 0, 1, 0xFF, 0x70, NEXT)
OPDEF(CEE_LDOBJ, "ldobj", PopI, Push1, InlineType, 0, 1, 0xFF, 0x71, NEXT)
OPDEF(CEE_LDSTR, "ldstr", Pop0, PushRef, InlineString, 0, 1, 0xFF, 0x72, NEXT)
OPDEF(CEE_NEWOBJ, "newobj", VarPop, PushRef, InlineMethod, 0, 1, 0xFF, 0x73, CALL)
OPDEF(CEE_CASTCLASS, "castclass", PopRef, PushRef, InlineType, 0, 1, 0xFF, 0x74, NEXT)
OPDEF(CEE_ISINST, "isinst", PopRef, PushI, InlineType, 0, 1, 0xFF, 0x75, NEXT)
OPDEF(CEE_CONV_R_UN, "conv.r.un", Pop1, PushR8, InlineNone, 0, 1, 0xFF, 0x76, NEXT)
OPDEF(CEE_UNUSED58, "unused58", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0x77, NEXT)
OPDEF(CEE_UNUSED1, "unused1", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0x78, NEXT)
OPDEF(CEE_UNBOX, "unbox", PopRef, PushI, InlineType, 0, 1, 0xFF, 0x79, NEXT)
OPDEF(CEE_THROW, "throw", PopRef, Push0, InlineNone, 0, 1, 0xFF, 0x7A, ERROR)
OPDEF(CEE_LDFLD, "ldfld", PopRef, Push1, InlineField, 0, 1, 0xFF, 0x7B, NEXT)
OPDEF(CEE_LDFLDA, "ldflda", PopRef, PushI, InlineField, 0, 1, 0xFF, 0x7C, NEXT)
OPDEF(CEE_STFLD, "stfld", PopRef+Pop1, Push0, InlineField, 0, 1, 0xFF, 0x7D, NEXT)
OPDEF(CEE_LDSFLD, "ldsfld", Pop0, Push1, InlineField, 0, 1, 0xFF, 0x7E, NEXT)
OPDEF(CEE_LDSFLDA, "ldsflda", Pop0, PushI, InlineField, 0, 1, 0xFF, 0x7F, NEXT)
OPDEF(CEE_STSFLD, "stsfld", Pop1, Push0, InlineField, 0, 1, 0xFF, 0x80, NEXT)
OPDEF(CEE_STOBJ, "stobj", PopI+Pop1, Push0, InlineType, 0, 1, 0xFF, 0x81, NEXT)
OPDEF(CEE_CONV_OVF_I1_UN, "conv.ovf.i1.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x82, NEXT)
OPDEF(CEE_CONV_OVF_I2_UN, "conv.ovf.i2.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x83, NEXT)
OPDEF(CEE_CONV_OVF_I4_UN, "conv.ovf.i4.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x84, NEXT)
OPDEF(CEE_CONV_OVF_I8_UN, "conv.ovf.i8.un", Pop1, PushI8, InlineNone, 0, 1, 0xFF, 0x85, NEXT)
OPDEF(CEE_CONV_OVF_U1_UN, "conv.ovf.u1.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x86, NEXT)
OPDEF(CEE_CONV_OVF_U2_UN, "conv.ovf.u2.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x87, NEXT)
OPDEF(CEE_CONV_OVF_U4_UN, "conv.ovf.u4.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x88, NEXT)
OPDEF(CEE_CONV_OVF_U8_UN, "conv.ovf.u8.un", Pop1, PushI8, InlineNone, 0, 1, 0xFF, 0x89, NEXT)
OPDEF(CEE_CONV_OVF_I_UN, "conv.ovf.i.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x8A, NEXT)
OPDEF(CEE_CONV_OVF_U_UN, "conv.ovf.u.un", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0x8B, NEXT)
OPDEF(CEE_BOX, "box", Pop1, PushRef, InlineType, 0, 1, 0xFF, 0x8C, NEXT)
OPDEF(CEE_NEWARR, "newarr", PopI, PushRef, InlineType, 0, 1, 0xFF, 0x8D, NEXT)
OPDEF(CEE_LDLEN, "ldlen", PopRef, PushI, InlineNone, 0, 1, 0xFF, 0x8E, NEXT)
OPDEF(CEE_LDELEMA, "ldelema", PopRef+PopI, PushI, InlineType, 0, 1, 0xFF, 0x8F, NEXT)
OPDEF(CEE_LDELEM_I1, "ldelem.i1", PopRef+PopI, PushI, InlineNone, 0, 1, 0xFF, 0x90, NEXT)
OPDEF(CEE_LDELEM_U1, "ldelem.u1", PopRef+PopI, PushI, InlineNone, 0, 1, 0xFF, 0x91, NEXT)
OPDEF(CEE_LDELEM_I2, "ldelem.i2", PopRef+PopI, PushI, InlineNone, 0, 1, 0xFF, 0x92, NEXT)
OPDEF(CEE_LDELEM_U2, "ldelem.u2", PopRef+PopI, PushI, InlineNone, 0, 1, 0xFF, 0x93, NEXT)
OPDEF(CEE_LDELEM_I4, "ldelem.i4", PopRef+PopI, PushI, InlineNone, 0, 1, 0xFF, 0x94, NEXT)
OPDEF(CEE_LDELEM_U4, "ldelem.u4", PopRef+PopI, PushI, InlineNone, 0, 1, 0xFF, 0x95, NEXT)
OPDEF(CEE_LDELEM_I8, "ldelem.i8", PopRef+PopI, PushI8, InlineNone, 0, 1, 0xFF, 0x96, NEXT)
OPDEF(CEE_LDELEM_I, "ldelem.i", PopRef+PopI, PushI, InlineNone, 0, 1, 0xFF, 0x97, NEXT)
OPDEF(CEE_LDELEM_R4, "ldelem.r4", PopRef+PopI, PushR4, InlineNone, 0, 1, 0xFF, 0x98, NEXT)
OPDEF(CEE_LDELEM_R8, "ldelem.r8", PopRef+PopI, PushR8, InlineNone, 0, 1, 0xFF, 0x99, NEXT)
OPDEF(CEE_LDELEM_REF, "ldelem.ref", PopRef+PopI, PushRef, InlineNone, 0, 1, 0xFF, 0x9A, NEXT)
OPDEF(CEE_STELEM_I, "stelem.i", PopRef+PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x9B, NEXT)
OPDEF(CEE_STELEM_I1, "stelem.i1", PopRef+PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x9C, NEXT)
OPDEF(CEE_STELEM_I2, "stelem.i2", PopRef+PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x9D, NEXT)
OPDEF(CEE_STELEM_I4, "stelem.i4", PopRef+PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0x9E, NEXT)
OPDEF(CEE_STELEM_I8, "stelem.i8", PopRef+PopI+PopI8, Push0, InlineNone, 0, 1, 0xFF, 0x9F, NEXT)
OPDEF(CEE_STELEM_R4, "stelem.r4", PopRef+PopI+PopR4, Push0, InlineNone, 0, 1, 0xFF, 0xA0, NEXT)
OPDEF(CEE_STELEM_R8, "stelem.r8", PopRef+PopI+PopR8, Push0, InlineNone, 0, 1, 0xFF, 0xA1, NEXT)
OPDEF(CEE_STELEM_REF, "stelem.ref", PopRef+PopI+PopRef, Push0, InlineNone, 0, 1, 0xFF, 0xA2, NEXT)
OPDEF(CEE_LDELEM, "ldelem", PopRef+PopI, Push1, InlineType, 0, 1, 0xFF, 0xA3, NEXT)
OPDEF(CEE_STELEM, "stelem", PopRef+PopI+Pop1, Push0, InlineType, 0, 1, 0xFF, 0xA4, NEXT)
OPDEF(CEE_UNBOX_ANY, "unbox.any", PopRef, Push1, InlineType, 0, 1, 0xFF, 0xA5, NEXT)
OPDEF(CEE_UNUSED5, "unused5", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xA6, NEXT)
OPDEF(CEE_UNUSED6, "unused6", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xA7, NEXT)
OPDEF(CEE_UNUSED7, "unused7", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xA8, NEXT)
OPDEF(CEE_UNUSED8, "unused8", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xA9, NEXT)
OPDEF(CEE_UNUSED9, "unused9", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xAA, NEXT)
OPDEF(CEE_UNUSED10, "unused10", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xAB, NEXT)
OPDEF(CEE_UNUSED11, "unused11", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xAC, NEXT)
OPDEF(CEE_UNUSED12, "unused12", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xAD, NEXT)
OPDEF(CEE_UNUSED13, "unused13", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xAE, NEXT)
OPDEF(CEE_UNUSED14, "unused14", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xAF, NEXT)
OPDEF(CEE_UNUSED15, "unused15", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xB0, NEXT)
OPDEF(CEE_UNUSED16, "unused16", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xB1, NEXT)
OPDEF(CEE_UNUSED17, "unused17", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xB2, NEXT)
OPDEF(CEE_CONV_OVF_I1, "conv.ovf.i1", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xB3, NEXT)
OPDEF(CEE_CONV_OVF_U1, "conv.ovf.u1", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xB4, NEXT)
OPDEF(CEE_CONV_OVF_I2, "conv.ovf.i2", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xB5, NEXT)
OPDEF(CEE_CONV_OVF_U2, "conv.ovf.u2", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xB6, NEXT)
OPDEF(CEE_CONV_OVF_I4, "conv.ovf.i4", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xB7, NEXT)
OPDEF(CEE_CONV_OVF_U4, "conv.ovf.u4", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xB8, NEXT)
OPDEF(CEE_CONV_OVF_I8, "conv.ovf.i8", Pop1, PushI8, InlineNone, 0, 1, 0xFF, 0xB9, NEXT)
OPDEF(CEE_CONV_OVF_U8, "conv.ovf.u8", Pop1, PushI8, InlineNone, 0, 1, 0xFF, 0xBA, NEXT)
OPDEF(CEE_UNUSED50, "unused50", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xBB, NEXT)
OPDEF(CEE_UNUSED18, "unused18", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xBC, NEXT)
OPDEF(CEE_UNUSED19, "unused19", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xBD, NEXT)
OPDEF(CEE_UNUSED20, "unused20", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xBE, NEXT)
OPDEF(CEE_UNUSED21, "unused21", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xBF, NEXT)
OPDEF(CEE_UNUSED22, "unused22", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xC0, NEXT)
OPDEF(CEE_UNUSED23, "unused23", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xC1, NEXT)
OPDEF(CEE_REFANYVAL, "refanyval", Pop1, PushI, InlineType, 0, 1, 0xFF, 0xC2, NEXT)
OPDEF(CEE_CKFINITE, "ckfinite", Pop1, PushR8, InlineNone, 0, 1, 0xFF, 0xC3, NEXT)
OPDEF(CEE_UNUSED24, "unused24", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xC4, NEXT)
OPDEF(CEE_UNUSED25, "unused25", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xC5, NEXT)
OPDEF(CEE_MKREFANY, "mkrefany", PopI, Push1, InlineType, 0, 1, 0xFF, 0xC6, NEXT)
OPDEF(CEE_UNUSED59, "unused59", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xC7, NEXT)
OPDEF(CEE_UNUSED60, "unused60", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xC8, NEXT)
OPDEF(CEE_UNUSED61, "unused61", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xC9, NEXT)
OPDEF(CEE_UNUSED62, "unused62", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xCA, NEXT)
OPDEF(CEE_UNUSED63, "unused63", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xCB, NEXT)
OPDEF(CEE_UNUSED64, "unused64", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xCC, NEXT)
OPDEF(CEE_UNUSED65, "unused65", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xCD, NEXT)
OPDEF(CEE_UNUSED66, "unused66", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xCE, NEXT)
OPDEF(CEE_UNUSED67, "unused67", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xCF, NEXT)
OPDEF(CEE_LDTOKEN, "ldtoken", Pop0, PushI, InlineTok, 0, 1, 0xFF, 0xD0, NEXT)
OPDEF(CEE_CONV_U2, "conv.u2", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xD1, NEXT)
OPDEF(CEE_CONV_U1, "conv.u1", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xD2, NEXT)
OPDEF(CEE_CONV_I, "conv.i", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xD3, NEXT)
OPDEF(CEE_CONV_OVF_I, "conv.ovf.i", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xD4, NEXT)
OPDEF(CEE_CONV_OVF_U, "conv.ovf.u", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xD5, NEXT)
OPDEF(CEE_ADD_OVF, "add.ovf", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0xD6, NEXT)
OPDEF(CEE_ADD_OVF_UN, "add.ovf.un", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0xD7, NEXT)
OPDEF(CEE_MUL_OVF, "mul.ovf", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0xD8, NEXT)
OPDEF(CEE_MUL_OVF_UN, "mul.ovf.un", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0xD9, NEXT)
OPDEF(CEE_SUB_OVF, "sub.ovf", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0xDA, NEXT)
OPDEF(CEE_SUB_OVF_UN, "sub.ovf.un", Pop1+Pop1, Push1, InlineNone, 0, 1, 0xFF, 0xDB, NEXT)
OPDEF(CEE_ENDFINALLY, "endfinally", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xDC, RETURN)
OPDEF(CEE_LEAVE, "leave", Pop0, Push0, InlineBrTarget, 0, 1, 0xFF, 0xDD, BRANCH)
OPDEF(CEE_LEAVE_S, "leave.s", Pop0, Push0, ShortInlineBrTarget, 0, 1, 0xFF, 0xDE, BRANCH)
OPDEF(CEE_STIND_I, "stind.i", PopI+PopI, Push0, InlineNone, 0, 1, 0xFF, 0xDF, NEXT)
OPDEF(CEE_CONV_U, "conv.u", Pop1, PushI, InlineNone, 0, 1, 0xFF, 0xE0, NEXT)
OPDEF(CEE_UNUSED26, "unused26", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE1, NEXT)
OPDEF(CEE_UNUSED27, "unused27", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE2, NEXT)
OPDEF(CEE_UNUSED28, "unused28", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE3, NEXT)
OPDEF(CEE_UNUSED29, "unused29", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE4, NEXT)
OPDEF(CEE_UNUSED30, "unused30", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE5, NEXT)
OPDEF(CEE_UNUSED31, "unused31", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE6, NEXT)
OPDEF(CEE_UNUSED32, "unused32", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE7, NEXT)
OPDEF(CEE_UNUSED33, "unused33", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE8, NEXT)
OPDEF(CEE_UNUSED34, "unused34", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xE9, NEXT)
OPDEF(CEE_UNUSED35, "unused35", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xEA, NEXT)
OPDEF(CEE_UNUSED36, "unused36", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xEB, NEXT)
OPDEF(CEE_UNUSED37, "unused37", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xEC, NEXT)
OPDEF(CEE_UNUSED38, "unused38", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xED, NEXT)
OPDEF(CEE_UNUSED39, "unused39", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xEE, NEXT)
OPDEF(CEE_UNUSED40, "unused40", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xEF, NEXT)
OPDEF(CEE_UNUSED41, "unused41", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF0, NEXT)
OPDEF(CEE_UNUSED42, "unused42", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF1, NEXT)
OPDEF(CEE_UNUSED43, "unused43", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF2, NEXT)
OPDEF(CEE_UNUSED44, "unused44", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF3, NEXT)
OPDEF(CEE_UNUSED45, "unused45", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF4, NEXT)
OPDEF(CEE_UNUSED46, "unused46", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF5, NEXT)
OPDEF(CEE_UNUSED47, "unused47", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF6, NEXT)
OPDEF(CEE_UNUSED48, "unused48", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF7, NEXT)
OPDEF(CEE_PREFIX7, "prefix7", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF8, META)
OPDEF(CEE_PREFIX6, "prefix6", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xF9, META)
OPDEF(CEE_PREFIX5, "prefix5", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xFA, META)
OPDEF(CEE_PREFIX4, "prefix4", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xFB, META)
OPDEF(CEE_PREFIX3, "prefix3", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xFC, META)
OPDEF(CEE_PREFIX2, "prefix2", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xFD, META)
OPDEF(CEE_PREFIX1, "prefix1", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xFE, META)
OPDEF(CEE_PREFIXREF, "prefixref", Pop0, Push0, InlineNone, 0, 1, 0xFF, 0xFF, META)
OPDEF(CEE_ARGLIST, "arglist", Pop0, PushI, InlineNone, 0, 2, 0xFE, 0x00, NEXT)
OPDEF(CEE_CEQ, "ceq", Pop1+Pop1, PushI, InlineNone, 0, 2, 0xFE, 0x01, NEXT)
OPDEF(CEE_CGT, "cgt", Pop1+Pop1, PushI, InlineNone, 0, 2, 0xFE, 0x02, NEXT)
OPDEF(CEE_CGT_UN, "cgt.un", Pop1+Pop1, PushI, InlineNone, 0, 2, 0xFE, 0x03, NEXT)
OPDEF(CEE_CLT, "clt", Pop1+Pop1, PushI, InlineNone, 0, 2, 0xFE, 0x04, NEXT)
OPDEF(CEE_CLT_UN, "clt.un", Pop1+Pop1, PushI, InlineNone, 0, 2, 0xFE, 0x05, NEXT)
OPDEF(CEE_LDFTN, "ldftn", Pop0, PushI, InlineMethod, 0, 2, 0xFE, 0x06, NEXT)
OPDEF(CEE_LDVIRTFTN, "ldvirtftn", PopRef, PushI, InlineMethod, 0, 2, 0xFE, 0x07, NEXT)
OPDEF(CEE_UNUSED56, "unused56", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x08, NEXT)
OPDEF(CEE_LDARG, "ldarg", Pop0, Push1, InlineVar, 0, 2, 0xFE, 0x09, NEXT)
OPDEF(CEE_LDARGA, "ldarga", Pop0, PushI, InlineVar, 0, 2, 0xFE, 0x0A, NEXT)
OPDEF(CEE_STARG, "starg", Pop1, Push0, InlineVar, 0, 2, 0xFE, 0x0B, NEXT)
OPDEF(CEE_LDLOC, "ldloc", Pop0, Push1, InlineVar, 0, 2, 0xFE, 0x0C, NEXT)
OPDEF(CEE_LDLOCA, "ldloca", Pop0, PushI, InlineVar, 0, 2, 0xFE, 0x0D, NEXT)
OPDEF(CEE_STLOC, "stloc", Pop1, Push0, InlineVar, 0, 2, 0xFE, 0x0E, NEXT)
OPDEF(CEE_LOCALLOC, "localloc", PopI, PushI, InlineNone, 0, 2, 0xFE, 0x0F, NEXT)
OPDEF(CEE_UNUSED57, "unused57", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x10, NEXT)
OPDEF(CEE_ENDFILTER, "endfilter", PopI, Push0, InlineNone, 0, 2, 0xFE, 0x11, RETURN)
OPDEF(CEE_UNALIGNED_, "unaligned.", Pop0, Push0, ShortInlineI, 0, 2, 0xFE, 0x12, META)
OPDEF(CEE_VOLATILE_, "volatile.", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x13, META)
OPDEF(CEE_TAIL_, "tail.", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x14, META)
OPDEF(CEE_INITOBJ, "initobj", PopI, Push0, InlineType, 0, 2, 0xFE, 0x15, NEXT)
OPDEF(CEE_CONSTRAINED_, "constrained.", Pop0, Push0, InlineType, 0, 2, 0xFE, 0x16, META)
OPDEF(CEE_CPBLK, "cpblk", PopI+PopI+PopI, Push0, InlineNone, 0, 2, 0xFE, 0x17, NEXT)
OPDEF(CEE_INITBLK, "initblk", PopI+PopI+PopI, Push0, InlineNone, 0, 2, 0xFE, 0x18, NEXT)
OPDEF(CEE_NO_, "no.", Pop0, Push0, ShortInlineI, 0, 2, 0xFE, 0x19, NEXT)
OPDEF(CEE_RETHROW, "rethrow", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x1A, ERROR)
OPDEF(CEE_UNUSED, "unused", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x1B, NEXT)
OPDEF(CEE_SIZEOF, "sizeof", Pop0, PushI, InlineType, 0, 2, 0xFE, 0x1C, NEXT)
OPDEF(CEE_REFANYTYPE, "refanytype", Pop1, PushI, InlineNone, 0, 2, 0xFE, 0x1D, NEXT)
OPDEF(CEE_READONLY_, "readonly.", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x1E, META)
OPDEF(CEE_UNUSED53, "unused53", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x1F, NEXT)
OPDEF(CEE_UNUSED54, "unused54", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x20, NEXT)
OPDEF(CEE_UNUSED55, "unused55", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x21, NEXT)
OPDEF(CEE_UNUSED70, "unused70", Pop0, Push0, InlineNone, 0, 2, 0xFE, 0x22, NEXT)
OPDEF(CEE_ILLEGAL, "illegal", Pop0, Push0, InlineNone, 0, 2, 0x00, 0x00, META)
OPDEF(CEE_ENDMAC, "endmac", Pop0, Push0, InlineNone, 0, 2, 0x00, 0x00, META)
OPDEF(CEE_MONO_ICALL, "mono_icall", VarPop, VarPush, InlineI, 0, 2, 0xF0, 0x00, NEXT)
OPDEF(CEE_MONO_OBJADDR, "mono_objaddr", Pop1, PushI, InlineNone, 0, 2, 0xF0, 0x01, NEXT)
OPDEF(CEE_MONO_LDPTR, "mono_ldptr", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x02, NEXT)
OPDEF(CEE_MONO_VTADDR, "mono_vtaddr", Pop1, PushI, InlineNone, 0, 2, 0xF0, 0x03, NEXT)
OPDEF(CEE_MONO_NEWOBJ, "mono_newobj", Pop0, PushRef, InlineType, 0, 2, 0xF0, 0x04, NEXT)
OPDEF(CEE_MONO_RETOBJ, "mono_retobj", PopI, Push0, InlineType, 0, 2, 0xF0, 0x05, RETURN)
OPDEF(CEE_MONO_LDNATIVEOBJ, "mono_ldnativeobj", PopI, Push1, InlineType, 0, 2, 0xF0, 0x06, RETURN)
OPDEF(CEE_MONO_CISINST, "mono_cisinst", PopRef, Push1, InlineType, 0, 2, 0xF0, 0x07, NEXT)
OPDEF(CEE_MONO_CCASTCLASS, "mono_ccastclass", PopRef, Push1, InlineType, 0, 2, 0xF0, 0x08, NEXT)
OPDEF(CEE_MONO_SAVE_LMF, "mono_save_lmf", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x09, NEXT)
OPDEF(CEE_MONO_RESTORE_LMF, "mono_restore_lmf", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x0A, NEXT)
OPDEF(CEE_MONO_CLASSCONST, "mono_classconst", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x0B, NEXT)
OPDEF(CEE_MONO_NOT_TAKEN, "mono_not_taken", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x0C, NEXT)
OPDEF(CEE_MONO_TLS, "mono_tls", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x0D, NEXT)
OPDEF(CEE_MONO_ICALL_ADDR, "mono_icall_addr", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x0E, NEXT)
OPDEF(CEE_MONO_DYN_CALL, "mono_dyn_call", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x0F, NEXT)
OPDEF(CEE_MONO_MEMORY_BARRIER, "mono_memory_barrier", Pop0, Push0, InlineI, 0, 2, 0xF0, 0x10, NEXT)
OPDEF(CEE_UNUSED71, "unused71", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x11, NEXT)
OPDEF(CEE_UNUSED72, "unused72", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x12, NEXT)
OPDEF(CEE_MONO_JIT_ICALL_ADDR, "mono_jit_icall_addr", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x13, NEXT)
OPDEF(CEE_MONO_LDPTR_INT_REQ_FLAG, "mono_ldptr_int_req_flag", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x14, NEXT)
OPDEF(CEE_MONO_LDPTR_CARD_TABLE, "mono_ldptr_card_table", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x15, NEXT)
OPDEF(CEE_MONO_LDPTR_NURSERY_START, "mono_ldptr_nursery_start", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x16, NEXT)
OPDEF(CEE_MONO_LDPTR_NURSERY_BITS, "mono_ldptr_nursery_bits", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x17, NEXT)
OPDEF(CEE_MONO_CALLI_EXTRA_ARG, "mono_calli_extra_arg", VarPop, VarPush, InlineSig, 0, 2, 0xF0, 0x18, CALL)
OPDEF(CEE_MONO_LDDOMAIN, "mono_lddomain", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x19, NEXT)
OPDEF(CEE_MONO_ATOMIC_STORE_I4, "mono_atomic_store_i4", PopI+PopI, Push0, InlineI, 0, 2, 0xF0, 0x1A, NEXT)
OPDEF(CEE_MONO_SAVE_LAST_ERROR, "mono_save_last_error", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x1B, NEXT)
OPDEF(CEE_MONO_GET_RGCTX_ARG, "mono_get_rgctx_arg", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x1C, NEXT)
OPDEF(CEE_MONO_LDPTR_PROFILER_ALLOCATION_COUNT, "mono_ldptr_profiler_allocation_count", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x1D, NEXT)
OPDEF(CEE_MONO_LD_DELEGATE_METHOD_PTR, "mono_ld_delegate_method_ptr", Pop1, PushI, InlineNone, 0, 2, 0xF0, 0x1E, NEXT)
OPDEF(CEE_MONO_RETHROW, "mono_rethrow", PopRef, Push0, InlineNone, 0, 2, 0xF0, 0x1F, ERROR)
OPDEF(CEE_MONO_GET_SP, "mono_get_sp", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x20, NEXT)
OPDEF(CEE_MONO_METHODCONST, "mono_methodconst", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x21, NEXT)
OPDEF(CEE_MONO_PINVOKE_ADDR_CACHE, "mono_pinvoke_addr_cache", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x22, NEXT)
#ifndef OPALIAS
#define _MONO_CIL_OPALIAS_DEFINED_
#define OPALIAS(a,s,r)
#endif
OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE)
OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S)
OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE)
OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S)
OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE)
OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S)
OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8)
OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8)
OPALIAS(CEE_LDX_I4_MIX, "ldc.i4.M1", CEE_LDC_I4_M1)
OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY)
#ifdef _MONO_CIL_OPALIAS_DEFINED_
#undef OPALIAS
#undef _MONO_CIL_OPALIAS_DEFINED_
#endif
+120
View File
@@ -0,0 +1,120 @@
/**
* \file
* Author:
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2001, 2002, 2003 Ximian, Inc.
*/
#ifndef _MONO_JIT_JIT_H_
#define _MONO_JIT_JIT_H_
#include <mono/metadata/appdomain.h>
MONO_BEGIN_DECLS
MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain *
mono_jit_init (const char *file);
MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain *
mono_jit_init_version (const char *root_domain_name, const char *runtime_version);
MONO_API MonoDomain *
mono_jit_init_version_for_test_only (const char *root_domain_name, const char *runtime_version);
MONO_API int
mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly,
int argc, char *argv[]);
MONO_API void
mono_jit_cleanup (MonoDomain *domain);
MONO_API mono_bool
mono_jit_set_trace_options (const char* options);
MONO_API void
mono_set_signal_chaining (mono_bool chain_signals);
MONO_API void
mono_set_crash_chaining (mono_bool chain_signals);
/**
* This function is deprecated, use mono_jit_set_aot_mode instead.
*/
MONO_API void
mono_jit_set_aot_only (mono_bool aot_only);
/**
* Allows control over our AOT (Ahead-of-time) compilation mode.
*/
typedef enum {
/* Disables AOT mode */
MONO_AOT_MODE_NONE,
/* Enables normal AOT mode, equivalent to mono_jit_set_aot_only (false) */
MONO_AOT_MODE_NORMAL,
/* Enables hybrid AOT mode, JIT can still be used for wrappers */
MONO_AOT_MODE_HYBRID,
/* Enables full AOT mode, JIT is disabled and not allowed,
* equivalent to mono_jit_set_aot_only (true) */
MONO_AOT_MODE_FULL,
/* Same as full, but use only llvm compiled code */
MONO_AOT_MODE_LLVMONLY,
/* Uses Interpreter, JIT is disabled and not allowed,
* equivalent to "--full-aot --interpreter" */
MONO_AOT_MODE_INTERP,
/* Same as INTERP, but use only llvm compiled code */
MONO_AOT_MODE_INTERP_LLVMONLY,
/* Use only llvm compiled code, fall back to the interpeter */
MONO_AOT_MODE_LLVMONLY_INTERP,
/* Same as --interp */
MONO_AOT_MODE_INTERP_ONLY,
/* Sentinel value used internally by the runtime. We use a large number to avoid clashing with some internal values. */
MONO_AOT_MODE_LAST = 1000,
} MonoAotMode;
MONO_API void
mono_jit_set_aot_mode (MonoAotMode mode);
/*
* Returns whether the runtime was invoked for the purpose of AOT-compiling an
* assembly, i.e. no managed code will run.
*/
MONO_API mono_bool
mono_jit_aot_compiling (void);
/* Allow embedders to decide wherther to actually obey breakpoint instructions
* in specific methods (works for both break IL instructions and Debugger.Break ()
* method calls).
*/
typedef enum {
/* the default is to always obey the breakpoint */
MONO_BREAK_POLICY_ALWAYS,
/* a nop is inserted instead of a breakpoint */
MONO_BREAK_POLICY_NEVER,
/* the breakpoint is executed only if the program has ben started under
* the debugger (that is if a debugger was attached at the time the method
* was compiled).
*/
MONO_BREAK_POLICY_ON_DBG
} MonoBreakPolicy;
typedef MonoBreakPolicy (*MonoBreakPolicyFunc) (MonoMethod *method);
MONO_API void mono_set_break_policy (MonoBreakPolicyFunc policy_callback);
MONO_API void
mono_jit_parse_options (int argc, char * argv[]);
MONO_API char* mono_get_runtime_build_info (void);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_set_use_llvm (mono_bool use_llvm);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_aot_register_module (void **aot_info);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoDomain* mono_jit_thread_attach (MonoDomain *domain);
MONO_END_DECLS
#endif
@@ -0,0 +1,39 @@
/**
* \file
*
* Private unstable APIs.
*
* WARNING: The declarations and behavior of functions in this header are NOT STABLE and can be modified or removed at
* any time.
*
*/
#ifndef __MONO_JIT_MONO_PRIVATE_UNSTABLE_H__
#define __MONO_JIT_MONO_PRIVATE_UNSTABLE_H__
#include <mono/utils/mono-publib.h>
#include <mono/metadata/image.h>
/* These are used to load the AOT data for aot images compiled with MONO_AOT_FILE_FLAG_SEPARATE_DATA */
/*
* Return the AOT data for ASSEMBLY. SIZE is the size of the data. OUT_HANDLE should be set to a handle which is later
* passed to the free function.
*/
typedef unsigned char* (*MonoLoadAotDataFunc) (MonoAssembly *assembly, int size, void* user_data, void **out_handle);
/* Not yet used */
typedef void (*MonoFreeAotDataFunc) (MonoAssembly *assembly, int size, void* user_data, void *handle);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_install_load_aot_data_hook (MonoLoadAotDataFunc load_func, MonoFreeAotDataFunc free_func, void* user_data);
MONO_API int
monovm_initialize (int propertyCount, const char **propertyKeys, const char **propertyValues);
//#ifdef HOST_WASM
typedef void* (*MonoWasmGetNativeToInterpTramp) (MonoMethod *method, void *extra_arg);
MONO_API void
mono_wasm_install_get_native_to_interp_tramp (MonoWasmGetNativeToInterpTramp cb);
//#endif
#endif /*__MONO_JIT_MONO_PRIVATE_UNSTABLE_H__*/
@@ -0,0 +1,234 @@
/**
* \file
* AppDomain functions
*
* Author:
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2001 Ximian, Inc.
*/
#ifndef _MONO_METADATA_APPDOMAIN_H_
#define _MONO_METADATA_APPDOMAIN_H_
#include <mono/utils/mono-publib.h>
#include <mono/utils/mono-forward.h>
#include <mono/metadata/object.h>
#include <mono/metadata/reflection.h>
MONO_BEGIN_DECLS
typedef void (*MonoThreadStartCB) (intptr_t tid, void* stack_start,
void* func);
typedef void (*MonoThreadAttachCB) (intptr_t tid, void* stack_start);
typedef struct _MonoAppDomain MonoAppDomain;
typedef void (*MonoDomainFunc) (MonoDomain *domain, void* user_data);
MONO_API MonoDomain*
mono_init (const char *filename);
MONO_API MonoDomain *
mono_init_from_assembly (const char *domain_name, const char *filename);
MONO_API MonoDomain *
mono_init_version (const char *domain_name, const char *version);
MONO_API MonoDomain*
mono_get_root_domain (void);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb,
MonoThreadAttachCB attach_cb);
MONO_API void
mono_runtime_cleanup (MonoDomain *domain);
MONO_API void
mono_install_runtime_cleanup (MonoDomainFunc func);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_runtime_quit (void);
MONO_API void
mono_runtime_set_shutting_down (void);
MONO_API mono_bool
mono_runtime_is_shutting_down (void);
MONO_API const char*
mono_check_corlib_version (void);
MONO_API MonoDomain *
mono_domain_create (void);
MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain *
mono_domain_create_appdomain (char *friendly_name, char *configuration_file);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_domain_set_config (MonoDomain *domain, const char *base_dir, const char *config_file_name);
MONO_API MonoDomain *
mono_domain_get (void);
MONO_API MonoDomain *
mono_domain_get_by_id (int32_t domainid);
MONO_API int32_t
mono_domain_get_id (MonoDomain *domain);
MONO_API const char *
mono_domain_get_friendly_name (MonoDomain *domain);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_domain_set (MonoDomain *domain, mono_bool force);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_domain_set_internal (MonoDomain *domain);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_domain_unload (MonoDomain *domain);
MONO_API void
mono_domain_try_unload (MonoDomain *domain, MonoObject **exc);
MONO_API mono_bool
mono_domain_is_unloading (MonoDomain *domain);
MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain *
mono_domain_from_appdomain (MonoAppDomain *appdomain);
MONO_API void
mono_domain_foreach (MonoDomainFunc func, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY MonoAssembly *
mono_domain_assembly_open (MonoDomain *domain, const char *name);
MONO_API void
mono_domain_ensure_entry_assembly (MonoDomain *domain, MonoAssembly *assembly);
MONO_API mono_bool
mono_domain_finalize (MonoDomain *domain, uint32_t timeout);
MONO_API void
mono_domain_free (MonoDomain *domain, mono_bool force);
MONO_API mono_bool
mono_domain_has_type_resolve (MonoDomain *domain);
MONO_API MONO_RT_EXTERNAL_ONLY MonoReflectionAssembly *
mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb);
MONO_API mono_bool
mono_domain_owns_vtable_slot (MonoDomain *domain, void* vtable_slot);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_context_init (MonoDomain *domain);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_context_set (MonoAppContext *new_context);
MONO_API MonoAppContext *
mono_context_get (void);
MONO_API int32_t
mono_context_get_id (MonoAppContext *context);
MONO_API int32_t
mono_context_get_domain_id (MonoAppContext *context);
MONO_API MonoJitInfo *
mono_jit_info_table_find (MonoDomain *domain, void* addr);
/* MonoJitInfo accessors */
MONO_API void*
mono_jit_info_get_code_start (MonoJitInfo* ji);
MONO_API int
mono_jit_info_get_code_size (MonoJitInfo* ji);
MONO_API MonoMethod*
mono_jit_info_get_method (MonoJitInfo* ji);
MONO_API MonoImage*
mono_get_corlib (void);
MONO_API MonoClass*
mono_get_object_class (void);
MONO_API MonoClass*
mono_get_byte_class (void);
MONO_API MonoClass*
mono_get_void_class (void);
MONO_API MonoClass*
mono_get_boolean_class (void);
MONO_API MonoClass*
mono_get_sbyte_class (void);
MONO_API MonoClass*
mono_get_int16_class (void);
MONO_API MonoClass*
mono_get_uint16_class (void);
MONO_API MonoClass*
mono_get_int32_class (void);
MONO_API MonoClass*
mono_get_uint32_class (void);
MONO_API MonoClass*
mono_get_intptr_class (void);
MONO_API MonoClass*
mono_get_uintptr_class (void);
MONO_API MonoClass*
mono_get_int64_class (void);
MONO_API MonoClass*
mono_get_uint64_class (void);
MONO_API MonoClass*
mono_get_single_class (void);
MONO_API MonoClass*
mono_get_double_class (void);
MONO_API MonoClass*
mono_get_char_class (void);
MONO_API MonoClass*
mono_get_string_class (void);
MONO_API MonoClass*
mono_get_enum_class (void);
MONO_API MonoClass*
mono_get_array_class (void);
MONO_API MonoClass*
mono_get_thread_class (void);
MONO_API MonoClass*
mono_get_exception_class (void);
MONO_API void
mono_security_enable_core_clr (void);
typedef mono_bool (*MonoCoreClrPlatformCB) (const char *image_name);
MONO_API void
mono_security_set_core_clr_platform_callback (MonoCoreClrPlatformCB callback);
MONO_END_DECLS
#endif /* _MONO_METADATA_APPDOMAIN_H_ */
@@ -0,0 +1,136 @@
/**
* \file
*/
#ifndef _MONONET_METADATA_ASSEMBLY_H_
#define _MONONET_METADATA_ASSEMBLY_H_
#include <mono/utils/mono-error.h>
#include <mono/metadata/image.h>
MONO_BEGIN_DECLS
MONO_API void mono_assemblies_init (void);
MONO_API void mono_assemblies_cleanup (void);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly *mono_assembly_open (const char *filename,
MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly *mono_assembly_open_full (const char *filename,
MonoImageOpenStatus *status,
mono_bool refonly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_load (MonoAssemblyName *aname,
const char *basedir,
MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_load_full (MonoAssemblyName *aname,
const char *basedir,
MonoImageOpenStatus *status,
mono_bool refonly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_load_from (MonoImage *image, const char *fname,
MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_load_from_full (MonoImage *image, const char *fname,
MonoImageOpenStatus *status,
mono_bool refonly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_load_with_partial_name (const char *name, MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_loaded (MonoAssemblyName *aname);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_loaded_full (MonoAssemblyName *aname, mono_bool refonly);
MONO_API void mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname);
MONO_API void mono_assembly_load_reference (MonoImage *image, int index);
MONO_API void mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY MonoImage* mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx);
MONO_API void mono_assembly_close (MonoAssembly *assembly);
MONO_API void mono_assembly_setrootdir (const char *root_dir);
MONO_API MONO_CONST_RETURN char *mono_assembly_getrootdir (void);
MONO_API char *mono_native_getrootdir (void);
MONO_API void mono_assembly_foreach (MonoFunc func, void* user_data);
MONO_API void mono_assembly_set_main (MonoAssembly *assembly);
MONO_API MonoAssembly *mono_assembly_get_main (void);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_assembly_get_image (MonoAssembly *assembly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssemblyName *mono_assembly_get_name (MonoAssembly *assembly);
MONO_API mono_bool mono_assembly_fill_assembly_name (MonoImage *image, MonoAssemblyName *aname);
MONO_API mono_bool mono_assembly_names_equal (MonoAssemblyName *l, MonoAssemblyName *r);
MONO_API char* mono_stringify_assembly_name (MonoAssemblyName *aname);
/* Installs a function which is called each time a new assembly is loaded. */
typedef void (*MonoAssemblyLoadFunc) (MonoAssembly *assembly, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_install_assembly_load_hook (MonoAssemblyLoadFunc func, void* user_data);
/*
* Installs a new function which is used to search the list of loaded
* assemblies for a given assembly name.
*/
typedef MonoAssembly *(*MonoAssemblySearchFunc) (MonoAssemblyName *aname, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY
void mono_install_assembly_search_hook (MonoAssemblySearchFunc func, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY
void mono_install_assembly_refonly_search_hook (MonoAssemblySearchFunc func, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoAssembly* mono_assembly_invoke_search_hook (MonoAssemblyName *aname);
/*
* Installs a new search function which is used as a last resort when loading
* an assembly fails. This could invoke AssemblyResolve events.
*/
MONO_API MONO_RT_EXTERNAL_ONLY
void
mono_install_assembly_postload_search_hook (MonoAssemblySearchFunc func, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY
void
mono_install_assembly_postload_refonly_search_hook (MonoAssemblySearchFunc func, void* user_data);
/* Installs a function which is called before a new assembly is loaded
* The hook are invoked from last hooked to first. If any of them returns
* a non-null value, that will be the value returned in mono_assembly_load */
typedef MonoAssembly * (*MonoAssemblyPreLoadFunc) (MonoAssemblyName *aname,
char **assemblies_path,
void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY
void mono_install_assembly_preload_hook (MonoAssemblyPreLoadFunc func, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY
void mono_install_assembly_refonly_preload_hook (MonoAssemblyPreLoadFunc func, void* user_data);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_assembly_invoke_load_hook (MonoAssembly *ass);
MONO_API MonoAssemblyName* mono_assembly_name_new (const char *name);
MONO_API const char* mono_assembly_name_get_name (MonoAssemblyName *aname);
MONO_API const char* mono_assembly_name_get_culture (MonoAssemblyName *aname);
MONO_API uint16_t mono_assembly_name_get_version (MonoAssemblyName *aname,
uint16_t *minor, uint16_t *build, uint16_t *revision);
MONO_API mono_byte* mono_assembly_name_get_pubkeytoken (MonoAssemblyName *aname);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_assembly_name_free (MonoAssemblyName *aname);
typedef struct {
const char *name;
const unsigned char *data;
unsigned int size;
} MonoBundledAssembly;
MONO_API void mono_register_bundled_assemblies (const MonoBundledAssembly **assemblies);
MONO_API void mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);
MONO_API void mono_register_symfile_for_assembly (const char* assembly_name, const mono_byte *raw_contents, int size);
MONO_API void mono_register_machine_config (const char *config_xml);
MONO_API void mono_set_rootdir (void);
MONO_API void mono_set_dirs (const char *assembly_dir, const char *config_dir);
MONO_API void mono_set_assemblies_path (const char* path);
MONO_END_DECLS
#endif
@@ -0,0 +1,274 @@
/**
* \file
* This file contains the various definitions for constants
* found on the metadata tables
*
* Author:
* Miguel de Icaza (miguel@ximian.com)
* Paolo Molaro (lupus@ximian.com)
*
* (C) 2001 Ximian, Inc.
* (C) 2006 Novell, Inc.
*
* From the ECMA documentation
*/
#ifndef _MONO_METADATA_ATTRDEFS_H_
#define _MONO_METADATA_ATTRDEFS_H_
/*
* 23.1.1 Values for AssemblyHashAlgorithm
*/
enum {
MONO_ASSEMBLY_HASH_NONE,
MONO_ASSEMBLY_HASH_MD5 = 0x8003,
MONO_ASSEMBLY_HASH_SHA1 = 0x8004
};
/*
* 23.1.2 AssemblyRefs
*/
enum {
MONO_ASSEMBLYREF_FULL_PUBLIC_KEY = 0x0001,
MONO_ASSEMBLYREF_RETARGETABLE = 0x0100,
MONO_ASSEMBLYREF_JIT_TRACKING = 0x8000,
MONO_ASSEMBLYREF_NO_JIT_OPT = 0x4000
};
/*
* 23.1.4 Flags for Event.EventAttributes
*/
enum {
MONO_EVENT_SPECIALNAME = 0x0200,
MONO_EVENT_RTSPECIALNAME = 0x0400
};
/*
* Field Attributes (23.1.5).
*/
enum {
MONO_FIELD_ATTR_FIELD_ACCESS_MASK = 0x0007,
MONO_FIELD_ATTR_COMPILER_CONTROLLED = 0x0000,
MONO_FIELD_ATTR_PRIVATE = 0x0001,
MONO_FIELD_ATTR_FAM_AND_ASSEM = 0x0002,
MONO_FIELD_ATTR_ASSEMBLY = 0x0003,
MONO_FIELD_ATTR_FAMILY = 0x0004,
MONO_FIELD_ATTR_FAM_OR_ASSEM = 0x0005,
MONO_FIELD_ATTR_PUBLIC = 0x0006,
MONO_FIELD_ATTR_STATIC = 0x0010,
MONO_FIELD_ATTR_INIT_ONLY = 0x0020,
MONO_FIELD_ATTR_LITERAL = 0x0040,
MONO_FIELD_ATTR_NOT_SERIALIZED = 0x0080,
MONO_FIELD_ATTR_SPECIAL_NAME = 0x0200,
MONO_FIELD_ATTR_PINVOKE_IMPL = 0x2000,
/* For runtime use only */
MONO_FIELD_ATTR_RESERVED_MASK = 0x9500,
MONO_FIELD_ATTR_RT_SPECIAL_NAME = 0x0400,
MONO_FIELD_ATTR_HAS_MARSHAL = 0x1000,
MONO_FIELD_ATTR_HAS_DEFAULT = 0x8000,
MONO_FIELD_ATTR_HAS_RVA = 0x0100
};
/*
* 23.1.6 Flags for FileAttributes
*/
enum {
MONO_FILE_HAS_METADATA = 0,
MONO_FILE_HAS_NO_METADATA = 1
};
/*
* 23.1.7 Flags for generic parameters
*/
enum {
MONO_GEN_PARAM_VARIANCE_MASK = 0x0003,
MONO_GEN_PARAM_NON_VARIANT = 0x0000,
MONO_GEN_PARAM_VARIANT = 0x0001,
MONO_GEN_PARAM_COVARIANT = 0x0002,
MONO_GEN_PARAM_CONSTRAINT_MASK = 0x001c,
MONO_GEN_PARAM_CONSTRAINT_CLASS = 0x0004,
MONO_GEN_PARAM_CONSTRAINT_VTYPE = 0x0008,
MONO_GEN_PARAM_CONSTRAINT_DCTOR = 0x0010
};
/*
* 23.1.8 Flags for ImplMap [PInvokeAttributes]
*/
enum {
MONO_PINVOKE_NO_MANGLE = 0x0001,
MONO_PINVOKE_CHAR_SET_MASK = 0x0006,
MONO_PINVOKE_CHAR_SET_NOT_SPEC = 0x0000,
MONO_PINVOKE_CHAR_SET_ANSI = 0x0002,
MONO_PINVOKE_CHAR_SET_UNICODE = 0x0004,
MONO_PINVOKE_CHAR_SET_AUTO = 0x0006,
MONO_PINVOKE_BEST_FIT_ENABLED = 0x0010,
MONO_PINVOKE_BEST_FIT_DISABLED = 0x0020,
MONO_PINVOKE_BEST_FIT_MASK = 0x0030,
MONO_PINVOKE_SUPPORTS_LAST_ERROR = 0x0040,
MONO_PINVOKE_CALL_CONV_MASK = 0x0700,
MONO_PINVOKE_CALL_CONV_WINAPI = 0x0100,
MONO_PINVOKE_CALL_CONV_CDECL = 0x0200,
MONO_PINVOKE_CALL_CONV_STDCALL = 0x0300,
MONO_PINVOKE_CALL_CONV_THISCALL = 0x0400,
MONO_PINVOKE_CALL_CONV_FASTCALL = 0x0500,
MONO_PINVOKE_THROW_ON_UNMAPPABLE_ENABLED = 0x1000,
MONO_PINVOKE_THROW_ON_UNMAPPABLE_DISABLED = 0x2000,
MONO_PINVOKE_THROW_ON_UNMAPPABLE_MASK = 0x3000,
MONO_PINVOKE_CALL_CONV_GENERIC = 0x0010,
MONO_PINVOKE_CALL_CONV_GENERICINST = 0x000a
};
/*
* 23.1.9 Flags for ManifestResource
*/
enum {
MONO_MANIFEST_RESOURCE_VISIBILITY_MASK = 0x00000007,
MONO_MANIFEST_RESOURCE_PUBLIC = 0x00000001,
MONO_MANIFEST_RESOURCE_PRIVATE = 0x00000002
};
/*
* Method Attributes (23.1.10)
*/
enum {
MONO_METHOD_ATTR_ACCESS_MASK = 0x0007,
MONO_METHOD_ATTR_COMPILER_CONTROLLED = 0x0000,
MONO_METHOD_ATTR_PRIVATE = 0x0001,
MONO_METHOD_ATTR_FAM_AND_ASSEM = 0x0002,
MONO_METHOD_ATTR_ASSEM = 0x0003,
MONO_METHOD_ATTR_FAMILY = 0x0004,
MONO_METHOD_ATTR_FAM_OR_ASSEM = 0x0005,
MONO_METHOD_ATTR_PUBLIC = 0x0006,
MONO_METHOD_ATTR_STATIC = 0x0010,
MONO_METHOD_ATTR_FINAL = 0x0020,
MONO_METHOD_ATTR_VIRTUAL = 0x0040,
MONO_METHOD_ATTR_HIDE_BY_SIG = 0x0080,
MONO_METHOD_ATTR_VTABLE_LAYOUT_MASK = 0x0100,
MONO_METHOD_ATTR_REUSE_SLOT = 0x0000,
MONO_METHOD_ATTR_NEW_SLOT = 0x0100,
MONO_METHOD_ATTR_STRICT = 0x0200,
MONO_METHOD_ATTR_ABSTRACT = 0x0400,
MONO_METHOD_ATTR_SPECIAL_NAME = 0x0800,
MONO_METHOD_ATTR_PINVOKE_IMPL = 0x2000,
MONO_METHOD_ATTR_UNMANAGED_EXPORT = 0x0008,
/*
* For runtime use only
*/
MONO_METHOD_ATTR_RESERVED_MASK = 0xd000,
MONO_METHOD_ATTR_RT_SPECIAL_NAME = 0x1000,
MONO_METHOD_ATTR_HAS_SECURITY = 0x4000,
MONO_METHOD_ATTR_REQUIRE_SEC_OBJECT = 0x8000
};
/*
* Method Impl Attributes (23.1.11)
*/
enum {
MONO_METHOD_IMPL_ATTR_CODE_TYPE_MASK = 0x0003,
MONO_METHOD_IMPL_ATTR_IL = 0x0000,
MONO_METHOD_IMPL_ATTR_NATIVE = 0x0001,
MONO_METHOD_IMPL_ATTR_OPTIL = 0x0002,
MONO_METHOD_IMPL_ATTR_RUNTIME = 0x0003,
MONO_METHOD_IMPL_ATTR_MANAGED_MASK = 0x0004,
MONO_METHOD_IMPL_ATTR_UNMANAGED = 0x0004,
MONO_METHOD_IMPL_ATTR_MANAGED = 0x0000,
MONO_METHOD_IMPL_ATTR_FORWARD_REF = 0x0010,
MONO_METHOD_IMPL_ATTR_PRESERVE_SIG = 0x0080,
MONO_METHOD_IMPL_ATTR_INTERNAL_CALL = 0x1000,
MONO_METHOD_IMPL_ATTR_SYNCHRONIZED = 0x0020,
MONO_METHOD_IMPL_ATTR_NOINLINING = 0x0008,
MONO_METHOD_IMPL_ATTR_NOOPTIMIZATION = 0x0040,
MONO_METHOD_IMPL_ATTR_MAX_METHOD_IMPL_VAL = 0xffff
};
/*
* Method Semantics ([MethodSemanticAttributes]) 23.1.12,
*/
enum {
MONO_METHOD_SEMANTIC_SETTER = 0x0001,
MONO_METHOD_SEMANTIC_GETTER = 0x0002,
MONO_METHOD_SEMANTIC_OTHER = 0x0004,
MONO_METHOD_SEMANTIC_ADD_ON = 0x0008,
MONO_METHOD_SEMANTIC_REMOVE_ON = 0x0010,
MONO_METHOD_SEMANTIC_FIRE = 0x0020
};
/*
* Flags for Params (23.1.13)
*/
enum {
MONO_PARAM_ATTR_IN = 0x0001,
MONO_PARAM_ATTR_OUT = 0x0002,
MONO_PARAM_ATTR_OPTIONAL = 0x0010,
MONO_PARAM_ATTR_RESERVED_MASK = 0xf000,
MONO_PARAM_ATTR_HAS_DEFAULT = 0x1000,
MONO_PARAM_ATTR_HAS_MARSHAL = 0x2000,
MONO_PARAM_ATTR_UNUSED = 0xcfe0
};
/*
* 23.1.14 PropertyAttributes
*/
enum {
MONO_PROPERTY_ATTR_SPECIAL_NAME = 0x0200,
MONO_PROPERTY_ATTR_RESERVED_MASK = 0xf400,
MONO_PROPERTY_ATTR_RT_SPECIAL_NAME = 0x0400,
MONO_PROPERTY_ATTR_HAS_DEFAULT = 0x1000,
MONO_PROPERTY_ATTR_UNUSED = 0xe9ff
};
/*
* Type Attributes (23.1.15).
*/
enum {
MONO_TYPE_ATTR_VISIBILITY_MASK = 0x00000007,
MONO_TYPE_ATTR_NOT_PUBLIC = 0x00000000,
MONO_TYPE_ATTR_PUBLIC = 0x00000001,
MONO_TYPE_ATTR_NESTED_PUBLIC = 0x00000002,
MONO_TYPE_ATTR_NESTED_PRIVATE = 0x00000003,
MONO_TYPE_ATTR_NESTED_FAMILY = 0x00000004,
MONO_TYPE_ATTR_NESTED_ASSEMBLY = 0x00000005,
MONO_TYPE_ATTR_NESTED_FAM_AND_ASSEM = 0x00000006,
MONO_TYPE_ATTR_NESTED_FAM_OR_ASSEM = 0x00000007,
MONO_TYPE_ATTR_LAYOUT_MASK = 0x00000018,
MONO_TYPE_ATTR_AUTO_LAYOUT = 0x00000000,
MONO_TYPE_ATTR_SEQUENTIAL_LAYOUT = 0x00000008,
MONO_TYPE_ATTR_EXPLICIT_LAYOUT = 0x00000010,
MONO_TYPE_ATTR_CLASS_SEMANTIC_MASK = 0x00000020,
MONO_TYPE_ATTR_CLASS = 0x00000000,
MONO_TYPE_ATTR_INTERFACE = 0x00000020,
MONO_TYPE_ATTR_ABSTRACT = 0x00000080,
MONO_TYPE_ATTR_SEALED = 0x00000100,
MONO_TYPE_ATTR_SPECIAL_NAME = 0x00000400,
MONO_TYPE_ATTR_IMPORT = 0x00001000,
MONO_TYPE_ATTR_SERIALIZABLE = 0x00002000,
MONO_TYPE_ATTR_STRING_FORMAT_MASK = 0x00030000,
MONO_TYPE_ATTR_ANSI_CLASS = 0x00000000,
MONO_TYPE_ATTR_UNICODE_CLASS = 0x00010000,
MONO_TYPE_ATTR_AUTO_CLASS = 0x00020000,
MONO_TYPE_ATTR_CUSTOM_CLASS = 0x00030000,
MONO_TYPE_ATTR_CUSTOM_MASK = 0x00c00000,
MONO_TYPE_ATTR_BEFORE_FIELD_INIT = 0x00100000,
MONO_TYPE_ATTR_FORWARDER = 0x00200000,
MONO_TYPE_ATTR_RESERVED_MASK = 0x00040800,
MONO_TYPE_ATTR_RT_SPECIAL_NAME = 0x00000800,
MONO_TYPE_ATTR_HAS_SECURITY = 0x00040000
};
#endif
@@ -0,0 +1,118 @@
/**
* \file
* Definitions used to pull information out of the Blob
*
*/
#ifndef _MONO_METADATA_BLOB_H_
#define _MONO_METADATA_BLOB_H_
/*
* Encoding for type signatures used in the Metadata
*/
typedef enum {
MONO_TYPE_END = 0x00, /* End of List */
MONO_TYPE_VOID = 0x01,
MONO_TYPE_BOOLEAN = 0x02,
MONO_TYPE_CHAR = 0x03,
MONO_TYPE_I1 = 0x04,
MONO_TYPE_U1 = 0x05,
MONO_TYPE_I2 = 0x06,
MONO_TYPE_U2 = 0x07,
MONO_TYPE_I4 = 0x08,
MONO_TYPE_U4 = 0x09,
MONO_TYPE_I8 = 0x0a,
MONO_TYPE_U8 = 0x0b,
MONO_TYPE_R4 = 0x0c,
MONO_TYPE_R8 = 0x0d,
MONO_TYPE_STRING = 0x0e,
MONO_TYPE_PTR = 0x0f, /* arg: <type> token */
MONO_TYPE_BYREF = 0x10, /* arg: <type> token */
MONO_TYPE_VALUETYPE = 0x11, /* arg: <type> token */
MONO_TYPE_CLASS = 0x12, /* arg: <type> token */
MONO_TYPE_VAR = 0x13, /* number */
MONO_TYPE_ARRAY = 0x14, /* type, rank, boundsCount, bound1, loCount, lo1 */
MONO_TYPE_GENERICINST= 0x15, /* <type> <type-arg-count> <type-1> \x{2026} <type-n> */
MONO_TYPE_TYPEDBYREF = 0x16,
MONO_TYPE_I = 0x18,
MONO_TYPE_U = 0x19,
MONO_TYPE_FNPTR = 0x1b, /* arg: full method signature */
MONO_TYPE_OBJECT = 0x1c,
MONO_TYPE_SZARRAY = 0x1d, /* 0-based one-dim-array */
MONO_TYPE_MVAR = 0x1e, /* number */
MONO_TYPE_CMOD_REQD = 0x1f, /* arg: typedef or typeref token */
MONO_TYPE_CMOD_OPT = 0x20, /* optional arg: typedef or typref token */
MONO_TYPE_INTERNAL = 0x21, /* CLR internal type */
MONO_TYPE_MODIFIER = 0x40, /* Or with the following types */
MONO_TYPE_SENTINEL = 0x41, /* Sentinel for varargs method signature */
MONO_TYPE_PINNED = 0x45, /* Local var that points to pinned object */
MONO_TYPE_ENUM = 0x55 /* an enumeration */
} MonoTypeEnum;
typedef enum {
MONO_TABLE_MODULE,
MONO_TABLE_TYPEREF,
MONO_TABLE_TYPEDEF,
MONO_TABLE_FIELD_POINTER,
MONO_TABLE_FIELD,
MONO_TABLE_METHOD_POINTER,
MONO_TABLE_METHOD,
MONO_TABLE_PARAM_POINTER,
MONO_TABLE_PARAM,
MONO_TABLE_INTERFACEIMPL,
MONO_TABLE_MEMBERREF, /* 0xa */
MONO_TABLE_CONSTANT,
MONO_TABLE_CUSTOMATTRIBUTE,
MONO_TABLE_FIELDMARSHAL,
MONO_TABLE_DECLSECURITY,
MONO_TABLE_CLASSLAYOUT,
MONO_TABLE_FIELDLAYOUT, /* 0x10 */
MONO_TABLE_STANDALONESIG,
MONO_TABLE_EVENTMAP,
MONO_TABLE_EVENT_POINTER,
MONO_TABLE_EVENT,
MONO_TABLE_PROPERTYMAP,
MONO_TABLE_PROPERTY_POINTER,
MONO_TABLE_PROPERTY,
MONO_TABLE_METHODSEMANTICS,
MONO_TABLE_METHODIMPL,
MONO_TABLE_MODULEREF, /* 0x1a */
MONO_TABLE_TYPESPEC,
MONO_TABLE_IMPLMAP,
MONO_TABLE_FIELDRVA,
MONO_TABLE_ENCLOG,
MONO_TABLE_ENCMAP,
MONO_TABLE_ASSEMBLY, /* 0x20 */
MONO_TABLE_ASSEMBLYPROCESSOR,
MONO_TABLE_ASSEMBLYOS,
MONO_TABLE_ASSEMBLYREF,
MONO_TABLE_ASSEMBLYREFPROCESSOR,
MONO_TABLE_ASSEMBLYREFOS,
MONO_TABLE_FILE,
MONO_TABLE_EXPORTEDTYPE,
MONO_TABLE_MANIFESTRESOURCE,
MONO_TABLE_NESTEDCLASS,
MONO_TABLE_GENERICPARAM, /* 0x2a */
MONO_TABLE_METHODSPEC,
MONO_TABLE_GENERICPARAMCONSTRAINT,
MONO_TABLE_UNUSED8,
MONO_TABLE_UNUSED9,
MONO_TABLE_UNUSED10,
/* Portable PDB tables */
MONO_TABLE_DOCUMENT, /* 0x30 */
MONO_TABLE_METHODBODY,
MONO_TABLE_LOCALSCOPE,
MONO_TABLE_LOCALVARIABLE,
MONO_TABLE_LOCALCONSTANT,
MONO_TABLE_IMPORTSCOPE,
MONO_TABLE_STATEMACHINEMETHOD,
MONO_TABLE_CUSTOMDEBUGINFORMATION
#define MONO_TABLE_LAST MONO_TABLE_CUSTOMDEBUGINFORMATION
#define MONO_TABLE_NUM (MONO_TABLE_LAST + 1)
} MonoMetaTableEnum;
#endif
@@ -0,0 +1,313 @@
/**
* \file
*/
#ifndef _MONO_CLI_CLASS_H_
#define _MONO_CLI_CLASS_H_
#include <mono/metadata/metadata.h>
#include <mono/metadata/image.h>
#include <mono/metadata/loader.h>
#include <mono/utils/mono-error.h>
MONO_BEGIN_DECLS
typedef struct MonoVTable MonoVTable;
typedef struct _MonoClassField MonoClassField;
typedef struct _MonoProperty MonoProperty;
typedef struct _MonoEvent MonoEvent;
typedef enum {
MONO_TYPE_NAME_FORMAT_IL,
MONO_TYPE_NAME_FORMAT_REFLECTION,
MONO_TYPE_NAME_FORMAT_FULL_NAME,
MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
} MonoTypeNameFormat;
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass *
mono_class_get (MonoImage *image, uint32_t type_token);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass *
mono_class_get_full (MonoImage *image, uint32_t type_token, MonoGenericContext *context);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_class_init (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoVTable *
mono_class_vtable (MonoDomain *domain, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass *
mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass *
mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod *
mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int param_count, int flags);
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass *
mono_class_from_typeref (MonoImage *image, uint32_t type_token);
MONO_API MonoClass *
mono_class_from_typeref_checked (MonoImage *image, uint32_t type_token, MonoError *error);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass *
mono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *image, mono_bool is_mvar);
MONO_API MONO_RT_EXTERNAL_ONLY MonoType*
mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context) /* MONO_DEPRECATED */;
MONO_API MONO_RT_EXTERNAL_ONLY
MonoMethod*
mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoMethod *
mono_get_inflated_method (MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClassField*
mono_field_from_token (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass *
mono_bounded_array_class_get (MonoClass *element_class, uint32_t rank, mono_bool bounded);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass *
mono_array_class_get (MonoClass *element_class, uint32_t rank);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass *
mono_ptr_class_get (MonoType *type);
MONO_API MonoClassField *
mono_class_get_field (MonoClass *klass, uint32_t field_token);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClassField *
mono_class_get_field_from_name (MonoClass *klass, const char *name);
MONO_API uint32_t
mono_class_get_field_token (MonoClassField *field);
MONO_API uint32_t
mono_class_get_event_token (MonoEvent *event);
MONO_API MONO_RT_EXTERNAL_ONLY MonoProperty *
mono_class_get_property_from_name (MonoClass *klass, const char *name);
MONO_API uint32_t
mono_class_get_property_token (MonoProperty *prop);
MONO_API int32_t
mono_array_element_size (MonoClass *ac);
MONO_API int32_t
mono_class_instance_size (MonoClass *klass);
MONO_API int32_t
mono_class_array_element_size (MonoClass *klass);
MONO_API int32_t
mono_class_data_size (MonoClass *klass);
MONO_API int32_t
mono_class_value_size (MonoClass *klass, uint32_t *align);
MONO_API int32_t
mono_class_min_align (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass *
mono_class_from_mono_type (MonoType *type);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc,
mono_bool check_interfaces);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass);
MONO_API MONO_RT_EXTERNAL_ONLY
void*
mono_ldtoken (MonoImage *image, uint32_t token, MonoClass **retclass, MonoGenericContext *context);
MONO_API char *
mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
MONO_API char*
mono_type_get_name (MonoType *type);
MONO_API MonoType*
mono_type_get_underlying_type (MonoType *type);
/* MonoClass accessors */
MONO_API MonoImage*
mono_class_get_image (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass*
mono_class_get_element_class (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
mono_bool
mono_class_is_valuetype (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
mono_bool
mono_class_is_enum (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoType*
mono_class_enum_basetype (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass*
mono_class_get_parent (MonoClass *klass);
MONO_API MonoClass*
mono_class_get_nesting_type (MonoClass *klass);
MONO_API int
mono_class_get_rank (MonoClass *klass);
MONO_API uint32_t
mono_class_get_flags (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
const char*
mono_class_get_name (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
const char*
mono_class_get_namespace (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoType*
mono_class_get_type (MonoClass *klass);
MONO_API uint32_t
mono_class_get_type_token (MonoClass *klass);
MONO_API MonoType*
mono_class_get_byref_type (MonoClass *klass);
MONO_API int
mono_class_num_fields (MonoClass *klass);
MONO_API int
mono_class_num_methods (MonoClass *klass);
MONO_API int
mono_class_num_properties (MonoClass *klass);
MONO_API int
mono_class_num_events (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClassField*
mono_class_get_fields (MonoClass* klass, void **iter);
MONO_API MonoMethod*
mono_class_get_methods (MonoClass* klass, void **iter);
MONO_API MonoProperty*
mono_class_get_properties (MonoClass* klass, void **iter);
MONO_API MonoEvent*
mono_class_get_events (MonoClass* klass, void **iter);
MONO_API MonoClass*
mono_class_get_interfaces (MonoClass* klass, void **iter);
MONO_API MonoClass*
mono_class_get_nested_types (MonoClass* klass, void **iter);
MONO_API MONO_RT_EXTERNAL_ONLY
mono_bool
mono_class_is_delegate (MonoClass* klass);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_class_implements_interface (MonoClass* klass, MonoClass* iface);
/* MonoClassField accessors */
MONO_API const char*
mono_field_get_name (MonoClassField *field);
MONO_API MonoType*
mono_field_get_type (MonoClassField *field);
MONO_API MonoClass*
mono_field_get_parent (MonoClassField *field);
MONO_API uint32_t
mono_field_get_flags (MonoClassField *field);
MONO_API uint32_t
mono_field_get_offset (MonoClassField *field);
MONO_API const char *
mono_field_get_data (MonoClassField *field);
/* MonoProperty acessors */
MONO_API const char*
mono_property_get_name (MonoProperty *prop);
MONO_API MonoMethod*
mono_property_get_set_method (MonoProperty *prop);
MONO_API MonoMethod*
mono_property_get_get_method (MonoProperty *prop);
MONO_API MonoClass*
mono_property_get_parent (MonoProperty *prop);
MONO_API uint32_t
mono_property_get_flags (MonoProperty *prop);
/* MonoEvent accessors */
MONO_API const char*
mono_event_get_name (MonoEvent *event);
MONO_API MonoMethod*
mono_event_get_add_method (MonoEvent *event);
MONO_API MonoMethod*
mono_event_get_remove_method (MonoEvent *event);
MONO_API MonoMethod*
mono_event_get_remove_method (MonoEvent *event);
MONO_API MonoMethod*
mono_event_get_raise_method (MonoEvent *event);
MONO_API MonoClass*
mono_event_get_parent (MonoEvent *event);
MONO_API uint32_t
mono_event_get_flags (MonoEvent *event);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod *
mono_class_get_method_from_name (MonoClass *klass, const char *name, int param_count);
MONO_API char *
mono_class_name_from_token (MonoImage *image, uint32_t type_token);
MONO_API mono_bool
mono_method_can_access_field (MonoMethod *method, MonoClassField *field);
MONO_API mono_bool
mono_method_can_access_method (MonoMethod *method, MonoMethod *called);
MONO_API mono_bool
mono_class_is_nullable (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass*
mono_class_get_nullable_param (MonoClass *klass);
MONO_END_DECLS
#endif /* _MONO_CLI_CLASS_H_ */
@@ -0,0 +1,54 @@
/**
* \file
*/
#ifndef __MONO_DEBUG_HELPERS_H__
#define __MONO_DEBUG_HELPERS_H__
#include <mono/metadata/class.h>
MONO_BEGIN_DECLS
typedef struct MonoDisHelper MonoDisHelper;
typedef char* (*MonoDisIndenter) (MonoDisHelper *dh, MonoMethod *method, uint32_t ip_offset);
typedef char* (*MonoDisTokener) (MonoDisHelper *dh, MonoMethod *method, uint32_t token);
struct MonoDisHelper {
const char *newline;
const char *label_format;
const char *label_target;
MonoDisIndenter indenter;
MonoDisTokener tokener;
void* user_data;
};
MONO_API char* mono_disasm_code_one (MonoDisHelper *dh, MonoMethod *method, const mono_byte *ip, const mono_byte** endp);
MONO_API char* mono_disasm_code (MonoDisHelper *dh, MonoMethod *method, const mono_byte *ip, const mono_byte* end);
typedef struct MonoMethodDesc MonoMethodDesc;
MONO_API char* mono_type_full_name (MonoType *type);
MONO_API char* mono_signature_get_desc (MonoMethodSignature *sig, mono_bool include_namespace);
MONO_API char* mono_context_get_desc (MonoGenericContext *context);
MONO_API MonoMethodDesc* mono_method_desc_new (const char *name, mono_bool include_namespace);
MONO_API MonoMethodDesc* mono_method_desc_from_method (MonoMethod *method);
MONO_API void mono_method_desc_free (MonoMethodDesc *desc);
MONO_API mono_bool mono_method_desc_match (MonoMethodDesc *desc, MonoMethod *method);
MONO_API mono_bool mono_method_desc_is_full (MonoMethodDesc *desc);
MONO_API mono_bool mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method);
MONO_API MonoMethod* mono_method_desc_search_in_class (MonoMethodDesc *desc, MonoClass *klass);
MONO_API MonoMethod* mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image);
MONO_API char* mono_method_full_name (MonoMethod *method, mono_bool signature);
MONO_API char* mono_method_get_reflection_name (MonoMethod *method);
MONO_API char* mono_field_full_name (MonoClassField *field);
MONO_END_DECLS
#endif /* __MONO_DEBUG_HELPERS_H__ */
@@ -0,0 +1,114 @@
/**
* \file
* This header is only installed for use by the debugger:
* the structures and the API declared here are not supported.
* Copyright 2012 Xamarin Inc (http://www.xamarin.com)
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifndef __MONO_DEBUG_MONO_SYMFILE_H__
#define __MONO_DEBUG_MONO_SYMFILE_H__
#include <glib.h>
#include <mono/metadata/class.h>
#include <mono/metadata/reflection.h>
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/debug-internals.h>
typedef struct MonoSymbolFileOffsetTable MonoSymbolFileOffsetTable;
typedef struct MonoSymbolFileLineNumberEntry MonoSymbolFileLineNumberEntry;
typedef struct MonoSymbolFileMethodAddress MonoSymbolFileMethodAddress;
typedef struct MonoSymbolFileDynamicTable MonoSymbolFileDynamicTable;
typedef struct MonoSymbolFileSourceEntry MonoSymbolFileSourceEntry;
typedef struct MonoSymbolFileMethodEntry MonoSymbolFileMethodEntry;
/* Keep in sync with OffsetTable in mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs */
struct MonoSymbolFileOffsetTable {
uint32_t _total_file_size;
uint32_t _data_section_offset;
uint32_t _data_section_size;
uint32_t _compile_unit_count;
uint32_t _compile_unit_table_offset;
uint32_t _compile_unit_table_size;
uint32_t _source_count;
uint32_t _source_table_offset;
uint32_t _source_table_size;
uint32_t _method_count;
uint32_t _method_table_offset;
uint32_t _method_table_size;
uint32_t _type_count;
uint32_t _anonymous_scope_count;
uint32_t _anonymous_scope_table_offset;
uint32_t _anonymous_scope_table_size;
uint32_t _line_number_table_line_base;
uint32_t _line_number_table_line_range;
uint32_t _line_number_table_opcode_base;
uint32_t _is_aspx_source;
};
struct MonoSymbolFileSourceEntry {
uint32_t _index;
uint32_t _data_offset;
};
struct MonoSymbolFileMethodEntry {
uint32_t _token;
uint32_t _data_offset;
uint32_t _line_number_table;
};
struct MonoSymbolFileMethodAddress {
uint32_t size;
const uint8_t *start_address;
const uint8_t *end_address;
const uint8_t *method_start_address;
const uint8_t *method_end_address;
const uint8_t *wrapper_address;
uint32_t has_this;
uint32_t num_params;
uint32_t variable_table_offset;
uint32_t type_table_offset;
uint32_t num_line_numbers;
uint32_t line_number_offset;
uint8_t data [MONO_ZERO_LEN_ARRAY];
};
#define MONO_SYMBOL_FILE_MAJOR_VERSION 50
#define MONO_SYMBOL_FILE_MINOR_VERSION 0
#define MONO_SYMBOL_FILE_MAGIC 0x45e82623fd7fa614ULL
MONO_BEGIN_DECLS
MONO_API MonoSymbolFile *
mono_debug_open_mono_symbols (MonoDebugHandle *handle,
const uint8_t *raw_contents,
int size,
mono_bool in_the_debugger);
MONO_API void
mono_debug_close_mono_symbol_file (MonoSymbolFile *symfile);
MONO_API mono_bool
mono_debug_symfile_is_loaded (MonoSymbolFile *symfile);
MONO_API MonoDebugSourceLocation *
mono_debug_symfile_lookup_location (MonoDebugMethodInfo *minfo,
uint32_t offset);
MONO_API void
mono_debug_symfile_free_location (MonoDebugSourceLocation *location);
MONO_API MonoDebugMethodInfo *
mono_debug_symfile_lookup_method (MonoDebugHandle *handle,
MonoMethod *method);
MONO_API MonoDebugLocalsInfo*
mono_debug_symfile_lookup_locals (MonoDebugMethodInfo *minfo);
void
mono_debug_symfile_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrArray **source_file_list, int **source_files, MonoSymSeqPoint **seq_points, int *n_seq_points);
MONO_END_DECLS
#endif /* __MONO_SYMFILE_H__ */
@@ -0,0 +1,23 @@
/**
* \file
* System.Environment support internal calls
*
* Author:
* Dick Porter (dick@ximian.com)
*
* (C) 2002 Ximian, Inc
*/
#ifndef _MONO_METADATA_ENVIRONMENT_H_
#define _MONO_METADATA_ENVIRONMENT_H_
#include <mono/utils/mono-publib.h>
MONO_BEGIN_DECLS
MONO_API int32_t mono_environment_exitcode_get (void);
MONO_API void mono_environment_exitcode_set (int32_t value);
MONO_END_DECLS
#endif /* _MONO_METADATA_ENVIRONMENT_H_ */
@@ -0,0 +1,177 @@
/**
* \file
*/
#ifndef _MONO_METADATA_EXCEPTION_H_
#define _MONO_METADATA_EXCEPTION_H_
#include <mono/metadata/object-forward.h>
#include <mono/metadata/object.h>
#include <mono/metadata/image.h>
MONO_BEGIN_DECLS
MONO_API MonoException *
mono_exception_from_name (MonoImage *image,
const char* name_space,
const char *name);
MONO_API MonoException *
mono_exception_from_token (MonoImage *image, uint32_t token);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
const char *name, MonoString *a1, MonoString *a2);
MONO_API MonoException *
mono_exception_from_name_msg (MonoImage *image, const char *name_space,
const char *name, const char *msg);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_exception_from_token_two_strings (MonoImage *image, uint32_t token,
MonoString *a1, MonoString *a2);
MONO_API MonoException *
mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image,
const char* name_space,
const char *name);
MONO_API MonoException *
mono_get_exception_divide_by_zero (void);
MONO_API MonoException *
mono_get_exception_security (void);
MONO_API MonoException *
mono_get_exception_arithmetic (void);
MONO_API MonoException *
mono_get_exception_overflow (void);
MONO_API MonoException *
mono_get_exception_null_reference (void);
MONO_API MonoException *
mono_get_exception_execution_engine (const char *msg);
MONO_API MonoException *
mono_get_exception_thread_abort (void);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_thread_state (const char *msg);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_thread_interrupted (void);
MONO_API MonoException *
mono_get_exception_serialization (const char *msg);
MONO_API MonoException *
mono_get_exception_invalid_cast (void);
MONO_API MonoException *
mono_get_exception_invalid_operation (const char *msg);
MONO_API MonoException *
mono_get_exception_index_out_of_range (void);
MONO_API MonoException *
mono_get_exception_array_type_mismatch (void);
MONO_API MonoException *
mono_get_exception_type_load (MonoString *class_name, char *assembly_name);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_missing_method (const char *class_name, const char *member_name);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_missing_field (const char *class_name, const char *member_name);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_not_implemented (const char *msg);
MONO_API MonoException *
mono_get_exception_not_supported (const char *msg);
MONO_API MONO_RT_EXTERNAL_ONLY MonoException*
mono_get_exception_argument_null (const char *arg);
MONO_API MonoException *
mono_get_exception_argument (const char *arg, const char *msg);
MONO_API MonoException *
mono_get_exception_argument_out_of_range (const char *arg);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_io (const char *msg);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_file_not_found (MonoString *fname);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_file_not_found2 (const char *msg, MonoString *fname);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_type_initialization (const char *type_name, MonoException *inner);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_synchronization_lock (const char *msg);
MONO_API MonoException *
mono_get_exception_cannot_unload_appdomain (const char *msg);
MONO_API MonoException *
mono_get_exception_appdomain_unloaded (void);
MONO_API MonoException *
mono_get_exception_bad_image_format (const char *msg);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname);
MONO_API MonoException *
mono_get_exception_stack_overflow (void);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_out_of_memory (void);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_field_access (void);
MONO_API MonoException *
mono_get_exception_method_access (void);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoException *
mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception);
/* Installs a function which is called when the runtime encounters an unhandled exception.
* This hook isn't expected to return.
* If no hook has been installed, the runtime will print a message before aborting.
*/
typedef void (*MonoUnhandledExceptionFunc) (MonoObject *exc, void *user_data);
MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, void *user_data);
void mono_invoke_unhandled_exception_hook (MonoObject *exc);
MONO_END_DECLS
#endif /* _MONO_METADATA_EXCEPTION_H_ */
@@ -0,0 +1,99 @@
/**
* \file
*/
#ifndef _MONONET_METADATA_IMAGE_H_
#define _MONONET_METADATA_IMAGE_H_
#include <stdio.h>
#include <mono/utils/mono-publib.h>
#include <mono/utils/mono-error.h>
#include <mono/metadata/object-forward.h>
MONO_BEGIN_DECLS
typedef struct _MonoAssembly MonoAssembly;
typedef struct _MonoAssemblyName MonoAssemblyName;
typedef struct _MonoTableInfo MonoTableInfo;
typedef enum {
MONO_IMAGE_OK,
MONO_IMAGE_ERROR_ERRNO,
MONO_IMAGE_MISSING_ASSEMBLYREF,
MONO_IMAGE_IMAGE_INVALID
} MonoImageOpenStatus;
MONO_API void mono_images_init (void);
MONO_API void mono_images_cleanup (void);
MONO_API MonoImage *mono_image_open (const char *fname,
MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_open_full (const char *fname,
MonoImageOpenStatus *status, mono_bool refonly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_pe_file_open (const char *fname,
MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_open_from_data (char *data, uint32_t data_len, mono_bool need_copy,
MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_open_from_data_full (char *data, uint32_t data_len, mono_bool need_copy,
MonoImageOpenStatus *status, mono_bool refonly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_open_from_data_with_name (char *data, uint32_t data_len, mono_bool need_copy,
MonoImageOpenStatus *status, mono_bool refonly, const char *name);
MONO_API void mono_image_fixup_vtable (MonoImage *image);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_loaded (const char *name);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_loaded_full (const char *name, mono_bool refonly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_loaded_by_guid (const char *guid);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoImage *mono_image_loaded_by_guid_full (const char *guid, mono_bool refonly);
MONO_API void mono_image_init (MonoImage *image);
MONO_API void mono_image_close (MonoImage *image);
MONO_API void mono_image_addref (MonoImage *image);
MONO_API const char *mono_image_strerror (MonoImageOpenStatus status);
MONO_API int mono_image_ensure_section (MonoImage *image,
const char *section);
MONO_API int mono_image_ensure_section_idx (MonoImage *image,
int section);
MONO_API uint32_t mono_image_get_entry_point (MonoImage *image);
MONO_API const char *mono_image_get_resource (MonoImage *image, uint32_t offset, uint32_t *size);
MONO_API MONO_RT_EXTERNAL_ONLY MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx);
MONO_API MONO_RT_EXTERNAL_ONLY MonoImage* mono_image_load_module (MonoImage *image, int idx);
MONO_API const char* mono_image_get_name (MonoImage *image);
MONO_API const char* mono_image_get_filename (MonoImage *image);
MONO_API const char * mono_image_get_guid (MonoImage *image);
MONO_API MonoAssembly* mono_image_get_assembly (MonoImage *image);
MONO_API mono_bool mono_image_is_dynamic (MonoImage *image);
MONO_API char* mono_image_rva_map (MonoImage *image, uint32_t rva);
MONO_API const MonoTableInfo *mono_image_get_table_info (MonoImage *image, int table_id);
MONO_API int mono_image_get_table_rows (MonoImage *image, int table_id);
MONO_API int mono_table_info_get_rows (const MonoTableInfo *table);
/* This actually returns a MonoPEResourceDataEntry *, but declaring it
* causes an include file loop.
*/
MONO_API void* mono_image_lookup_resource (MonoImage *image, uint32_t res_id,
uint32_t lang_id, mono_unichar2 *name);
MONO_API const char* mono_image_get_public_key (MonoImage *image, uint32_t *size);
MONO_API const char* mono_image_get_strong_name (MonoImage *image, uint32_t *size);
MONO_API uint32_t mono_image_strong_name_position (MonoImage *image, uint32_t *size);
MONO_API void mono_image_add_to_name_cache (MonoImage *image,
const char *nspace, const char *name, uint32_t idx);
MONO_API mono_bool mono_image_has_authenticode_entry (MonoImage *image);
mono_bool mono_has_pdb_checksum (char *raw_data, uint32_t raw_data_len);
MONO_END_DECLS
#endif
@@ -0,0 +1,109 @@
/**
* \file
*/
#ifndef _MONO_METADATA_LOADER_H_
#define _MONO_METADATA_LOADER_H_ 1
#include <mono/utils/mono-forward.h>
#include <mono/metadata/metadata.h>
#include <mono/metadata/image.h>
#include <mono/utils/mono-error.h>
MONO_BEGIN_DECLS
typedef mono_bool (*MonoStackWalk) (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod *
mono_get_method (MonoImage *image, uint32_t token, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod *
mono_get_method_full (MonoImage *image, uint32_t token, MonoClass *klass,
MonoGenericContext *context);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod *
mono_get_method_constrained (MonoImage *image, uint32_t token, MonoClass *constrained_class,
MonoGenericContext *context, MonoMethod **cil_method);
MONO_API void
mono_free_method (MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodSignature*
mono_method_get_signature_full (MonoMethod *method, MonoImage *image, uint32_t token,
MonoGenericContext *context);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodSignature*
mono_method_get_signature (MonoMethod *method, MonoImage *image, uint32_t token);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodSignature*
mono_method_signature (MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodHeader*
mono_method_get_header (MonoMethod *method);
MONO_API const char*
mono_method_get_name (MonoMethod *method);
MONO_API MonoClass*
mono_method_get_class (MonoMethod *method);
MONO_API uint32_t
mono_method_get_token (MonoMethod *method);
MONO_API uint32_t
mono_method_get_flags (MonoMethod *method, uint32_t *iflags);
MONO_API uint32_t
mono_method_get_index (MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_add_internal_call (const char *name, const void* method);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_dangerous_add_raw_internal_call (const char *name, const void* method);
MONO_API void*
mono_lookup_internal_call (MonoMethod *method);
MONO_API const char*
mono_lookup_icall_symbol (MonoMethod *m);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, const char *tdll, const char *tfunc);
MONO_API MONO_RT_EXTERNAL_ONLY void*
mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char **exc_arg);
MONO_API void
mono_method_get_param_names (MonoMethod *method, const char **names);
MONO_API uint32_t
mono_method_get_param_token (MonoMethod *method, int idx);
MONO_API void
mono_method_get_marshal_info (MonoMethod *method, MonoMarshalSpec **mspecs);
MONO_API mono_bool
mono_method_has_marshal_info (MonoMethod *method);
MONO_API MonoMethod*
mono_method_get_last_managed (void);
MONO_API void
mono_stack_walk (MonoStackWalk func, void* user_data);
/* Use this if the IL offset is not needed: it's faster */
MONO_API void
mono_stack_walk_no_il (MonoStackWalk func, void* user_data);
typedef mono_bool (*MonoStackWalkAsyncSafe) (MonoMethod *method, MonoDomain *domain, void *base_address, int offset, void* data);
MONO_API void
mono_stack_walk_async_safe (MonoStackWalkAsyncSafe func, void *initial_sig_context, void* user_data);
MONO_API MonoMethodHeader*
mono_method_get_header_checked (MonoMethod *method, MonoError *error);
MONO_END_DECLS
#endif
@@ -0,0 +1,523 @@
/**
* \file
*/
#ifndef __MONO_METADATA_H__
#define __MONO_METADATA_H__
#include <mono/utils/mono-publib.h>
#include <mono/utils/mono-forward.h>
#include <mono/metadata/blob.h>
#include <mono/metadata/row-indexes.h>
#include <mono/metadata/image.h>
#include <mono/metadata/object-forward.h>
MONO_BEGIN_DECLS
#define MONO_TYPE_ISSTRUCT(t) mono_type_is_struct (t)
#define MONO_TYPE_IS_VOID(t) mono_type_is_void (t)
#define MONO_TYPE_IS_POINTER(t) mono_type_is_pointer (t)
#define MONO_TYPE_IS_REFERENCE(t) mono_type_is_reference (t)
#define MONO_CLASS_IS_INTERFACE(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_INTERFACE) || mono_type_is_generic_parameter (mono_class_get_type (c)))
#define MONO_CLASS_IS_IMPORT(c) ((mono_class_get_flags (c) & TYPE_ATTRIBUTE_IMPORT))
typedef enum {
MONO_EXCEPTION_CLAUSE_NONE,
MONO_EXCEPTION_CLAUSE_FILTER,
MONO_EXCEPTION_CLAUSE_FINALLY,
MONO_EXCEPTION_CLAUSE_FAULT = 4
} MonoExceptionEnum;
typedef enum {
MONO_CALL_DEFAULT,
MONO_CALL_C,
MONO_CALL_STDCALL,
MONO_CALL_THISCALL,
MONO_CALL_FASTCALL,
MONO_CALL_VARARG = 0x05,
/* unused, */
/* unused, */
/* unused, */
MONO_CALL_UNMANAGED_MD = 0x09, /* default unmanaged calling convention, with additional attributed encoded in modopts */
} MonoCallConvention;
/* ECMA lamespec: the old spec had more info... */
typedef enum {
MONO_NATIVE_BOOLEAN = 0x02, /* 4 bytes, 0 is false, != 0 is true */
MONO_NATIVE_I1 = 0x03,
MONO_NATIVE_U1 = 0x04,
MONO_NATIVE_I2 = 0x05,
MONO_NATIVE_U2 = 0x06,
MONO_NATIVE_I4 = 0x07,
MONO_NATIVE_U4 = 0x08,
MONO_NATIVE_I8 = 0x09,
MONO_NATIVE_U8 = 0x0a,
MONO_NATIVE_R4 = 0x0b,
MONO_NATIVE_R8 = 0x0c,
MONO_NATIVE_CURRENCY = 0x0f,
MONO_NATIVE_BSTR = 0x13, /* prefixed length, Unicode */
MONO_NATIVE_LPSTR = 0x14, /* ANSI, null terminated */
MONO_NATIVE_LPWSTR = 0x15, /* UNICODE, null terminated */
MONO_NATIVE_LPTSTR = 0x16, /* plattform dep., null terminated */
MONO_NATIVE_BYVALTSTR = 0x17,
MONO_NATIVE_IUNKNOWN = 0x19,
MONO_NATIVE_IDISPATCH = 0x1a,
MONO_NATIVE_STRUCT = 0x1b,
MONO_NATIVE_INTERFACE = 0x1c,
MONO_NATIVE_SAFEARRAY = 0x1d,
MONO_NATIVE_BYVALARRAY = 0x1e,
MONO_NATIVE_INT = 0x1f,
MONO_NATIVE_UINT = 0x20,
MONO_NATIVE_VBBYREFSTR = 0x22,
MONO_NATIVE_ANSIBSTR = 0x23, /* prefixed length, ANSI */
MONO_NATIVE_TBSTR = 0x24, /* prefixed length, plattform dep. */
MONO_NATIVE_VARIANTBOOL = 0x25,
MONO_NATIVE_FUNC = 0x26,
MONO_NATIVE_ASANY = 0x28,
MONO_NATIVE_LPARRAY = 0x2a,
MONO_NATIVE_LPSTRUCT = 0x2b,
MONO_NATIVE_CUSTOM = 0x2c,
MONO_NATIVE_ERROR = 0x2d,
// TODO: MONO_NATIVE_IINSPECTABLE = 0x2e
// TODO: MONO_NATIVE_HSTRING = 0x2f
MONO_NATIVE_UTF8STR = 0x30,
MONO_NATIVE_MAX = 0x50 /* no info */
} MonoMarshalNative;
/* Used only in context of SafeArray */
typedef enum {
MONO_VARIANT_EMPTY = 0x00,
MONO_VARIANT_NULL = 0x01,
MONO_VARIANT_I2 = 0x02,
MONO_VARIANT_I4 = 0x03,
MONO_VARIANT_R4 = 0x04,
MONO_VARIANT_R8 = 0x05,
MONO_VARIANT_CY = 0x06,
MONO_VARIANT_DATE = 0x07,
MONO_VARIANT_BSTR = 0x08,
MONO_VARIANT_DISPATCH = 0x09,
MONO_VARIANT_ERROR = 0x0a,
MONO_VARIANT_BOOL = 0x0b,
MONO_VARIANT_VARIANT = 0x0c,
MONO_VARIANT_UNKNOWN = 0x0d,
MONO_VARIANT_DECIMAL = 0x0e,
MONO_VARIANT_I1 = 0x10,
MONO_VARIANT_UI1 = 0x11,
MONO_VARIANT_UI2 = 0x12,
MONO_VARIANT_UI4 = 0x13,
MONO_VARIANT_I8 = 0x14,
MONO_VARIANT_UI8 = 0x15,
MONO_VARIANT_INT = 0x16,
MONO_VARIANT_UINT = 0x17,
MONO_VARIANT_VOID = 0x18,
MONO_VARIANT_HRESULT = 0x19,
MONO_VARIANT_PTR = 0x1a,
MONO_VARIANT_SAFEARRAY = 0x1b,
MONO_VARIANT_CARRAY = 0x1c,
MONO_VARIANT_USERDEFINED = 0x1d,
MONO_VARIANT_LPSTR = 0x1e,
MONO_VARIANT_LPWSTR = 0x1f,
MONO_VARIANT_RECORD = 0x24,
MONO_VARIANT_FILETIME = 0x40,
MONO_VARIANT_BLOB = 0x41,
MONO_VARIANT_STREAM = 0x42,
MONO_VARIANT_STORAGE = 0x43,
MONO_VARIANT_STREAMED_OBJECT = 0x44,
MONO_VARIANT_STORED_OBJECT = 0x45,
MONO_VARIANT_BLOB_OBJECT = 0x46,
MONO_VARIANT_CF = 0x47,
MONO_VARIANT_CLSID = 0x48,
MONO_VARIANT_VECTOR = 0x1000,
MONO_VARIANT_ARRAY = 0x2000,
MONO_VARIANT_BYREF = 0x4000
} MonoMarshalVariant;
typedef enum {
MONO_MARSHAL_CONV_NONE,
MONO_MARSHAL_CONV_BOOL_VARIANTBOOL,
MONO_MARSHAL_CONV_BOOL_I4,
MONO_MARSHAL_CONV_STR_BSTR,
MONO_MARSHAL_CONV_STR_LPSTR,
MONO_MARSHAL_CONV_LPSTR_STR,
MONO_MARSHAL_CONV_LPTSTR_STR,
MONO_MARSHAL_CONV_STR_LPWSTR,
MONO_MARSHAL_CONV_LPWSTR_STR,
MONO_MARSHAL_CONV_STR_LPTSTR,
MONO_MARSHAL_CONV_STR_ANSIBSTR,
MONO_MARSHAL_CONV_STR_TBSTR,
MONO_MARSHAL_CONV_STR_BYVALSTR,
MONO_MARSHAL_CONV_STR_BYVALWSTR,
MONO_MARSHAL_CONV_SB_LPSTR,
MONO_MARSHAL_CONV_SB_LPTSTR,
MONO_MARSHAL_CONV_SB_LPWSTR,
MONO_MARSHAL_CONV_LPSTR_SB,
MONO_MARSHAL_CONV_LPTSTR_SB,
MONO_MARSHAL_CONV_LPWSTR_SB,
MONO_MARSHAL_CONV_ARRAY_BYVALARRAY,
MONO_MARSHAL_CONV_ARRAY_BYVALCHARARRAY,
MONO_MARSHAL_CONV_ARRAY_SAVEARRAY,
MONO_MARSHAL_CONV_ARRAY_LPARRAY,
MONO_MARSHAL_FREE_LPARRAY,
MONO_MARSHAL_CONV_OBJECT_INTERFACE,
MONO_MARSHAL_CONV_OBJECT_IDISPATCH,
MONO_MARSHAL_CONV_OBJECT_IUNKNOWN,
MONO_MARSHAL_CONV_OBJECT_STRUCT,
MONO_MARSHAL_CONV_DEL_FTN,
MONO_MARSHAL_CONV_FTN_DEL,
MONO_MARSHAL_FREE_ARRAY,
MONO_MARSHAL_CONV_BSTR_STR,
MONO_MARSHAL_CONV_SAFEHANDLE,
MONO_MARSHAL_CONV_HANDLEREF,
MONO_MARSHAL_CONV_STR_UTF8STR,
MONO_MARSHAL_CONV_SB_UTF8STR,
MONO_MARSHAL_CONV_UTF8STR_STR,
MONO_MARSHAL_CONV_UTF8STR_SB,
MONO_MARSHAL_CONV_FIXED_BUFFER,
MONO_MARSHAL_CONV_ANSIBSTR_STR,
MONO_MARSHAL_CONV_TBSTR_STR
} MonoMarshalConv;
#define MONO_MARSHAL_CONV_INVALID ((MonoMarshalConv)-1)
typedef struct {
MonoMarshalNative native;
union {
struct {
MonoMarshalNative elem_type;
int32_t num_elem; /* -1 if not set */
int16_t param_num; /* -1 if not set */
int16_t elem_mult; /* -1 if not set */
} array_data;
struct {
char *custom_name;
char *cookie;
MonoImage *image;
} custom_data;
struct {
MonoMarshalVariant elem_type;
int32_t num_elem;
} safearray_data;
} data;
} MonoMarshalSpec;
MONO_API void mono_metadata_init (void);
void mono_metadata_decode_row_raw (const MonoTableInfo *t, int idx, uint32_t *res, int res_size);
MONO_API void mono_metadata_decode_row (const MonoTableInfo *t,
int idx,
uint32_t *res,
int res_size);
MONO_API uint32_t mono_metadata_decode_row_col (const MonoTableInfo *t,
int idx,
unsigned int col);
/*
* This macro is used to extract the size of the table encoded in
* the size_bitfield of MonoTableInfo.
*/
#define mono_metadata_table_size(bitfield,table) ((((bitfield) >> ((table)*2)) & 0x3) + 1)
#define mono_metadata_table_count(bitfield) ((bitfield) >> 24)
MONO_API int mono_metadata_compute_size (MonoImage *meta,
int tableindex,
uint32_t *result_bitfield);
/*
*
*/
MONO_API const char *mono_metadata_locate (MonoImage *meta, int table, int idx);
MONO_API const char *mono_metadata_locate_token (MonoImage *meta, uint32_t token);
MONO_API const char *mono_metadata_string_heap (MonoImage *meta, uint32_t table_index);
MONO_API const char *mono_metadata_blob_heap (MonoImage *meta, uint32_t table_index);
MONO_API const char *mono_metadata_user_string (MonoImage *meta, uint32_t table_index);
MONO_API const char *mono_metadata_guid_heap (MonoImage *meta, uint32_t table_index);
MONO_API uint32_t mono_metadata_typedef_from_field (MonoImage *meta, uint32_t table_index);
MONO_API uint32_t mono_metadata_typedef_from_method (MonoImage *meta, uint32_t table_index);
MONO_API uint32_t mono_metadata_nested_in_typedef (MonoImage *meta, uint32_t table_index);
MONO_API uint32_t mono_metadata_nesting_typedef (MonoImage *meta, uint32_t table_index, uint32_t start_index);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoClass** mono_metadata_interfaces_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *count);
MONO_API uint32_t mono_metadata_events_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *end_idx);
MONO_API uint32_t mono_metadata_methods_from_event (MonoImage *meta, uint32_t table_index, unsigned int *end);
MONO_API uint32_t mono_metadata_properties_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *end);
MONO_API uint32_t mono_metadata_methods_from_property (MonoImage *meta, uint32_t table_index, unsigned int *end);
MONO_API uint32_t mono_metadata_packing_from_typedef (MonoImage *meta, uint32_t table_index, uint32_t *packing, uint32_t *size);
MONO_API const char* mono_metadata_get_marshal_info (MonoImage *meta, uint32_t idx, mono_bool is_field);
MONO_API uint32_t mono_metadata_custom_attrs_from_index (MonoImage *meta, uint32_t cattr_index);
MONO_API MonoMarshalSpec *mono_metadata_parse_marshal_spec (MonoImage *image, const char *ptr);
MONO_API void mono_metadata_free_marshal_spec (MonoMarshalSpec *spec);
MONO_API uint32_t mono_metadata_implmap_from_method (MonoImage *meta, uint32_t method_idx);
MONO_API void mono_metadata_field_info (MonoImage *meta,
uint32_t table_index,
uint32_t *offset,
uint32_t *rva,
MonoMarshalSpec **marshal_spec);
MONO_API uint32_t mono_metadata_get_constant_index (MonoImage *meta, uint32_t token, uint32_t hint);
/*
* Functions to extract information from the Blobs
*/
MONO_API uint32_t mono_metadata_decode_value (const char *ptr,
const char **rptr);
MONO_API int32_t mono_metadata_decode_signed_value (const char *ptr, const char **rptr);
MONO_API uint32_t mono_metadata_decode_blob_size (const char *ptr,
const char **rptr);
MONO_API void mono_metadata_encode_value (uint32_t value, char *bug, char **endbuf);
#define MONO_OFFSET_IN_CLAUSE(clause,offset) \
((clause)->try_offset <= (offset) && (offset) < ((clause)->try_offset + (clause)->try_len))
#define MONO_OFFSET_IN_HANDLER(clause,offset) \
((clause)->handler_offset <= (offset) && (offset) < ((clause)->handler_offset + (clause)->handler_len))
#define MONO_OFFSET_IN_FILTER(clause,offset) \
((clause)->flags == MONO_EXCEPTION_CLAUSE_FILTER && (clause)->data.filter_offset <= (offset) && (offset) < ((clause)->handler_offset))
typedef struct {
uint32_t flags;
uint32_t try_offset;
uint32_t try_len;
uint32_t handler_offset;
uint32_t handler_len;
union {
uint32_t filter_offset;
MonoClass *catch_class;
} data;
} MonoExceptionClause;
typedef struct _MonoType MonoType;
typedef struct _MonoGenericInst MonoGenericInst;
typedef struct _MonoGenericClass MonoGenericClass;
typedef struct _MonoGenericContext MonoGenericContext;
typedef struct _MonoGenericContainer MonoGenericContainer;
typedef struct _MonoGenericParam MonoGenericParam;
typedef struct _MonoArrayType MonoArrayType;
typedef struct _MonoMethodSignature MonoMethodSignature;
/* FIXME: Keeping this name alive for now, since it is part of the exposed API, even though no entrypoint uses it. */
typedef struct invalid_name MonoGenericMethod;
typedef struct {
unsigned int required : 1;
unsigned int token : 31;
} MonoCustomMod;
typedef struct _MonoCustomModContainer {
uint8_t count; /* max 64 modifiers follow at the end */
MonoImage *image; /* Image containing types in modifiers array */
MonoCustomMod modifiers [1]; /* Actual length is count */
} MonoCustomModContainer;
struct _MonoArrayType {
MonoClass *eklass;
// Number of dimensions of the array
uint8_t rank;
// Arrays recording known upper and lower index bounds for each dimension
uint8_t numsizes;
uint8_t numlobounds;
int *sizes;
int *lobounds;
};
typedef struct _MonoMethodHeader MonoMethodHeader;
typedef enum {
MONO_PARSE_TYPE,
MONO_PARSE_MOD_TYPE,
MONO_PARSE_LOCAL,
MONO_PARSE_PARAM,
MONO_PARSE_RET,
MONO_PARSE_FIELD
} MonoParseTypeMode;
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_type_is_byref (MonoType *type);
MONO_API MONO_RT_EXTERNAL_ONLY int
mono_type_get_type (MonoType *type);
/* For MONO_TYPE_FNPTR */
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodSignature*
mono_type_get_signature (MonoType *type);
/* For MONO_TYPE_CLASS, VALUETYPE */
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass*
mono_type_get_class (MonoType *type);
MONO_API MonoArrayType*
mono_type_get_array_type (MonoType *type);
/* For MONO_TYPE_PTR */
MONO_API MonoType*
mono_type_get_ptr_type (MonoType *type);
MONO_API MonoClass*
mono_type_get_modifiers (MonoType *type, mono_bool *is_required, void **iter);
MONO_API mono_bool mono_type_is_struct (MonoType *type);
MONO_API mono_bool mono_type_is_void (MonoType *type);
MONO_API mono_bool mono_type_is_pointer (MonoType *type);
MONO_API mono_bool mono_type_is_reference (MonoType *type);
MONO_API mono_bool mono_type_is_generic_parameter (MonoType *type);
MONO_API MONO_RT_EXTERNAL_ONLY MonoType*
mono_signature_get_return_type (MonoMethodSignature *sig);
MONO_API MONO_RT_EXTERNAL_ONLY MonoType*
mono_signature_get_params (MonoMethodSignature *sig, void **iter);
MONO_API uint32_t
mono_signature_get_param_count (MonoMethodSignature *sig);
MONO_API uint32_t
mono_signature_get_call_conv (MonoMethodSignature *sig);
MONO_API int
mono_signature_vararg_start (MonoMethodSignature *sig);
MONO_API mono_bool
mono_signature_is_instance (MonoMethodSignature *sig);
MONO_API mono_bool
mono_signature_explicit_this (MonoMethodSignature *sig);
MONO_API mono_bool
mono_signature_param_is_out (MonoMethodSignature *sig, int param_num);
MONO_API uint32_t mono_metadata_parse_typedef_or_ref (MonoImage *m,
const char *ptr,
const char **rptr);
MONO_API int mono_metadata_parse_custom_mod (MonoImage *m,
MonoCustomMod *dest,
const char *ptr,
const char **rptr);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArrayType *mono_metadata_parse_array (MonoImage *m,
const char *ptr,
const char **rptr);
MONO_API void mono_metadata_free_array (MonoArrayType *array);
MONO_API MONO_RT_EXTERNAL_ONLY MonoType *mono_metadata_parse_type (MonoImage *m,
MonoParseTypeMode mode,
short opt_attrs,
const char *ptr,
const char **rptr);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoType *mono_metadata_parse_param (MonoImage *m,
const char *ptr,
const char **rptr);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoType *mono_metadata_parse_field_type (MonoImage *m,
short field_flags,
const char *ptr,
const char **rptr);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoType *mono_type_create_from_typespec (MonoImage *image,
uint32_t type_spec);
MONO_API void mono_metadata_free_type (MonoType *type);
MONO_API int mono_type_size (MonoType *type,
int *alignment);
MONO_API int mono_type_stack_size (MonoType *type,
int *alignment);
MONO_API mono_bool mono_type_generic_inst_is_valuetype (MonoType *type);
MONO_API mono_bool mono_metadata_generic_class_is_valuetype (MonoGenericClass *gclass);
MONO_API unsigned int mono_metadata_type_hash (MonoType *t1);
MONO_API mono_bool mono_metadata_type_equal (MonoType *t1, MonoType *t2);
MONO_API MonoMethodSignature *mono_metadata_signature_alloc (MonoImage *image, uint32_t nparams);
MONO_API MonoMethodSignature *mono_metadata_signature_dup (MonoMethodSignature *sig);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoMethodSignature *mono_metadata_parse_signature (MonoImage *image,
uint32_t token);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoMethodSignature *mono_metadata_parse_method_signature (MonoImage *m,
int def,
const char *ptr,
const char **rptr);
MONO_API void mono_metadata_free_method_signature (MonoMethodSignature *method);
MONO_API mono_bool mono_metadata_signature_equal (MonoMethodSignature *sig1,
MonoMethodSignature *sig2);
MONO_API unsigned int mono_signature_hash (MonoMethodSignature *sig);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoMethodHeader *mono_metadata_parse_mh (MonoImage *m, const char *ptr);
MONO_API void mono_metadata_free_mh (MonoMethodHeader *mh);
/* MonoMethodHeader accessors */
MONO_API const unsigned char*
mono_method_header_get_code (MonoMethodHeader *header, uint32_t* code_size, uint32_t* max_stack);
MONO_API MonoType**
mono_method_header_get_locals (MonoMethodHeader *header, uint32_t* num_locals, mono_bool *init_locals);
MONO_API int
mono_method_header_get_num_clauses (MonoMethodHeader *header);
MONO_API int
mono_method_header_get_clauses (MonoMethodHeader *header, MonoMethod *method, void **iter, MonoExceptionClause *clause);
MONO_API uint32_t
mono_type_to_unmanaged (MonoType *type, MonoMarshalSpec *mspec,
mono_bool as_field, mono_bool unicode, MonoMarshalConv *conv);
/*
* Makes a token based on a table and an index
*/
#define mono_metadata_make_token(table,idx) (((table) << 24)| (idx))
/*
* Returns the table index that this token encodes.
*/
#define mono_metadata_token_table(token) ((token) >> 24)
/*
* Returns the index that a token refers to
*/
#define mono_metadata_token_index(token) ((token) & 0xffffff)
#define mono_metadata_token_code(token) ((token) & 0xff000000)
MONO_API uint32_t mono_metadata_token_from_dor (uint32_t dor_index);
MONO_API char *mono_guid_to_string (const uint8_t *guid);
MONO_API char *mono_guid_to_string_minimal (const uint8_t *guid);
MONO_API uint32_t mono_metadata_declsec_from_index (MonoImage *meta, uint32_t idx);
MONO_API uint32_t mono_metadata_translate_token_index (MonoImage *image, int table, uint32_t idx);
MONO_API void mono_metadata_decode_table_row (MonoImage *image, int table,
int idx,
uint32_t *res,
int res_size);
MONO_API uint32_t mono_metadata_decode_table_row_col (MonoImage *image, int table,
int idx,
unsigned int col);
MONO_END_DECLS
#endif /* __MONO_METADATA_H__ */
@@ -0,0 +1,38 @@
/**
* \file
*
* Author: Paolo Molaro (lupus@ximian.com)
*
* (C) 2002 Ximian, Inc.
*/
#ifndef __MONO_METADATA_CONFIG_H__
#define __MONO_METADATA_CONFIG_H__
#include <mono/utils/mono-publib.h>
#include <mono/metadata/image.h>
MONO_BEGIN_DECLS
MONO_API const char *mono_config_get_os (void);
MONO_API const char *mono_config_get_cpu (void);
MONO_API const char *mono_config_get_wordsize (void);
MONO_API const char* mono_get_config_dir (void);
MONO_API void mono_set_config_dir (const char *dir);
MONO_API const char* mono_get_machine_config (void);
MONO_API void mono_config_cleanup (void);
MONO_API void mono_config_parse (const char *filename);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_config_for_assembly (MonoImage *assembly);
MONO_API void mono_config_parse_memory (const char *buffer);
MONO_API const char* mono_config_string_for_assembly_file (const char *filename);
MONO_API void mono_config_set_server_mode (mono_bool server_mode);
MONO_API mono_bool mono_config_is_server_mode (void);
MONO_END_DECLS
#endif /* __MONO_METADATA_CONFIG_H__ */
@@ -0,0 +1,231 @@
/**
* \file
* This header is only installed for use by the debugger:
* the structures and the API declared here are not supported.
*/
#ifndef __MONO_DEBUG_H__
#define __MONO_DEBUG_H__
#include <mono/utils/mono-publib.h>
#include <mono/metadata/image.h>
#include <mono/metadata/appdomain.h>
MONO_BEGIN_DECLS
typedef struct _MonoSymbolTable MonoSymbolTable;
typedef struct _MonoDebugDataTable MonoDebugDataTable;
typedef struct _MonoSymbolFile MonoSymbolFile;
typedef struct _MonoPPDBFile MonoPPDBFile;
typedef struct _MonoDebugHandle MonoDebugHandle;
typedef struct _MonoDebugLineNumberEntry MonoDebugLineNumberEntry;
typedef struct _MonoDebugVarInfo MonoDebugVarInfo;
typedef struct _MonoDebugMethodJitInfo MonoDebugMethodJitInfo;
typedef struct _MonoDebugMethodAddress MonoDebugMethodAddress;
typedef struct _MonoDebugMethodAddressList MonoDebugMethodAddressList;
typedef struct _MonoDebugClassEntry MonoDebugClassEntry;
typedef struct _MonoDebugMethodInfo MonoDebugMethodInfo;
typedef struct _MonoDebugLocalsInfo MonoDebugLocalsInfo;
typedef struct _MonoDebugMethodAsyncInfo MonoDebugMethodAsyncInfo;
typedef struct _MonoDebugSourceLocation MonoDebugSourceLocation;
typedef struct _MonoDebugList MonoDebugList;
typedef enum {
MONO_DEBUG_FORMAT_NONE,
MONO_DEBUG_FORMAT_MONO,
/* Deprecated, the mdb debugger is not longer supported. */
MONO_DEBUG_FORMAT_DEBUGGER
} MonoDebugFormat;
/*
* NOTE:
* We intentionally do not use GList here since the debugger needs to know about
* the layout of the fields.
*/
struct _MonoDebugList {
MonoDebugList *next;
const void* data;
};
struct _MonoSymbolTable {
uint64_t magic;
uint32_t version;
uint32_t total_size;
/*
* Corlib and metadata info.
*/
MonoDebugHandle *corlib;
MonoDebugDataTable *global_data_table;
MonoDebugList *data_tables;
/*
* The symbol files.
*/
MonoDebugList *symbol_files;
};
struct _MonoDebugHandle {
uint32_t index;
char *image_file;
MonoImage *image;
MonoDebugDataTable *type_table;
MonoSymbolFile *symfile;
MonoPPDBFile *ppdb;
};
struct _MonoDebugMethodJitInfo {
const mono_byte *code_start;
uint32_t code_size;
uint32_t prologue_end;
uint32_t epilogue_begin;
const mono_byte *wrapper_addr;
uint32_t num_line_numbers;
MonoDebugLineNumberEntry *line_numbers;
uint32_t has_var_info;
uint32_t num_params;
MonoDebugVarInfo *this_var;
MonoDebugVarInfo *params;
uint32_t num_locals;
MonoDebugVarInfo *locals;
MonoDebugVarInfo *gsharedvt_info_var;
MonoDebugVarInfo *gsharedvt_locals_var;
};
struct _MonoDebugMethodAddressList {
uint32_t size;
uint32_t count;
mono_byte data [MONO_ZERO_LEN_ARRAY];
};
struct _MonoDebugSourceLocation {
char *source_file;
uint32_t row, column;
uint32_t il_offset;
};
MONO_API mono_bool mono_debug_enabled (void);
/*
* These bits of the MonoDebugLocalInfo's "index" field are flags specifying
* where the variable is actually stored.
*
* See relocate_variable() in debug-symfile.c for more info.
*/
#define MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS 0xf0000000
/* The variable is in register "index". */
#define MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER 0
/* The variable is at offset "offset" from register "index". */
#define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET 0x10000000
/* The variable is in the two registers "offset" and "index". */
#define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS 0x20000000
/* The variable is dead. */
#define MONO_DEBUG_VAR_ADDRESS_MODE_DEAD 0x30000000
/* Same as REGOFFSET, but do an indirection */
#define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR 0x40000000
/* gsharedvt local */
#define MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL 0x50000000
/* variable is a vt address */
#define MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR 0x60000000
struct _MonoDebugVarInfo {
uint32_t index;
uint32_t offset;
uint32_t size;
uint32_t begin_scope;
uint32_t end_scope;
MonoType *type;
};
#define MONO_DEBUGGER_MAJOR_VERSION 81
#define MONO_DEBUGGER_MINOR_VERSION 6
#define MONO_DEBUGGER_MAGIC 0x7aff65af4253d427ULL
MONO_API void mono_debug_init (MonoDebugFormat format);
MONO_API void mono_debug_open_image_from_memory (MonoImage *image, const mono_byte *raw_contents, int size);
MONO_API void mono_debug_cleanup (void);
MONO_API void mono_debug_close_image (MonoImage *image);
MONO_API void mono_debug_domain_unload (MonoDomain *domain);
MONO_API void mono_debug_domain_create (MonoDomain *domain);
MONO_API MonoDebugMethodAddress *
mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDomain *domain);
MONO_API void
mono_debug_remove_method (MonoMethod *method, MonoDomain *domain);
MONO_API MonoDebugMethodInfo *
mono_debug_lookup_method (MonoMethod *method);
MONO_API MonoDebugMethodAddressList *
mono_debug_lookup_method_addresses (MonoMethod *method);
MONO_API MonoDebugMethodJitInfo*
mono_debug_find_method (MonoMethod *method, MonoDomain *domain);
MONO_API MonoDebugHandle *
mono_debug_get_handle (MonoImage *image);
MONO_API void
mono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit);
MONO_API void
mono_debug_add_delegate_trampoline (void* code, int size);
MONO_API MonoDebugLocalsInfo*
mono_debug_lookup_locals (MonoMethod *method);
MonoDebugMethodAsyncInfo*
mono_debug_lookup_method_async_debug_info (MonoMethod *method);
MONO_API
MonoDebugSourceLocation *
mono_debug_method_lookup_location (MonoDebugMethodInfo *minfo, int il_offset);
/*
* Line number support.
*/
MONO_API MonoDebugSourceLocation *
mono_debug_lookup_source_location (MonoMethod *method, uint32_t address, MonoDomain *domain);
MONO_API int32_t
mono_debug_il_offset_from_address (MonoMethod *method, MonoDomain *domain, uint32_t native_offset);
MONO_API void
mono_debug_free_source_location (MonoDebugSourceLocation *location);
MONO_API char *
mono_debug_print_stack_frame (MonoMethod *method, uint32_t native_offset, MonoDomain *domain);
/*
* Mono Debugger support functions
*
* These methods are used by the JIT while running inside the Mono Debugger.
*/
MONO_API int mono_debugger_method_has_breakpoint (MonoMethod *method);
MONO_API int mono_debugger_insert_breakpoint (const char *method_name, mono_bool include_namespace);
MONO_API void mono_set_is_debugger_attached (mono_bool attached);
MONO_API mono_bool mono_is_debugger_attached (void);
MONO_END_DECLS
#endif /* __MONO_DEBUG_H__ */
@@ -0,0 +1,138 @@
/**
* \file
* GC related public interface
*
*/
#ifndef __METADATA_MONO_GC_H__
#define __METADATA_MONO_GC_H__
#include <mono/metadata/object.h>
MONO_BEGIN_DECLS
typedef int (*MonoGCReferences) (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data);
/**
* This enum is used by the profiler API when reporting root registration.
*/
typedef enum {
/**
* Roots external to Mono. Embedders may only use this value.
*/
MONO_ROOT_SOURCE_EXTERNAL = 0,
/**
* Thread call stack.
*
* The \c key parameter is a thread ID as a \c uintptr_t.
*/
MONO_ROOT_SOURCE_STACK = 1,
/**
* Roots in the finalizer queue. This is a pseudo-root.
*/
MONO_ROOT_SOURCE_FINALIZER_QUEUE = 2,
/**
* Managed \c static variables.
*
* The \c key parameter is a \c MonoVTable pointer.
*/
MONO_ROOT_SOURCE_STATIC = 3,
/**
* Managed \c static variables with \c ThreadStaticAttribute.
*
* The \c key parameter is a thread ID as a \c uintptr_t.
*/
MONO_ROOT_SOURCE_THREAD_STATIC = 4,
/**
* Managed \c static variables with \c ContextStaticAttribute.
*
* The \c key parameter is a \c MonoAppContext pointer.
*/
MONO_ROOT_SOURCE_CONTEXT_STATIC = 5,
/**
* \c GCHandle structures.
*/
MONO_ROOT_SOURCE_GC_HANDLE = 6,
/**
* Roots in the just-in-time compiler.
*/
MONO_ROOT_SOURCE_JIT = 7,
/**
* Roots in the threading subsystem.
*
* The \c key parameter, if not \c NULL, is a thread ID as a \c uintptr_t.
*/
MONO_ROOT_SOURCE_THREADING = 8,
/**
* Roots in application domains.
*
* The \c key parameter, if not \c NULL, is a \c MonoDomain pointer.
*/
MONO_ROOT_SOURCE_DOMAIN = 9,
/**
* Roots in reflection code.
*
* The \c key parameter, if not \c NULL, is a \c MonoVTable pointer.
*/
MONO_ROOT_SOURCE_REFLECTION = 10,
/**
* Roots from P/Invoke or other marshaling infrastructure.
*/
MONO_ROOT_SOURCE_MARSHAL = 11,
/**
* Roots in the thread pool data structures.
*/
MONO_ROOT_SOURCE_THREAD_POOL = 12,
/**
* Roots in the debugger agent.
*/
MONO_ROOT_SOURCE_DEBUGGER = 13,
/**
* Roots in the runtime handle stack. This is a pseudo-root.
*
* The \c key parameter is a thread ID as a \c uintptr_t.
*/
MONO_ROOT_SOURCE_HANDLE = 14,
/**
* Roots in the ephemeron arrays. This is a pseudo-root.
*/
MONO_ROOT_SOURCE_EPHEMERON = 15,
/**
* Roots in the toggleref arrays. This is a pseudo-root.
*/
MONO_ROOT_SOURCE_TOGGLEREF = 16,
} MonoGCRootSource;
typedef enum {
MONO_GC_HANDLE_TYPE_MIN = 0,
MONO_GC_HANDLE_WEAK = MONO_GC_HANDLE_TYPE_MIN,
MONO_GC_HANDLE_WEAK_TRACK_RESURRECTION,
MONO_GC_HANDLE_NORMAL,
MONO_GC_HANDLE_PINNED,
MONO_GC_HANDLE_TYPE_MAX,
} MonoGCHandleType;
MONO_API void mono_gc_collect (int generation);
MONO_API int mono_gc_max_generation (void);
MONO_API int mono_gc_get_generation (MonoObject *object);
MONO_API int mono_gc_collection_count (int generation);
MONO_API int64_t mono_gc_get_used_size (void);
MONO_API int64_t mono_gc_get_heap_size (void);
MONO_API MonoBoolean mono_gc_pending_finalizers (void);
MONO_API void mono_gc_finalize_notify (void);
MONO_API int mono_gc_invoke_finalizers (void);
/* heap walking is only valid in the pre-stop-world event callback */
MONO_API int mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_gc_init_finalizer_thread (void);
/*
* Only supported under SGen. These two with Sgen will take and release the LOCK_GC
*/
void mono_gc_stop_world (void);
void mono_gc_restart_world (void);
MONO_END_DECLS
#endif /* __METADATA_MONO_GC_H__ */
@@ -0,0 +1,41 @@
/**
* \file
*
* Private unstable APIs.
*
* WARNING: The declarations and behavior of functions in this header are NOT STABLE and can be modified or removed at
* any time.
*
*/
#ifndef __MONO_METADATA_MONO_PRIVATE_UNSTABLE_H__
#define __MONO_METADATA_MONO_PRIVATE_UNSTABLE_H__
#include <mono/utils/mono-publib.h>
typedef MonoGCHandle MonoAssemblyLoadContextGCHandle;
MONO_API MONO_RT_EXTERNAL_ONLY MonoAssembly *
mono_assembly_load_full_alc (MonoAssemblyLoadContextGCHandle alc_gchandle, MonoAssemblyName *aname, const char *basedir, MonoImageOpenStatus *status);
MONO_API MONO_RT_EXTERNAL_ONLY MonoImage *
mono_image_open_from_data_alc (MonoAssemblyLoadContextGCHandle alc_gchandle, char *data, uint32_t data_len, mono_bool need_copy, MonoImageOpenStatus *status, const char *name);
typedef MonoAssembly * (*MonoAssemblyPreLoadFuncV3) (MonoAssemblyLoadContextGCHandle alc_gchandle, MonoAssemblyName *aname, char **assemblies_path, void *user_data, MonoError *error);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_install_assembly_preload_hook_v3 (MonoAssemblyPreLoadFuncV3 func, void *user_data, mono_bool append);
MONO_API MONO_RT_EXTERNAL_ONLY MonoAssemblyLoadContextGCHandle
mono_alc_get_default_gchandle (void);
typedef struct _MonoBundledSatelliteAssembly MonoBundledSatelliteAssembly;
MONO_API void
mono_register_bundled_satellite_assemblies (const MonoBundledSatelliteAssembly **assemblies);
MONO_API MonoBundledSatelliteAssembly *
mono_create_new_bundled_satellite_assembly (const char *name, const char *culture, const unsigned char *data, unsigned int size);
#endif /*__MONO_METADATA_MONO_PRIVATE_UNSTABLE_H__*/
@@ -0,0 +1,22 @@
/**
* \file
*
* Forward declarations of opaque types, and typedefs thereof.
*
*/
#ifndef __MONO_OBJECT_FORWARD_H__
#define __MONO_OBJECT_FORWARD_H__
#include <mono/utils/mono-publib.h>
typedef struct _MonoClass MonoClass;
typedef struct _MonoImage MonoImage;
typedef struct _MonoMethod MonoMethod;
typedef struct _MonoObject MONO_RT_MANAGED_ATTR MonoObject;
typedef struct _MonoException MONO_RT_MANAGED_ATTR MonoException;
typedef struct _MonoReflectionAssembly MONO_RT_MANAGED_ATTR MonoReflectionAssembly;
typedef struct _MonoReflectionTypeBuilder MONO_RT_MANAGED_ATTR MonoReflectionTypeBuilder;
#endif /* __MONO_OBJECT_FORWARD_H__ */
@@ -0,0 +1,404 @@
/**
* \file
*/
#ifndef _MONO_CLI_OBJECT_H_
#define _MONO_CLI_OBJECT_H_
#include <mono/utils/mono-forward.h>
#include <mono/metadata/object-forward.h>
#include <mono/metadata/class.h>
#include <mono/utils/mono-error.h>
MONO_BEGIN_DECLS
typedef struct _MonoString MONO_RT_MANAGED_ATTR MonoString;
typedef struct _MonoArray MONO_RT_MANAGED_ATTR MonoArray;
typedef struct _MonoReflectionMethod MONO_RT_MANAGED_ATTR MonoReflectionMethod;
typedef struct _MonoReflectionModule MONO_RT_MANAGED_ATTR MonoReflectionModule;
typedef struct _MonoReflectionField MONO_RT_MANAGED_ATTR MonoReflectionField;
typedef struct _MonoReflectionProperty MONO_RT_MANAGED_ATTR MonoReflectionProperty;
typedef struct _MonoReflectionEvent MONO_RT_MANAGED_ATTR MonoReflectionEvent;
typedef struct _MonoReflectionType MONO_RT_MANAGED_ATTR MonoReflectionType;
typedef struct _MonoDelegate MONO_RT_MANAGED_ATTR MonoDelegate;
typedef struct _MonoThreadsSync MonoThreadsSync;
typedef struct _MonoThread MONO_RT_MANAGED_ATTR MonoThread;
typedef struct _MonoDynamicAssembly MonoDynamicAssembly;
typedef struct _MonoDynamicImage MonoDynamicImage;
typedef struct _MonoReflectionMethodBody MONO_RT_MANAGED_ATTR MonoReflectionMethodBody;
typedef struct _MonoAppContext MONO_RT_MANAGED_ATTR MonoAppContext;
struct _MonoObject {
MonoVTable *vtable;
MonoThreadsSync *synchronisation;
};
typedef MonoObject* (*MonoInvokeFunc) (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error);
typedef void* (*MonoCompileFunc) (MonoMethod *method);
typedef void (*MonoMainThreadFunc) (void* user_data);
#define MONO_OBJECT_SETREF(obj,fieldname,value) do { \
mono_gc_wbarrier_set_field ((MonoObject*)(obj), &((obj)->fieldname), (MonoObject*)value); \
/*(obj)->fieldname = (value);*/ \
} while (0)
/* This should be used if 's' can reside on the heap */
#define MONO_STRUCT_SETREF(s,field,value) do { \
mono_gc_wbarrier_generic_store (&((s)->field), (MonoObject*)(value)); \
} while (0)
#define mono_array_addr(array,type,index) ((type*)mono_array_addr_with_size ((array), sizeof (type), (index)))
#define mono_array_get(array,type,index) ( *(type*)mono_array_addr ((array), type, (index)) )
#define mono_array_set(array,type,index,value) \
do { \
type *__p = (type *) mono_array_addr ((array), type, (index)); \
*__p = (value); \
} while (0)
#define mono_array_setref(array,index,value) \
do { \
void **__p = (void **) mono_array_addr ((array), void*, (index)); \
mono_gc_wbarrier_set_arrayref ((array), __p, (MonoObject*)(value)); \
/* *__p = (value);*/ \
} while (0)
#define mono_array_memcpy_refs(dest,destidx,src,srcidx,count) \
do { \
void **__p = (void **) mono_array_addr ((dest), void*, (destidx)); \
void **__s = mono_array_addr ((src), void*, (srcidx)); \
mono_gc_wbarrier_arrayref_copy (__p, __s, (count)); \
} while (0)
MONO_API MONO_RT_EXTERNAL_ONLY mono_unichar2 *mono_string_chars (MonoString *s);
MONO_API MONO_RT_EXTERNAL_ONLY int mono_string_length (MonoString *s);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_object_new (MonoDomain *domain, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoObject *
mono_object_new_specific (MonoVTable *vtable);
/* can be used for classes without finalizer in non-profiling mode */
MONO_API MONO_RT_EXTERNAL_ONLY
MonoObject *
mono_object_new_fast (MonoVTable *vtable);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoObject *
mono_object_new_alloc_specific (MonoVTable *vtable);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoObject *
mono_object_new_from_token (MonoDomain *domain, MonoImage *image, uint32_t token);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray*
mono_array_new (MonoDomain *domain, MonoClass *eclass, uintptr_t n);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray*
mono_array_new_full (MonoDomain *domain, MonoClass *array_class,
uintptr_t *lengths, intptr_t *lower_bounds);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray *
mono_array_new_specific (MonoVTable *vtable, uintptr_t n);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray*
mono_array_clone (MonoArray *array);
MONO_API MONO_RT_EXTERNAL_ONLY char*
mono_array_addr_with_size (MonoArray *array, int size, uintptr_t idx);
MONO_API MONO_RT_EXTERNAL_ONLY uintptr_t
mono_array_length (MonoArray *array);
MONO_API MONO_RT_EXTERNAL_ONLY MonoString*
mono_string_empty (MonoDomain *domain);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_string_empty_wrapper (void);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_string_new_utf16 (MonoDomain *domain, const mono_unichar2 *text, int32_t len);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_string_new_size (MonoDomain *domain, int32_t len);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_ldstr (MonoDomain *domain, MonoImage *image, uint32_t str_index);
MONO_API MONO_RT_EXTERNAL_ONLY MonoString*
mono_string_is_interned (MonoString *str);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_string_intern (MonoString *str);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_string_new (MonoDomain *domain, const char *text);
MONO_API MONO_RT_EXTERNAL_ONLY MonoString*
mono_string_new_wrapper (const char *text);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_string_new_len (MonoDomain *domain, const char *text, unsigned int length);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString*
mono_string_new_utf32 (MonoDomain *domain, const mono_unichar4 *text, int32_t len);
MONO_API MONO_RT_EXTERNAL_ONLY
char *
mono_string_to_utf8 (MonoString *string_obj);
MONO_API MONO_RT_EXTERNAL_ONLY char *
mono_string_to_utf8_checked (MonoString *string_obj, MonoError *error);
MONO_API MONO_RT_EXTERNAL_ONLY mono_unichar2 *
mono_string_to_utf16 (MonoString *string_obj);
MONO_API MONO_RT_EXTERNAL_ONLY mono_unichar4 *
mono_string_to_utf32 (MonoString *string_obj);
MONO_API MONO_RT_EXTERNAL_ONLY MonoString *
mono_string_from_utf16 (/*const*/ mono_unichar2 *data);
MONO_API MONO_RT_EXTERNAL_ONLY MonoString *
mono_string_from_utf32 (/*const*/ mono_unichar4 *data);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_string_equal (MonoString *s1, MonoString *s2);
MONO_API MONO_RT_EXTERNAL_ONLY unsigned int
mono_string_hash (MonoString *s);
MONO_API MONO_RT_EXTERNAL_ONLY int
mono_object_hash (MonoObject* obj);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoString *
mono_object_to_string (MonoObject *obj, MonoObject **exc);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_value_box (MonoDomain *domain, MonoClass *klass, void* val);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_value_copy (void* dest, /*const*/ void* src, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_value_copy_array (MonoArray *dest, int dest_idx, void* src, int count);
MONO_API MONO_RT_EXTERNAL_ONLY MonoVTable*
mono_object_get_vtable (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain*
mono_object_get_domain (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass*
mono_object_get_class (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY void*
mono_object_unbox (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_object_clone (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_object_isinst (MonoObject *obj, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_object_isinst_mbyref (MonoObject *obj, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_monitor_try_enter (MonoObject *obj, uint32_t ms);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_monitor_enter (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_monitor_enter_v4 (MonoObject *obj, char *lock_taken);
MONO_API MONO_RT_EXTERNAL_ONLY unsigned int
mono_object_get_size (MonoObject *o);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_monitor_exit (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_raise_exception (MonoException *ex);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_runtime_set_pending_exception (MonoException *exc, mono_bool overwrite);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_reraise_exception (MonoException *ex);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_runtime_object_init (MonoObject *this_obj);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_runtime_class_init (MonoVTable *vtable);
MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain*
mono_vtable_domain (MonoVTable *vtable);
MONO_API MONO_RT_EXTERNAL_ONLY MonoClass*
mono_vtable_class (MonoVTable *vtable);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod*
mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject*
mono_runtime_invoke (MonoMethod *method, void *obj, void **params,
MonoObject **exc);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod*
mono_get_delegate_invoke (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod*
mono_get_delegate_begin_invoke (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod*
mono_get_delegate_end_invoke (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject*
mono_runtime_delegate_invoke (MonoObject *delegate, void **params,
MonoObject **exc);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject*
mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
MonoObject **exc);
MONO_API MONO_RT_EXTERNAL_ONLY void*
mono_method_get_unmanaged_thunk (MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY MonoArray*
mono_runtime_get_main_args (void);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_runtime_exec_managed_code (MonoDomain *domain,
MonoMainThreadFunc main_func,
void* main_args);
MONO_API MONO_RT_EXTERNAL_ONLY int
mono_runtime_run_main (MonoMethod *method, int argc, char* argv[],
MonoObject **exc);
MONO_API MONO_RT_EXTERNAL_ONLY int
mono_runtime_exec_main (MonoMethod *method, MonoArray *args,
MonoObject **exc);
MONO_API MONO_RT_EXTERNAL_ONLY int
mono_runtime_set_main_args (int argc, char* argv[]);
/* The following functions won't be available with mono was configured with remoting disabled. */
/*#ifndef DISABLE_REMOTING */
MONO_API MONO_RT_EXTERNAL_ONLY void*
mono_load_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void **res);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_load_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_store_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void* val);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_store_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg);
/* #endif */
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_unhandled_exception (MonoObject *exc);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_print_unhandled_exception (MonoObject *exc);
MONO_API MONO_RT_EXTERNAL_ONLY
void*
mono_compile_method (MonoMethod *method);
/* accessors for fields and properties */
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_field_set_value (MonoObject *obj, MonoClassField *field, void *value);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_field_get_value (MonoObject *obj, MonoClassField *field, void *value);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject *
mono_field_get_value_object (MonoDomain *domain, MonoClassField *field, MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject*
mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc);
/* GC handles support
*
* A handle can be created to refer to a managed object and either prevent it
* from being garbage collected or moved or to be able to know if it has been
* collected or not (weak references).
* mono_gchandle_new () is used to prevent an object from being garbage collected
* until mono_gchandle_free() is called. Use a TRUE value for the pinned argument to
* prevent the object from being moved (this should be avoided as much as possible
* and this should be used only for shorts periods of time or performance will suffer).
* To create a weakref use mono_gchandle_new_weakref (): track_resurrection should
* usually be false (see the GC docs for more details).
* mono_gchandle_get_target () can be used to get the object referenced by both kinds
* of handle: for a weakref handle, if an object has been collected, it will return NULL.
*/
MONO_API MONO_RT_EXTERNAL_ONLY uint32_t mono_gchandle_new (MonoObject *obj, mono_bool pinned);
MONO_API MONO_RT_EXTERNAL_ONLY uint32_t mono_gchandle_new_weakref (MonoObject *obj, mono_bool track_resurrection);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject* mono_gchandle_get_target (uint32_t gchandle);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gchandle_free (uint32_t gchandle);
MONO_API MONO_RT_EXTERNAL_ONLY MonoGCHandle mono_gchandle_new_v2 (MonoObject *obj, mono_bool pinned);
MONO_API MONO_RT_EXTERNAL_ONLY MonoGCHandle mono_gchandle_new_weakref_v2 (MonoObject *obj, mono_bool track_resurrection);
MONO_API MONO_RT_EXTERNAL_ONLY MonoObject* mono_gchandle_get_target_v2 (MonoGCHandle gchandle);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gchandle_free_v2 (MonoGCHandle gchandle);
/* Reference queue support
*
* A reference queue is used to get notifications of when objects are collected.
* Call mono_gc_reference_queue_new to create a new queue and pass the callback that
* will be invoked when registered objects are collected.
* Call mono_gc_reference_queue_add to register a pair of objects and data within a queue.
* The callback will be triggered once an object is both unreachable and finalized.
*/
typedef void (*mono_reference_queue_callback) (void *user_data);
typedef struct _MonoReferenceQueue MonoReferenceQueue;
MONO_API MONO_RT_EXTERNAL_ONLY MonoReferenceQueue* mono_gc_reference_queue_new (mono_reference_queue_callback callback);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_reference_queue_free (MonoReferenceQueue *queue);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void *user_data);
/* GC write barriers support */
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_set_field (MonoObject *obj, void* field_ptr, MonoObject* value);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_set_arrayref (MonoArray *arr, void* slot_ptr, MonoObject* value);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_arrayref_copy (void* dest_ptr, /*const*/ void* src_ptr, int count);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_generic_store (void* ptr, MonoObject* value);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_generic_store_atomic (void *ptr, MonoObject *value);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_generic_nostore (void* ptr);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_value_copy (void* dest, /*const*/ void* src, int count, MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src);
MONO_END_DECLS
#endif
@@ -0,0 +1,83 @@
/**
* \file
*/
#ifndef __MONO_METADATA_OPCODES_H__
#define __MONO_METADATA_OPCODES_H__
/*
* opcodes.h: CIL instruction information
*
* Author:
* Paolo Molaro (lupus@ximian.com)
*
* (C) 2002 Ximian, Inc.
*/
#include <mono/utils/mono-publib.h>
MONO_BEGIN_DECLS
#define MONO_CUSTOM_PREFIX 0xf0
#define OPDEF(a,b,c,d,e,f,g,h,i,j) \
MONO_ ## a,
typedef enum MonoOpcodeEnum {
MonoOpcodeEnum_Invalid = -1,
#include "mono/cil/opcode.def"
MONO_CEE_LAST
} MonoOpcodeEnum;
#undef OPDEF
enum {
MONO_FLOW_NEXT,
MONO_FLOW_BRANCH,
MONO_FLOW_COND_BRANCH,
MONO_FLOW_ERROR,
MONO_FLOW_CALL,
MONO_FLOW_RETURN,
MONO_FLOW_META
};
enum {
MonoInlineNone = 0,
MonoInlineType = 1,
MonoInlineField = 2,
MonoInlineMethod = 3,
MonoInlineTok = 4,
MonoInlineString = 5,
MonoInlineSig = 6,
MonoInlineVar = 7,
MonoShortInlineVar = 8,
MonoInlineBrTarget = 9,
MonoShortInlineBrTarget = 10,
MonoInlineSwitch = 11,
MonoInlineR = 12,
MonoShortInlineR = 13,
MonoInlineI = 14,
MonoShortInlineI = 15,
MonoInlineI8 = 16,
};
typedef struct {
unsigned char argument;
unsigned char flow_type;
unsigned short opval;
} MonoOpcode;
MONO_BEGIN_DECLS
MONO_API_DATA const MonoOpcode mono_opcodes [];
MONO_END_DECLS
MONO_API const char*
mono_opcode_name (int opcode);
MONO_API MonoOpcodeEnum
mono_opcode_value (const mono_byte **ip, const mono_byte *end);
MONO_END_DECLS
#endif /* __MONO_METADATA_OPCODES_H__ */
@@ -0,0 +1,108 @@
/*
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
*/
/*
* To #include this file, #define the following macros first:
*
* MONO_PROFILER_EVENT_0(name, type)
* MONO_PROFILER_EVENT_1(name, type, arg1_type, arg1_name)
* MONO_PROFILER_EVENT_2(name, type, arg1_type, arg1_name, arg2_type, arg2_name)
* MONO_PROFILER_EVENT_3(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name)
* MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name)
* MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name)
*
* To add new callbacks to the API, simply add a line in this file and use
* MONO_PROFILER_RAISE to raise the event wherever.
*
* If you need more arguments then the current macros provide, add another
* macro and update all areas where the macros are used. Remember that this is
* a public header and not all users will be defining the newly added macro. So
* to prevent errors in existing code, you must add something like this at the
* beginning of this file:
*
* #ifndef MONO_PROFILER_EVENT_6
* #define MONO_PROFILER_EVENT_6(...) # Do nothing.
* #endif
*/
#ifndef MONO_PROFILER_EVENT_5
#define MONO_PROFILER_EVENT_5(...)
#endif
MONO_PROFILER_EVENT_0(runtime_initialized, RuntimeInitialized)
MONO_PROFILER_EVENT_0(runtime_shutdown_begin, RuntimeShutdownBegin)
MONO_PROFILER_EVENT_0(runtime_shutdown_end, RuntimeShutdownEnd)
MONO_PROFILER_EVENT_1(context_loaded, ContextLoaded, MonoAppContext *, context)
MONO_PROFILER_EVENT_1(context_unloaded, ContextUnloaded, MonoAppContext *, context)
MONO_PROFILER_EVENT_1(domain_loading, DomainLoading, MonoDomain *, domain)
MONO_PROFILER_EVENT_1(domain_loaded, DomainLoaded, MonoDomain *, domain)
MONO_PROFILER_EVENT_1(domain_unloading, DomainUnloading, MonoDomain *, domain)
MONO_PROFILER_EVENT_1(domain_unloaded, DomainUnloaded, MonoDomain *, domain)
MONO_PROFILER_EVENT_2(domain_name, DomainName, MonoDomain *, domain, const char *, name)
MONO_PROFILER_EVENT_1(jit_begin, JitBegin, MonoMethod *, method)
MONO_PROFILER_EVENT_1(jit_failed, JitFailed, MonoMethod *, method)
MONO_PROFILER_EVENT_2(jit_done, JitDone, MonoMethod *, method, MonoJitInfo *, jinfo)
MONO_PROFILER_EVENT_2(jit_chunk_created, JitChunkCreated, const mono_byte *, chunk, uintptr_t, size)
MONO_PROFILER_EVENT_1(jit_chunk_destroyed, JitChunkDestroyed, const mono_byte *, chunk)
MONO_PROFILER_EVENT_4(jit_code_buffer, JitCodeBuffer, const mono_byte *, buffer, uint64_t, size, MonoProfilerCodeBufferType, type, const void *, data)
MONO_PROFILER_EVENT_1(class_loading, ClassLoading, MonoClass *, klass)
MONO_PROFILER_EVENT_1(class_failed, ClassFailed, MonoClass *, klass)
MONO_PROFILER_EVENT_1(class_loaded, ClassLoaded, MonoClass *, klass)
MONO_PROFILER_EVENT_1(vtable_loading, VTableLoading, MonoVTable *, vtable)
MONO_PROFILER_EVENT_1(vtable_failed, VTableFailed, MonoVTable *, vtable)
MONO_PROFILER_EVENT_1(vtable_loaded, VTableLoaded, MonoVTable *, vtable)
MONO_PROFILER_EVENT_1(image_loading, ModuleLoading, MonoImage *, image)
MONO_PROFILER_EVENT_1(image_failed, ModuleFailed, MonoImage *, image)
MONO_PROFILER_EVENT_1(image_loaded, ModuleLoaded, MonoImage *, image)
MONO_PROFILER_EVENT_1(image_unloading, ModuleUnloading, MonoImage *, image)
MONO_PROFILER_EVENT_1(image_unloaded, ModuleUnloaded, MonoImage *, image)
MONO_PROFILER_EVENT_1(assembly_loading, AssemblyLoading, MonoAssembly *, assembly)
MONO_PROFILER_EVENT_1(assembly_loaded, AssemblyLLoaded, MonoAssembly *, assembly)
MONO_PROFILER_EVENT_1(assembly_unloading, AssemblyLUnloading, MonoAssembly *, assembly)
MONO_PROFILER_EVENT_1(assembly_unloaded, AssemblyLUnloaded, MonoAssembly *, assembly)
MONO_PROFILER_EVENT_2(method_enter, MethodEnter, MonoMethod *, method, MonoProfilerCallContext *, context)
MONO_PROFILER_EVENT_2(method_leave, MethodLeave, MonoMethod *, method, MonoProfilerCallContext *, context)
MONO_PROFILER_EVENT_2(method_tail_call, MethodTailCall, MonoMethod *, method, MonoMethod *, target)
MONO_PROFILER_EVENT_2(method_exception_leave, MethodExceptionLeave, MonoMethod *, method, MonoObject *, exception)
MONO_PROFILER_EVENT_1(method_free, MethodFree, MonoMethod *, method)
MONO_PROFILER_EVENT_1(method_begin_invoke, MethodBeginInvoke, MonoMethod *, method)
MONO_PROFILER_EVENT_1(method_end_invoke, MethodEndInvoke, MonoMethod *, method)
MONO_PROFILER_EVENT_1(exception_throw, ExceptionThrow, MonoObject *, exception)
MONO_PROFILER_EVENT_4(exception_clause, ExceptionClause, MonoMethod *, method, uint32_t, index, MonoExceptionEnum, type, MonoObject *, exception)
MONO_PROFILER_EVENT_3(gc_event, GCEvent2, MonoProfilerGCEvent, event, uint32_t, generation, mono_bool, is_serial)
MONO_PROFILER_EVENT_1(gc_allocation, GCAllocation, MonoObject *, object)
MONO_PROFILER_EVENT_2(gc_moves, GCMoves, MonoObject *const *, objects, uint64_t, count)
MONO_PROFILER_EVENT_1(gc_resize, GCResize, uintptr_t, size)
MONO_PROFILER_EVENT_3(gc_handle_created, GCHandleCreated, uint32_t, handle, MonoGCHandleType, type, MonoObject *, object)
MONO_PROFILER_EVENT_2(gc_handle_deleted, GCHandleDeleted, uint32_t, handle, MonoGCHandleType, type)
MONO_PROFILER_EVENT_0(gc_finalizing, GCFinalizing)
MONO_PROFILER_EVENT_0(gc_finalized, GCFinalized)
MONO_PROFILER_EVENT_1(gc_finalizing_object, GCFinalizingObject, MonoObject *, object)
MONO_PROFILER_EVENT_1(gc_finalized_object, GCFinalizedObject, MonoObject *, object)
MONO_PROFILER_EVENT_5(gc_root_register, RootRegister, const mono_byte *, start, uintptr_t, size, MonoGCRootSource, source, const void *, key, const char *, name)
MONO_PROFILER_EVENT_1(gc_root_unregister, RootUnregister, const mono_byte *, start)
MONO_PROFILER_EVENT_3(gc_roots, GCRoots, uint64_t, count, const mono_byte *const *, addresses, MonoObject *const *, objects)
MONO_PROFILER_EVENT_1(monitor_contention, MonitorContention, MonoObject *, object)
MONO_PROFILER_EVENT_1(monitor_failed, MonitorFailed, MonoObject *, object)
MONO_PROFILER_EVENT_1(monitor_acquired, MonitorAcquired, MonoObject *, object)
MONO_PROFILER_EVENT_1(thread_started, ThreadStarted, uintptr_t, tid)
MONO_PROFILER_EVENT_1(thread_stopping, ThreadStopping, uintptr_t, tid)
MONO_PROFILER_EVENT_1(thread_stopped, ThreadStopped, uintptr_t, tid)
MONO_PROFILER_EVENT_1(thread_exited, ThreadExited, uintptr_t, tid)
MONO_PROFILER_EVENT_2(thread_name, ThreadName, uintptr_t, tid, const char *, name)
MONO_PROFILER_EVENT_2(sample_hit, SampleHit, const mono_byte *, ip, const void *, context)
@@ -0,0 +1,248 @@
/*
* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
*/
#ifndef __MONO_PROFILER_H__
#define __MONO_PROFILER_H__
#include <mono/metadata/appdomain.h>
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/object.h>
MONO_BEGIN_DECLS
/**
* This value will be incremented whenever breaking changes to the profiler API
* are made. This macro is intended for use in profiler modules that wish to
* support older versions of the profiler API.
*
* Version 2:
* - Major overhaul of the profiler API.
* Version 3:
* - Added mono_profiler_enable_clauses (). This must now be called to enable
* raising exception_clause events.
* - The exception argument to exception_clause events can now be NULL for
* finally clauses invoked in the non-exceptional case.
* - The type argument to exception_clause events will now correctly indicate
* that the catch portion of the clause is being executed in the case of
* try-filter-catch clauses.
* - Removed the iomap_report event.
* - Removed the old gc_event event and renamed gc_event2 to gc_event.
*/
#define MONO_PROFILER_API_VERSION 3
typedef struct _MonoProfiler MonoProfiler;
typedef struct _MonoProfilerDesc *MonoProfilerHandle;
typedef void (*MonoProfilerCleanupCallback) (MonoProfiler *prof);
MONO_API void mono_profiler_load (const char *desc);
MONO_API MonoProfilerHandle mono_profiler_create (MonoProfiler *prof);
MONO_API void mono_profiler_set_cleanup_callback (MonoProfilerHandle handle, MonoProfilerCleanupCallback cb);
typedef struct {
MonoMethod *method;
uint32_t il_offset;
uint32_t counter;
const char *file_name;
uint32_t line;
uint32_t column;
} MonoProfilerCoverageData;
typedef mono_bool (*MonoProfilerCoverageFilterCallback) (MonoProfiler *prof, MonoMethod *method);
typedef void (*MonoProfilerCoverageCallback) (MonoProfiler *prof, const MonoProfilerCoverageData *data);
MONO_API mono_bool mono_profiler_enable_coverage (void);
MONO_API void mono_profiler_set_coverage_filter_callback (MonoProfilerHandle handle, MonoProfilerCoverageFilterCallback cb);
MONO_API mono_bool mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb);
typedef enum {
/**
* Do not perform sampling. Will make the sampling thread sleep until the
* sampling mode is changed to one of the below modes.
*/
MONO_PROFILER_SAMPLE_MODE_NONE = 0,
/**
* Try to base sampling frequency on process activity. Falls back to
* MONO_PROFILER_SAMPLE_MODE_REAL if such a clock is not available.
*/
MONO_PROFILER_SAMPLE_MODE_PROCESS = 1,
/**
* Base sampling frequency on wall clock time. Uses a monotonic clock when
* available (all major platforms).
*/
MONO_PROFILER_SAMPLE_MODE_REAL = 2,
} MonoProfilerSampleMode;
MONO_API mono_bool mono_profiler_enable_sampling (MonoProfilerHandle handle);
MONO_API mono_bool mono_profiler_set_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode mode, uint32_t freq);
MONO_API mono_bool mono_profiler_get_sample_mode (MonoProfilerHandle handle, MonoProfilerSampleMode *mode, uint32_t *freq);
MONO_API mono_bool mono_profiler_enable_allocations (void);
MONO_API mono_bool mono_profiler_enable_clauses (void);
typedef struct _MonoProfilerCallContext MonoProfilerCallContext;
typedef enum {
/**
* Do not instrument calls.
*/
MONO_PROFILER_CALL_INSTRUMENTATION_NONE = 0,
/**
* Instrument method entries.
*/
MONO_PROFILER_CALL_INSTRUMENTATION_ENTER = 1 << 1,
/**
* Also capture a call context for method entries.
*/
MONO_PROFILER_CALL_INSTRUMENTATION_ENTER_CONTEXT = 1 << 2,
/**
* Instrument method exits.
*/
MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE = 1 << 3,
/**
* Also capture a call context for method exits.
*/
MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE_CONTEXT = 1 << 4,
/**
* Instrument method exits as a result of a tail call.
*/
MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL = 1 << 5,
/**
* Instrument exceptional method exits.
*/
MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE = 1 << 6,
} MonoProfilerCallInstrumentationFlags;
typedef MonoProfilerCallInstrumentationFlags (*MonoProfilerCallInstrumentationFilterCallback) (MonoProfiler *prof, MonoMethod *method);
MONO_API void mono_profiler_set_call_instrumentation_filter_callback (MonoProfilerHandle handle, MonoProfilerCallInstrumentationFilterCallback cb);
MONO_API mono_bool mono_profiler_enable_call_context_introspection (void);
MONO_API void *mono_profiler_call_context_get_this (MonoProfilerCallContext *context);
MONO_API void *mono_profiler_call_context_get_argument (MonoProfilerCallContext *context, uint32_t position);
MONO_API void *mono_profiler_call_context_get_local (MonoProfilerCallContext *context, uint32_t position);
MONO_API void *mono_profiler_call_context_get_result (MonoProfilerCallContext *context);
MONO_API void mono_profiler_call_context_free_buffer (void *buffer);
typedef enum {
/**
* The \c data parameter is a \c MonoMethod pointer.
*/
MONO_PROFILER_CODE_BUFFER_METHOD = 0,
/**
* \deprecated No longer used.
*/
MONO_PROFILER_CODE_BUFFER_METHOD_TRAMPOLINE = 1,
/**
* The \c data parameter is a \c MonoMethod pointer.
*/
MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE = 2,
MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE = 3,
MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE = 4,
/**
* The \c data parameter is a C string.
*/
MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE = 5,
MONO_PROFILER_CODE_BUFFER_HELPER = 6,
/**
* \deprecated No longer used.
*/
MONO_PROFILER_CODE_BUFFER_MONITOR = 7,
MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE = 8,
MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING = 9,
} MonoProfilerCodeBufferType;
typedef enum {
MONO_GC_EVENT_PRE_STOP_WORLD = 6,
/**
* When this event arrives, the GC and suspend locks are acquired.
*/
MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED = 10,
MONO_GC_EVENT_POST_STOP_WORLD = 7,
MONO_GC_EVENT_START = 0,
MONO_GC_EVENT_END = 5,
MONO_GC_EVENT_PRE_START_WORLD = 8,
/**
* When this event arrives, the GC and suspend locks are released.
*/
MONO_GC_EVENT_POST_START_WORLD_UNLOCKED = 11,
MONO_GC_EVENT_POST_START_WORLD = 9,
} MonoProfilerGCEvent;
/*
* The macros below will generate the majority of the callback API. Refer to
* mono/metadata/profiler-events.h for a list of callbacks. They are expanded
* like so:
*
* typedef void (*MonoProfilerRuntimeInitializedCallback (MonoProfiler *prof);
* MONO_API void mono_profiler_set_runtime_initialized_callback (MonoProfiler *prof, MonoProfilerRuntimeInitializedCallback cb);
*
* typedef void (*MonoProfilerRuntimeShutdownCallback (MonoProfiler *prof);
* MONO_API void mono_profiler_set_runtime_shutdown_callback (MonoProfiler *prof, MonoProfilerRuntimeShutdownCallback cb);
*
* typedef void (*MonoProfilerContextLoadedCallback (MonoProfiler *prof);
* MONO_API void mono_profiler_set_context_loaded_callback (MonoProfiler *prof, MonoProfilerContextLoadedCallback cb);
*
* typedef void (*MonoProfilerContextUnloadedCallback (MonoProfiler *prof);
* MONO_API void mono_profiler_set_context_unloaded_callback (MonoProfiler *prof, MonoProfilerContextUnloadedCallback cb);
*
* Etc.
*
* To remove a callback, pass NULL instead of a valid function pointer.
* Callbacks can be changed at any point, but note that doing so is inherently
* racy with respect to threads that aren't suspended, i.e. you may still see a
* call from another thread right after you change a callback.
*
* These functions are async safe.
*/
#define _MONO_PROFILER_EVENT(type, ...) \
typedef void (*MonoProfiler ## type ## Callback) (__VA_ARGS__);
#define MONO_PROFILER_EVENT_0(name, type) \
_MONO_PROFILER_EVENT(type, MonoProfiler *prof)
#define MONO_PROFILER_EVENT_1(name, type, arg1_type, arg1_name) \
_MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name)
#define MONO_PROFILER_EVENT_2(name, type, arg1_type, arg1_name, arg2_type, arg2_name) \
_MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name, arg2_type arg2_name)
#define MONO_PROFILER_EVENT_3(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name) \
_MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name)
#define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \
_MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name)
#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \
_MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name, arg5_type arg5_name)
#include <mono/metadata/profiler-events.h>
#undef MONO_PROFILER_EVENT_0
#undef MONO_PROFILER_EVENT_1
#undef MONO_PROFILER_EVENT_2
#undef MONO_PROFILER_EVENT_3
#undef MONO_PROFILER_EVENT_4
#undef MONO_PROFILER_EVENT_5
#undef _MONO_PROFILER_EVENT
#define _MONO_PROFILER_EVENT(name, type) \
MONO_API void mono_profiler_set_ ## name ## _callback (MonoProfilerHandle handle, MonoProfiler ## type ## Callback cb);
#define MONO_PROFILER_EVENT_0(name, type) \
_MONO_PROFILER_EVENT(name, type)
#define MONO_PROFILER_EVENT_1(name, type, arg1_type, arg1_name) \
_MONO_PROFILER_EVENT(name, type)
#define MONO_PROFILER_EVENT_2(name, type, arg1_type, arg1_name, arg2_type, arg2_name) \
_MONO_PROFILER_EVENT(name, type)
#define MONO_PROFILER_EVENT_3(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name) \
_MONO_PROFILER_EVENT(name, type)
#define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \
_MONO_PROFILER_EVENT(name, type)
#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \
_MONO_PROFILER_EVENT(name, type)
#include <mono/metadata/profiler-events.h>
#undef MONO_PROFILER_EVENT_0
#undef MONO_PROFILER_EVENT_1
#undef MONO_PROFILER_EVENT_2
#undef MONO_PROFILER_EVENT_3
#undef MONO_PROFILER_EVENT_4
#undef MONO_PROFILER_EVENT_5
#undef _MONO_PROFILER_EVENT
MONO_END_DECLS
#endif // __MONO_PROFILER_H__
@@ -0,0 +1,174 @@
/**
* \file
*/
#ifndef __METADATA_REFLECTION_H__
#define __METADATA_REFLECTION_H__
#include <mono/utils/mono-publib.h>
#include <mono/metadata/object.h>
MONO_BEGIN_DECLS
typedef struct MonoTypeNameParse MonoTypeNameParse;
typedef struct {
MonoMethod *ctor;
uint32_t data_size;
const mono_byte* data;
} MonoCustomAttrEntry;
typedef struct {
int num_attrs;
int cached;
MonoImage *image;
MonoCustomAttrEntry attrs [MONO_ZERO_LEN_ARRAY];
} MonoCustomAttrInfo;
#define MONO_SIZEOF_CUSTOM_ATTR_INFO (offsetof (MonoCustomAttrInfo, attrs))
/*
* Information which isn't in the MonoMethod structure is stored here for
* dynamic methods.
*/
typedef struct {
char **param_names;
MonoMarshalSpec **param_marshall;
MonoCustomAttrInfo **param_cattr;
uint8_t** param_defaults;
uint32_t *param_default_types;
char *dllentry, *dll;
} MonoReflectionMethodAux;
typedef enum {
ResolveTokenError_OutOfRange,
ResolveTokenError_BadTable,
ResolveTokenError_Other
} MonoResolveTokenError;
MONO_API MONO_RT_EXTERNAL_ONLY
int mono_reflection_parse_type (char *name, MonoTypeNameParse *info);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoType* mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, mono_bool ignorecase, mono_bool *type_resolve);
MONO_API void mono_reflection_free_type_info (MonoTypeNameParse *info);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoType* mono_reflection_type_from_name (char *name, MonoImage *image);
MONO_API MONO_RT_EXTERNAL_ONLY
uint32_t mono_reflection_get_token (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionModule* mono_module_get_object (MonoDomain *domain, MonoImage *image);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionModule* mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionType* mono_type_get_object (MonoDomain *domain, MonoType *type);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionMethod* mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionEvent* mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event);
/* note: this one is slightly different: we keep the whole array of params in the cache */
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray* mono_param_get_objects (MonoDomain *domain, MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoMethod *method);
MONO_API MonoObject *mono_get_dbnull_object (MonoDomain *domain);
MONO_API MonoArray* mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error);
MONO_API MonoArray* mono_reflection_get_custom_attrs (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray* mono_reflection_get_custom_attrs_data (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray* mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoArray* mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_index (MonoImage *image, uint32_t idx);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_method (MonoMethod *method);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_class (MonoClass *klass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_assembly (MonoAssembly *assembly);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoCustomAttrInfo* mono_custom_attrs_from_param (MonoMethod *method, uint32_t param);
MONO_API mono_bool mono_custom_attrs_has_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoObject* mono_custom_attrs_get_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass);
MONO_API void mono_custom_attrs_free (MonoCustomAttrInfo *ainfo);
#define MONO_DECLSEC_ACTION_MIN 0x1
#define MONO_DECLSEC_ACTION_MAX 0x12
enum {
MONO_DECLSEC_FLAG_REQUEST = 0x00000001,
MONO_DECLSEC_FLAG_DEMAND = 0x00000002,
MONO_DECLSEC_FLAG_ASSERT = 0x00000004,
MONO_DECLSEC_FLAG_DENY = 0x00000008,
MONO_DECLSEC_FLAG_PERMITONLY = 0x00000010,
MONO_DECLSEC_FLAG_LINKDEMAND = 0x00000020,
MONO_DECLSEC_FLAG_INHERITANCEDEMAND = 0x00000040,
MONO_DECLSEC_FLAG_REQUEST_MINIMUM = 0x00000080,
MONO_DECLSEC_FLAG_REQUEST_OPTIONAL = 0x00000100,
MONO_DECLSEC_FLAG_REQUEST_REFUSE = 0x00000200,
MONO_DECLSEC_FLAG_PREJIT_GRANT = 0x00000400,
MONO_DECLSEC_FLAG_PREJIT_DENY = 0x00000800,
MONO_DECLSEC_FLAG_NONCAS_DEMAND = 0x00001000,
MONO_DECLSEC_FLAG_NONCAS_LINKDEMAND = 0x00002000,
MONO_DECLSEC_FLAG_NONCAS_INHERITANCEDEMAND = 0x00004000,
MONO_DECLSEC_FLAG_LINKDEMAND_CHOICE = 0x00008000,
MONO_DECLSEC_FLAG_INHERITANCEDEMAND_CHOICE = 0x00010000,
MONO_DECLSEC_FLAG_DEMAND_CHOICE = 0x00020000
};
MONO_API uint32_t mono_declsec_flags_from_method (MonoMethod *method);
MONO_API uint32_t mono_declsec_flags_from_class (MonoClass *klass);
MONO_API uint32_t mono_declsec_flags_from_assembly (MonoAssembly *assembly);
/* this structure MUST be kept in synch with RuntimeDeclSecurityEntry
* located in /mcs/class/corlib/System.Security/SecurityFrame.cs */
typedef struct {
char *blob; /* pointer to metadata blob */
uint32_t size; /* size of the metadata blob */
uint32_t index;
} MonoDeclSecurityEntry;
typedef struct {
MonoDeclSecurityEntry demand;
MonoDeclSecurityEntry noncasdemand;
MonoDeclSecurityEntry demandchoice;
} MonoDeclSecurityActions;
MONO_API MonoBoolean mono_declsec_get_demands (MonoMethod *callee, MonoDeclSecurityActions* demands);
MONO_API MonoBoolean mono_declsec_get_linkdemands (MonoMethod *callee, MonoDeclSecurityActions* klass, MonoDeclSecurityActions* cmethod);
MONO_API MonoBoolean mono_declsec_get_inheritdemands_class (MonoClass *klass, MonoDeclSecurityActions* demands);
MONO_API MonoBoolean mono_declsec_get_inheritdemands_method (MonoMethod *callee, MonoDeclSecurityActions* demands);
MONO_API MonoBoolean mono_declsec_get_method_action (MonoMethod *method, uint32_t action, MonoDeclSecurityEntry *entry);
MONO_API MonoBoolean mono_declsec_get_class_action (MonoClass *klass, uint32_t action, MonoDeclSecurityEntry *entry);
MONO_API MonoBoolean mono_declsec_get_assembly_action (MonoAssembly *assembly, uint32_t action, MonoDeclSecurityEntry *entry);
MONO_API MONO_RT_EXTERNAL_ONLY
MonoType* mono_reflection_type_get_type (MonoReflectionType *reftype);
MONO_API MonoAssembly* mono_reflection_assembly_get_assembly (MonoReflectionAssembly *refassembly);
MONO_END_DECLS
#endif /* __METADATA_REFLECTION_H__ */
@@ -0,0 +1,503 @@
/**
* \file
*/
#ifndef __MONO_METADATA_ROW_INDEXES_H__
#define __MONO_METADATA_ROW_INDEXES_H__
/*
* The last entry in the enum is used to give the number
* of columns in the row.
*/
enum {
MONO_ASSEMBLY_HASH_ALG,
MONO_ASSEMBLY_MAJOR_VERSION,
MONO_ASSEMBLY_MINOR_VERSION,
MONO_ASSEMBLY_BUILD_NUMBER,
MONO_ASSEMBLY_REV_NUMBER,
MONO_ASSEMBLY_FLAGS,
MONO_ASSEMBLY_PUBLIC_KEY,
MONO_ASSEMBLY_NAME,
MONO_ASSEMBLY_CULTURE,
MONO_ASSEMBLY_SIZE
};
enum {
MONO_ASSEMBLYOS_PLATFORM,
MONO_ASSEMBLYOS_MAJOR_VERSION,
MONO_ASSEMBLYOS_MINOR_VERSION,
MONO_ASSEMBLYOS_SIZE
};
enum {
MONO_ASSEMBLY_PROCESSOR,
MONO_ASSEMBLY_PROCESSOR_SIZE
};
enum {
MONO_ASSEMBLYREF_MAJOR_VERSION,
MONO_ASSEMBLYREF_MINOR_VERSION,
MONO_ASSEMBLYREF_BUILD_NUMBER,
MONO_ASSEMBLYREF_REV_NUMBER,
MONO_ASSEMBLYREF_FLAGS,
MONO_ASSEMBLYREF_PUBLIC_KEY,
MONO_ASSEMBLYREF_NAME,
MONO_ASSEMBLYREF_CULTURE,
MONO_ASSEMBLYREF_HASH_VALUE,
MONO_ASSEMBLYREF_SIZE
};
enum {
MONO_ASSEMBLYREFOS_PLATFORM,
MONO_ASSEMBLYREFOS_MAJOR_VERSION,
MONO_ASSEMBLYREFOS_MINOR_VERSION,
MONO_ASSEMBLYREFOS_ASSEMBLYREF,
MONO_ASSEMBLYREFOS_SIZE
};
enum {
MONO_ASSEMBLYREFPROC_PROCESSOR,
MONO_ASSEMBLYREFPROC_ASSEMBLYREF,
MONO_ASSEMBLYREFPROC_SIZE
};
enum {
MONO_CLASS_LAYOUT_PACKING_SIZE,
MONO_CLASS_LAYOUT_CLASS_SIZE,
MONO_CLASS_LAYOUT_PARENT,
MONO_CLASS_LAYOUT_SIZE
};
enum {
MONO_CONSTANT_TYPE,
MONO_CONSTANT_PADDING,
MONO_CONSTANT_PARENT,
MONO_CONSTANT_VALUE,
MONO_CONSTANT_SIZE
};
enum {
MONO_CUSTOM_ATTR_PARENT,
MONO_CUSTOM_ATTR_TYPE,
MONO_CUSTOM_ATTR_VALUE,
MONO_CUSTOM_ATTR_SIZE
};
enum {
MONO_DECL_SECURITY_ACTION,
MONO_DECL_SECURITY_PARENT,
MONO_DECL_SECURITY_PERMISSIONSET,
MONO_DECL_SECURITY_SIZE
};
enum {
MONO_EVENT_MAP_PARENT,
MONO_EVENT_MAP_EVENTLIST,
MONO_EVENT_MAP_SIZE
};
enum {
MONO_EVENT_FLAGS,
MONO_EVENT_NAME,
MONO_EVENT_TYPE,
MONO_EVENT_SIZE
};
enum {
MONO_EVENT_POINTER_EVENT,
MONO_EVENT_POINTER_SIZE
};
enum {
MONO_EXP_TYPE_FLAGS,
MONO_EXP_TYPE_TYPEDEF,
MONO_EXP_TYPE_NAME,
MONO_EXP_TYPE_NAMESPACE,
MONO_EXP_TYPE_IMPLEMENTATION,
MONO_EXP_TYPE_SIZE
};
enum {
MONO_FIELD_FLAGS,
MONO_FIELD_NAME,
MONO_FIELD_SIGNATURE,
MONO_FIELD_SIZE
};
enum {
MONO_FIELD_LAYOUT_OFFSET,
MONO_FIELD_LAYOUT_FIELD,
MONO_FIELD_LAYOUT_SIZE
};
enum {
MONO_FIELD_MARSHAL_PARENT,
MONO_FIELD_MARSHAL_NATIVE_TYPE,
MONO_FIELD_MARSHAL_SIZE
};
enum {
MONO_FIELD_POINTER_FIELD,
MONO_FIELD_POINTER_SIZE
};
enum {
MONO_FIELD_RVA_RVA,
MONO_FIELD_RVA_FIELD,
MONO_FIELD_RVA_SIZE
};
enum {
MONO_ENCLOG_TOKEN,
MONO_ENCLOG_FUNC_CODE,
MONO_ENCLOG_SIZE
};
enum {
MONO_ENCMAP_TOKEN,
MONO_ENCMAP_SIZE
};
enum {
MONO_FILE_FLAGS,
MONO_FILE_NAME,
MONO_FILE_HASH_VALUE,
MONO_FILE_SIZE
};
enum {
MONO_IMPLMAP_FLAGS,
MONO_IMPLMAP_MEMBER,
MONO_IMPLMAP_NAME,
MONO_IMPLMAP_SCOPE,
MONO_IMPLMAP_SIZE
};
enum {
MONO_INTERFACEIMPL_CLASS,
MONO_INTERFACEIMPL_INTERFACE,
MONO_INTERFACEIMPL_SIZE
};
enum {
MONO_MANIFEST_OFFSET,
MONO_MANIFEST_FLAGS,
MONO_MANIFEST_NAME,
MONO_MANIFEST_IMPLEMENTATION,
MONO_MANIFEST_SIZE
};
enum {
MONO_MEMBERREF_CLASS,
MONO_MEMBERREF_NAME,
MONO_MEMBERREF_SIGNATURE,
MONO_MEMBERREF_SIZE
};
enum {
MONO_METHOD_RVA,
MONO_METHOD_IMPLFLAGS,
MONO_METHOD_FLAGS,
MONO_METHOD_NAME,
MONO_METHOD_SIGNATURE,
MONO_METHOD_PARAMLIST,
MONO_METHOD_SIZE
};
enum {
MONO_METHODIMPL_CLASS,
MONO_METHODIMPL_BODY,
MONO_METHODIMPL_DECLARATION,
MONO_METHODIMPL_SIZE
};
enum {
MONO_METHOD_POINTER_METHOD,
MONO_METHOD_POINTER_SIZE
};
enum {
MONO_METHOD_SEMA_SEMANTICS,
MONO_METHOD_SEMA_METHOD,
MONO_METHOD_SEMA_ASSOCIATION,
MONO_METHOD_SEMA_SIZE
};
enum {
MONO_MODULE_GENERATION,
MONO_MODULE_NAME,
MONO_MODULE_MVID,
MONO_MODULE_ENC,
MONO_MODULE_ENCBASE,
MONO_MODULE_SIZE
};
enum {
MONO_MODULEREF_NAME,
MONO_MODULEREF_SIZE
};
enum {
MONO_NESTED_CLASS_NESTED,
MONO_NESTED_CLASS_ENCLOSING,
MONO_NESTED_CLASS_SIZE
};
enum {
MONO_PARAM_FLAGS,
MONO_PARAM_SEQUENCE,
MONO_PARAM_NAME,
MONO_PARAM_SIZE
};
enum {
MONO_PARAM_POINTER_PARAM,
MONO_PARAM_POINTER_SIZE
};
enum {
MONO_PROPERTY_FLAGS,
MONO_PROPERTY_NAME,
MONO_PROPERTY_TYPE,
MONO_PROPERTY_SIZE
};
enum {
MONO_PROPERTY_POINTER_PROPERTY,
MONO_PROPERTY_POINTER_SIZE
};
enum {
MONO_PROPERTY_MAP_PARENT,
MONO_PROPERTY_MAP_PROPERTY_LIST,
MONO_PROPERTY_MAP_SIZE
};
enum {
MONO_STAND_ALONE_SIGNATURE,
MONO_STAND_ALONE_SIGNATURE_SIZE
};
enum {
MONO_TYPEDEF_FLAGS,
MONO_TYPEDEF_NAME,
MONO_TYPEDEF_NAMESPACE,
MONO_TYPEDEF_EXTENDS,
MONO_TYPEDEF_FIELD_LIST,
MONO_TYPEDEF_METHOD_LIST,
MONO_TYPEDEF_SIZE
};
enum {
MONO_TYPEREF_SCOPE,
MONO_TYPEREF_NAME,
MONO_TYPEREF_NAMESPACE,
MONO_TYPEREF_SIZE
};
enum {
MONO_TYPESPEC_SIGNATURE,
MONO_TYPESPEC_SIZE
};
enum {
MONO_GENERICPARAM_NUMBER,
MONO_GENERICPARAM_FLAGS,
MONO_GENERICPARAM_OWNER,
MONO_GENERICPARAM_NAME,
MONO_GENERICPARAM_SIZE
};
enum {
MONO_METHODSPEC_METHOD,
MONO_METHODSPEC_SIGNATURE,
MONO_METHODSPEC_SIZE
};
enum {
MONO_GENPARCONSTRAINT_GENERICPAR,
MONO_GENPARCONSTRAINT_CONSTRAINT,
MONO_GENPARCONSTRAINT_SIZE
};
enum {
MONO_DOCUMENT_NAME,
MONO_DOCUMENT_HASHALG,
MONO_DOCUMENT_HASH,
MONO_DOCUMENT_LANGUAGE,
MONO_DOCUMENT_SIZE
};
enum {
MONO_METHODBODY_DOCUMENT,
MONO_METHODBODY_SEQ_POINTS,
MONO_METHODBODY_SIZE
};
enum {
MONO_LOCALSCOPE_METHOD,
MONO_LOCALSCOPE_IMPORTSCOPE,
MONO_LOCALSCOPE_VARIABLELIST,
MONO_LOCALSCOPE_CONSTANTLIST,
MONO_LOCALSCOPE_STARTOFFSET,
MONO_LOCALSCOPE_LENGTH,
MONO_LOCALSCOPE_SIZE
};
enum {
MONO_LOCALVARIABLE_ATTRIBUTES,
MONO_LOCALVARIABLE_INDEX,
MONO_LOCALVARIABLE_NAME,
MONO_LOCALVARIABLE_SIZE
};
enum {
MONO_CUSTOMDEBUGINFORMATION_PARENT,
MONO_CUSTOMDEBUGINFORMATION_KIND,
MONO_CUSTOMDEBUGINFORMATION_VALUE,
MONO_CUSTOMDEBUGINFORMATION_SIZE
};
/*
* Coded Tokens
* The _BITS entry is for the bits used in the token.
* The _MASK entry is for mask the index out.
*/
enum {
MONO_TYPEDEFORREF_TYPEDEF,
MONO_TYPEDEFORREF_TYPEREF,
MONO_TYPEDEFORREF_TYPESPEC,
MONO_TYPEDEFORREF_BITS = 2,
MONO_TYPEDEFORREF_MASK = 3
};
enum {
MONO_HASCONSTANT_FIEDDEF,
MONO_HASCONSTANT_PARAM,
MONO_HASCONSTANT_PROPERTY,
MONO_HASCONSTANT_BITS = 2,
MONO_HASCONSTANT_MASK = 3
};
enum {
MONO_CUSTOM_ATTR_METHODDEF,
MONO_CUSTOM_ATTR_FIELDDEF,
MONO_CUSTOM_ATTR_TYPEREF,
MONO_CUSTOM_ATTR_TYPEDEF,
MONO_CUSTOM_ATTR_PARAMDEF,
MONO_CUSTOM_ATTR_INTERFACE,
MONO_CUSTOM_ATTR_MEMBERREF,
MONO_CUSTOM_ATTR_MODULE,
MONO_CUSTOM_ATTR_PERMISSION,
MONO_CUSTOM_ATTR_PROPERTY,
MONO_CUSTOM_ATTR_EVENT,
MONO_CUSTOM_ATTR_SIGNATURE,
MONO_CUSTOM_ATTR_MODULEREF,
MONO_CUSTOM_ATTR_TYPESPEC,
MONO_CUSTOM_ATTR_ASSEMBLY,
MONO_CUSTOM_ATTR_ASSEMBLYREF,
MONO_CUSTOM_ATTR_FILE,
MONO_CUSTOM_ATTR_EXP_TYPE,
MONO_CUSTOM_ATTR_MANIFEST,
MONO_CUSTOM_ATTR_GENERICPAR,
MONO_CUSTOM_ATTR_GENERICPARAMCONSTRAINT,
MONO_CUSTOM_ATTR_BITS = 5,
MONO_CUSTOM_ATTR_MASK = 0x1F
};
enum {
MONO_HAS_FIELD_MARSHAL_FIELDSREF,
MONO_HAS_FIELD_MARSHAL_PARAMDEF,
MONO_HAS_FIELD_MARSHAL_BITS = 1,
MONO_HAS_FIELD_MARSHAL_MASK = 1
};
enum {
MONO_HAS_DECL_SECURITY_TYPEDEF,
MONO_HAS_DECL_SECURITY_METHODDEF,
MONO_HAS_DECL_SECURITY_ASSEMBLY,
MONO_HAS_DECL_SECURITY_BITS = 2,
MONO_HAS_DECL_SECURITY_MASK = 3
};
enum {
MONO_MEMBERREF_PARENT_TYPEDEF, /* not used */
MONO_MEMBERREF_PARENT_TYPEREF,
MONO_MEMBERREF_PARENT_MODULEREF,
MONO_MEMBERREF_PARENT_METHODDEF,
MONO_MEMBERREF_PARENT_TYPESPEC,
MONO_MEMBERREF_PARENT_BITS = 3,
MONO_MEMBERREF_PARENT_MASK = 7
};
enum {
MONO_HAS_SEMANTICS_EVENT,
MONO_HAS_SEMANTICS_PROPERTY,
MONO_HAS_SEMANTICS_BITS = 1,
MONO_HAS_SEMANTICS_MASK = 1
};
enum {
MONO_METHODDEFORREF_METHODDEF,
MONO_METHODDEFORREF_METHODREF,
MONO_METHODDEFORREF_BITS = 1,
MONO_METHODDEFORREF_MASK = 1
};
enum {
MONO_MEMBERFORWD_FIELDDEF,
MONO_MEMBERFORWD_METHODDEF,
MONO_MEMBERFORWD_BITS = 1,
MONO_MEMBERFORWD_MASK = 1
};
enum {
MONO_IMPLEMENTATION_FILE,
MONO_IMPLEMENTATION_ASSEMBLYREF,
MONO_IMPLEMENTATION_EXP_TYPE,
MONO_IMPLEMENTATION_BITS = 2,
MONO_IMPLEMENTATION_MASK = 3
};
enum {
MONO_CUSTOM_ATTR_TYPE_TYPEREF, /* not used */
MONO_CUSTOM_ATTR_TYPE_TYPEDEF, /* not used */
MONO_CUSTOM_ATTR_TYPE_METHODDEF,
MONO_CUSTOM_ATTR_TYPE_MEMBERREF,
MONO_CUSTOM_ATTR_TYPE_STRING, /* not used */
MONO_CUSTOM_ATTR_TYPE_BITS = 3,
MONO_CUSTOM_ATTR_TYPE_MASK = 7
};
enum {
MONO_RESOLUTION_SCOPE_MODULE,
MONO_RESOLUTION_SCOPE_MODULEREF,
MONO_RESOLUTION_SCOPE_ASSEMBLYREF,
MONO_RESOLUTION_SCOPE_TYPEREF,
MONO_RESOLUTION_SCOPE_BITS = 2,
MONO_RESOLUTION_SCOPE_MASK = 3
};
/* Kept for compatibility since this is a public header file */
enum {
MONO_RESOLTION_SCOPE_MODULE,
MONO_RESOLTION_SCOPE_MODULEREF,
MONO_RESOLTION_SCOPE_ASSEMBLYREF,
MONO_RESOLTION_SCOPE_TYPEREF,
MONO_RESOLTION_SCOPE_BITS = 2,
MONO_RESOLTION_SCOPE_MASK = 3
};
enum {
MONO_TYPEORMETHOD_TYPE,
MONO_TYPEORMETHOD_METHOD,
MONO_TYPEORMETHOD_BITS = 1,
MONO_TYPEORMETHOD_MASK = 1
};
#endif /* __MONO_METADATA_ROW_INDEXES_H__ */
@@ -0,0 +1,110 @@
/**
* \file
* Copyright 2011 Novell, Inc.
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
/*
* The bridge is a mechanism for SGen to let clients override the death of some
* unreachable objects. We use it in monodroid to do garbage collection across
* the Mono and Java heaps.
*
* The client (Monodroid) can designate some objects as "bridged", which means
* that they participate in the bridge processing step once SGen considers them
* unreachable, i.e., dead. Bridged objects must be registered for
* finalization.
*
* When SGen is done marking, it puts together a list of all dead bridged
* objects. This is passed to the bridge processor, which does an analysis to
* simplify the graph: It replaces strongly-connected components with single
* nodes, and may remove nodes corresponding to components which do not contain
* bridged objects.
*
* The output of the SCC analysis is passed to the client's `cross_references()`
* callback. This consists of 2 arrays, an array of SCCs (MonoGCBridgeSCC),
* and an array of "xrefs" (edges between SCCs, MonoGCBridgeXRef). Edges are
* encoded as pairs of "API indices", ie indexes in the SCC array. The client
* is expected to set the `is_alive` flag on those strongly connected components
* that it wishes to be kept alive.
*
* In monodroid each bridged object has a corresponding Java mirror object. In
* the bridge callback it reifies the Mono object graph in the Java heap so that
* the full, combined object graph is now instantiated on the Java side. Then
* it triggers a Java GC, waits for it to finish, and checks which of the Java
* mirror objects are still alive. For those it sets the `is_alive` flag and
* returns from the callback.
*
* The SCC analysis is done while the world is stopped, but the callback is made
* with the world running again. Weak links to bridged objects and other
* objects reachable from them are kept until the callback returns, at which
* point all links to bridged objects that don't have `is_alive` set are nulled.
* Note that weak links to non-bridged objects reachable from bridged objects
* are not nulled. This might be considered a bug.
*
* There are three different implementations of the bridge processor, each of
* which implements 8 callbacks (see SgenBridgeProcessor). The implementations
* differ in the algorithm they use to compute the "simplified" SCC graph.
*/
#ifndef _MONO_SGEN_BRIDGE_H_
#define _MONO_SGEN_BRIDGE_H_
#include <mono/utils/mono-publib.h>
MONO_BEGIN_DECLS
enum {
SGEN_BRIDGE_VERSION = 5
};
typedef enum {
/* Instances of this class should be scanned when computing the transitive dependency among bridges. E.g. List<object>*/
GC_BRIDGE_TRANSPARENT_CLASS,
/* Instances of this class should not be scanned when computing the transitive dependency among bridges. E.g. String*/
GC_BRIDGE_OPAQUE_CLASS,
/* Instances of this class should be bridged and have their dependency computed. */
GC_BRIDGE_TRANSPARENT_BRIDGE_CLASS,
/* Instances of this class should be bridged but no dependencies should not be calculated. */
GC_BRIDGE_OPAQUE_BRIDGE_CLASS,
} MonoGCBridgeObjectKind;
typedef struct {
mono_bool is_alive; /* to be set by the cross reference callback */
int num_objs;
MonoObject *objs [MONO_ZERO_LEN_ARRAY];
} MonoGCBridgeSCC;
typedef struct {
int src_scc_index;
int dst_scc_index;
} MonoGCBridgeXRef;
typedef struct {
int bridge_version;
/*
* Tells the runtime which classes to even consider when looking for
* bridged objects. If subclasses are to be considered as well, the
* subclass check must be done in the callback.
*/
MonoGCBridgeObjectKind (*bridge_class_kind) (MonoClass *klass);
/*
* This is only called on objects for whose classes
* `bridge_class_kind()` returned `XXX_BRIDGE_CLASS`.
*/
mono_bool (*is_bridge_object) (MonoObject *object);
void (*cross_references) (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, MonoGCBridgeXRef *xrefs);
} MonoGCBridgeCallbacks;
/*
* Note: This may be called at any time, but cannot be called concurrently
* with (during and on a separate thread from) sgen init. Callers are
* responsible for enforcing this.
*/
MONO_API void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_gc_wait_for_bridge_processing (void);
MONO_END_DECLS
#endif
@@ -0,0 +1,69 @@
/**
* \file
* Threading API
*
* Author:
* Dick Porter (dick@ximian.com)
* Patrik Torstensson (patrik.torstensson@labs2.com)
*
* (C) 2001 Ximian, Inc
*/
#ifndef _MONO_METADATA_THREADS_H_
#define _MONO_METADATA_THREADS_H_
#include <mono/utils/mono-publib.h>
#include <mono/metadata/object.h>
#include <mono/metadata/appdomain.h>
MONO_BEGIN_DECLS
/* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */
typedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread);
MONO_API void mono_thread_init (MonoThreadStartCB start_cb,
MonoThreadAttachCB attach_cb);
MONO_API void mono_thread_cleanup (void);
MONO_API MONO_RT_EXTERNAL_ONLY
void mono_thread_manage(void);
MONO_API MonoThread *mono_thread_current (void);
MONO_API void mono_thread_set_main (MonoThread *thread);
MONO_API MonoThread *mono_thread_get_main (void);
MONO_API MONO_RT_EXTERNAL_ONLY void mono_thread_stop (MonoThread *thread);
MONO_API void mono_thread_new_init (intptr_t tid, void* stack_start,
void* func);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_thread_create (MonoDomain *domain, void* func, void* arg);
MONO_API MONO_RT_EXTERNAL_ONLY MonoThread *
mono_thread_attach (MonoDomain *domain);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_thread_detach (MonoThread *thread);
MONO_API void mono_thread_exit (void);
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_threads_attach_tools_thread (void);
MONO_API char *mono_thread_get_name_utf8 (MonoThread *thread);
MONO_API int32_t mono_thread_get_managed_id (MonoThread *thread);
MONO_API void mono_thread_set_manage_callback (MonoThread *thread, MonoThreadManageCallback func);
MONO_API void mono_threads_set_default_stacksize (uint32_t stacksize);
MONO_API uint32_t mono_threads_get_default_stacksize (void);
MONO_API void mono_threads_request_thread_dump (void);
MONO_API mono_bool mono_thread_is_foreign (MonoThread *thread);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_thread_detach_if_exiting (void);
MONO_END_DECLS
#endif /* _MONO_METADATA_THREADS_H_ */
@@ -0,0 +1,45 @@
/**
* \file
*/
#ifndef _MONO_METADATA_TOKENTYPE_H_
#define _MONO_METADATA_TOKENTYPE_H_
/*
* These tokens match the table ID except for the last
* three (string, name and base type which are special)
*/
typedef enum {
MONO_TOKEN_MODULE = 0x00000000,
MONO_TOKEN_TYPE_REF = 0x01000000,
MONO_TOKEN_TYPE_DEF = 0x02000000,
MONO_TOKEN_FIELD_DEF = 0x04000000,
MONO_TOKEN_METHOD_DEF = 0x06000000,
MONO_TOKEN_PARAM_DEF = 0x08000000,
MONO_TOKEN_INTERFACE_IMPL = 0x09000000,
MONO_TOKEN_MEMBER_REF = 0x0a000000,
MONO_TOKEN_CUSTOM_ATTRIBUTE = 0x0c000000,
MONO_TOKEN_PERMISSION = 0x0e000000,
MONO_TOKEN_SIGNATURE = 0x11000000,
MONO_TOKEN_EVENT = 0x14000000,
MONO_TOKEN_PROPERTY = 0x17000000,
MONO_TOKEN_MODULE_REF = 0x1a000000,
MONO_TOKEN_TYPE_SPEC = 0x1b000000,
MONO_TOKEN_ASSEMBLY = 0x20000000,
MONO_TOKEN_ASSEMBLY_REF = 0x23000000,
MONO_TOKEN_FILE = 0x26000000,
MONO_TOKEN_EXPORTED_TYPE = 0x27000000,
MONO_TOKEN_MANIFEST_RESOURCE = 0x28000000,
MONO_TOKEN_GENERIC_PARAM = 0x2a000000,
MONO_TOKEN_METHOD_SPEC = 0x2b000000,
/*
* These do not match metadata tables directly
*/
MONO_TOKEN_STRING = 0x70000000,
MONO_TOKEN_NAME = 0x71000000,
MONO_TOKEN_BASE_TYPE = 0x72000000
} MonoTokenType;
#endif /* _MONO_METADATA_TOKENTYPE_H_ */
@@ -0,0 +1,66 @@
/**
* \file
*/
#ifndef __MONO_METADATA_VERIFY_H__
#define __MONO_METADATA_VERIFY_H__
#include <mono/metadata/metadata.h>
#include <mono/metadata/image.h>
#include <mono/metadata/loader.h>
#include <glib.h> /* GSList dep */
MONO_BEGIN_DECLS
typedef enum {
MONO_VERIFY_OK,
MONO_VERIFY_ERROR,
MONO_VERIFY_WARNING,
MONO_VERIFY_CLS = 4,
MONO_VERIFY_ALL = 7,
/* Status signaling code that is not verifiable.*/
MONO_VERIFY_NOT_VERIFIABLE = 8,
/*OR it with other flags*/
/* Abort the verification if the code is not verifiable.
* The standard behavior is to abort if the code is not valid.
* */
MONO_VERIFY_FAIL_FAST = 16,
/* Perform less verification of the code. This flag should be used
* if one wants the verifier to be more compatible to the MS runtime.
* Mind that this is not to be more compatible with MS peverify, but
* with the runtime itself, that has a less strict verifier.
*/
MONO_VERIFY_NON_STRICT = 32,
/*Skip all visibility related checks*/
MONO_VERIFY_SKIP_VISIBILITY = 64,
/*Skip all visibility related checks*/
MONO_VERIFY_REPORT_ALL_ERRORS = 128
} MonoVerifyStatus;
typedef struct {
char *message;
MonoVerifyStatus status;
} MonoVerifyInfo;
typedef struct {
MonoVerifyInfo info;
int8_t exception_type; /*should be one of MONO_EXCEPTION_* */
} MonoVerifyInfoExtended;
MONO_API GSList* mono_method_verify (MonoMethod *method, int level);
MONO_API void mono_free_verify_list (GSList *list);
MONO_API char* mono_verify_corlib (void);
MONO_END_DECLS
#endif /* __MONO_METADATA_VERIFY_H__ */
@@ -0,0 +1,105 @@
/**
* \file
*/
#ifndef __MONO_COUNTERS_H__
#define __MONO_COUNTERS_H__
#include <stdio.h>
#include <mono/utils/mono-publib.h>
enum {
/* Counter type, bits 0-7. */
MONO_COUNTER_INT, /* 32 bit int */
MONO_COUNTER_UINT, /* 32 bit uint */
MONO_COUNTER_WORD, /* pointer-sized int */
MONO_COUNTER_LONG, /* 64 bit int */
MONO_COUNTER_ULONG, /* 64 bit uint */
MONO_COUNTER_DOUBLE,
MONO_COUNTER_STRING, /* char* */
MONO_COUNTER_TIME_INTERVAL, /* 64 bits signed int holding usecs. */
MONO_COUNTER_TYPE_MASK = 0xf,
MONO_COUNTER_CALLBACK = 128, /* ORed with the other values */
MONO_COUNTER_SECTION_MASK = 0x00ffff00,
/* Sections, bits 8-23 (16 bits) */
MONO_COUNTER_JIT = 1 << 8,
MONO_COUNTER_GC = 1 << 9,
MONO_COUNTER_METADATA = 1 << 10,
MONO_COUNTER_GENERICS = 1 << 11,
MONO_COUNTER_SECURITY = 1 << 12,
MONO_COUNTER_RUNTIME = 1 << 13,
MONO_COUNTER_SYSTEM = 1 << 14,
MONO_COUNTER_PERFCOUNTERS = 1 << 15,
MONO_COUNTER_PROFILER = 1 << 16,
MONO_COUNTER_INTERP = 1 << 17,
MONO_COUNTER_TIERED = 1 << 18,
MONO_COUNTER_LAST_SECTION,
/* Unit, bits 24-27 (4 bits) */
MONO_COUNTER_UNIT_SHIFT = 24,
MONO_COUNTER_UNIT_MASK = 0xFu << MONO_COUNTER_UNIT_SHIFT,
MONO_COUNTER_RAW = 0 << 24, /* Raw value */
MONO_COUNTER_BYTES = 1 << 24, /* Quantity of bytes. RSS, active heap, etc */
MONO_COUNTER_TIME = 2 << 24, /* Time interval in 100ns units. Minor pause, JIT compilation*/
MONO_COUNTER_COUNT = 3 << 24, /* Number of things (threads, queued jobs) or Number of events triggered (Major collections, Compiled methods).*/
MONO_COUNTER_PERCENTAGE = 4 << 24, /* [0-1] Fraction Percentage of something. Load average. */
/* Monotonicity, bits 28-31 (4 bits) */
MONO_COUNTER_VARIANCE_SHIFT = 28,
MONO_COUNTER_VARIANCE_MASK = 0xFu << MONO_COUNTER_VARIANCE_SHIFT,
MONO_COUNTER_MONOTONIC = 1 << 28, /* This counter value always increase/decreases over time. Reported by --stat. */
MONO_COUNTER_CONSTANT = 1 << 29, /* Fixed value. Used by configuration data. */
MONO_COUNTER_VARIABLE = 1 << 30, /* This counter value can be anything on each sampling. Only interesting when sampling. */
};
typedef struct _MonoCounter MonoCounter;
MONO_API void mono_counters_enable (int section_mask);
MONO_API void mono_counters_init (void);
/*
* register addr as the address of a counter of type type.
* It may be a function pointer if MONO_COUNTER_CALLBACK is specified:
* the function should return the value and take no arguments.
*/
MONO_API void mono_counters_register (const char* descr, int type, void *addr);
MONO_API void mono_counters_register_with_size (const char *name, int type, void *addr, int size);
typedef void (*MonoCounterRegisterCallback) (MonoCounter*);
MONO_API void mono_counters_on_register (MonoCounterRegisterCallback callback);
/*
* Create a readable dump of the counters for section_mask sections (ORed section values)
*/
MONO_API void mono_counters_dump (int section_mask, FILE *outfile);
MONO_API void mono_counters_cleanup (void);
typedef mono_bool (*CountersEnumCallback) (MonoCounter *counter, void *user_data);
MONO_API void mono_counters_foreach (CountersEnumCallback cb, void *user_data);
MONO_API int mono_counters_sample (MonoCounter *counter, void *buffer, int buffer_size);
MONO_API const char* mono_counter_get_name (MonoCounter *name);
MONO_API int mono_counter_get_type (MonoCounter *counter);
MONO_API int mono_counter_get_section (MonoCounter *counter);
MONO_API int mono_counter_get_unit (MonoCounter *counter);
MONO_API int mono_counter_get_variance (MonoCounter *counter);
MONO_API size_t mono_counter_get_size (MonoCounter *counter);
typedef enum {
MONO_RESOURCE_JIT_CODE, /* bytes */
MONO_RESOURCE_METADATA, /* bytes */
MONO_RESOURCE_GC_HEAP, /* bytes */
MONO_RESOURCE_COUNT /* non-ABI value */
} MonoResourceType;
typedef void (*MonoResourceCallback) (int resource_type, uintptr_t value, int is_soft);
MONO_API int mono_runtime_resource_limit (int resource_type, uintptr_t soft_limit, uintptr_t hard_limit);
MONO_API void mono_runtime_resource_set_callback (MonoResourceCallback callback);
MONO_API void mono_runtime_resource_check_limit (int resource_type, uintptr_t value);
#endif /* __MONO_COUNTERS_H__ */
@@ -0,0 +1,43 @@
/**
* \file
*/
#ifndef __MONO_UTILS_DL_FALLBACK_H__
#define __MONO_UTILS_DL_FALLBACK_H__
#include <mono/utils/mono-publib.h>
MONO_BEGIN_DECLS
enum {
MONO_DL_EAGER = 0,
MONO_DL_LAZY = 1,
// If MONO_DL_LOCAL is set, it will trump MONO_DL_GLOBAL.
MONO_DL_LOCAL = 2,
// MONO_DL_MASK is unused internally and no longer a full mask on netcore, given the introduction of MONO_DL_GLOBAL. Avoid.
MONO_DL_MASK = 3,
// Only applicable when building Mono in netcore mode.
MONO_DL_GLOBAL = 4
};
/*
* This is the dynamic loader fallback API
*/
typedef struct MonoDlFallbackHandler MonoDlFallbackHandler;
/*
* The "err" variable contents must be allocated using g_malloc or g_strdup
*/
typedef void* (*MonoDlFallbackLoad) (const char *name, int flags, char **err, void *user_data);
typedef void* (*MonoDlFallbackSymbol) (void *handle, const char *name, char **err, void *user_data);
typedef void* (*MonoDlFallbackClose) (void *handle, void *user_data);
MONO_API MonoDlFallbackHandler *mono_dl_fallback_register (MonoDlFallbackLoad load_func, MonoDlFallbackSymbol symbol_func,
MonoDlFallbackClose close_func, void *user_data);
MONO_API void mono_dl_fallback_unregister (MonoDlFallbackHandler *handler);
MONO_END_DECLS
#endif /* __MONO_UTILS_DL_FALLBACK_H__ */
@@ -0,0 +1,105 @@
/**
* \file
*/
#ifndef __MONO_ERROR_H__
#define __MONO_ERROR_H__
#include <mono/utils/mono-publib.h>
enum {
/*
The supplied strings were dup'd by means of calling mono_error_dup_strings.
*/
MONO_ERROR_FREE_STRINGS = 0x0001,
/*
Something happened while processing the error and the resulting message is incomplete.
*/
MONO_ERROR_INCOMPLETE = 0x0002,
/*
This MonoError is heap allocated in a mempool
*/
MONO_ERROR_MEMPOOL_BOXED = 0x0004
};
enum {
MONO_ERROR_NONE = 0,
MONO_ERROR_MISSING_METHOD = 1,
MONO_ERROR_MISSING_FIELD = 2,
MONO_ERROR_TYPE_LOAD = 3,
MONO_ERROR_FILE_NOT_FOUND = 4,
MONO_ERROR_BAD_IMAGE = 5,
MONO_ERROR_OUT_OF_MEMORY = 6,
MONO_ERROR_ARGUMENT = 7,
MONO_ERROR_ARGUMENT_NULL = 11,
MONO_ERROR_ARGUMENT_OUT_OF_RANGE = 14,
MONO_ERROR_NOT_VERIFIABLE = 8,
MONO_ERROR_INVALID_PROGRAM = 12,
MONO_ERROR_MEMBER_ACCESS = 13,
/*
* This is a generic error mechanism is you need to raise an arbitrary corlib exception.
* You must pass the exception name otherwise prepare_exception will fail with internal execution.
*/
MONO_ERROR_GENERIC = 9,
/* This one encapsulates a managed exception instance */
MONO_ERROR_EXCEPTION_INSTANCE = 10,
/* Not a valid error code - indicates that the error was cleaned up and reused */
MONO_ERROR_CLEANUP_CALLED_SENTINEL = 0xffff
};
#ifdef _MSC_VER
__pragma(warning (push))
__pragma(warning (disable:4201))
#endif
/*Keep in sync with MonoErrorInternal*/
typedef union _MonoError {
// Merge two uint16 into one uint32 so it can be initialized
// with one instruction instead of two.
uint32_t init;
struct {
uint16_t error_code;
uint16_t private_flags; /*DON'T TOUCH */
void *hidden_1 [12]; /*DON'T TOUCH */
};
} MonoErrorExternal;
#ifdef _MSC_VER
__pragma(warning (pop))
#endif
#ifdef MONO_INSIDE_RUNTIME
typedef union _MonoErrorInternal MonoError;
#else
typedef MonoErrorExternal MonoError;
#endif
/* Mempool-allocated MonoError.*/
typedef struct _MonoErrorBoxed MonoErrorBoxed;
MONO_BEGIN_DECLS
MONO_API MONO_RT_EXTERNAL_ONLY void
mono_error_init (MonoError *error);
MONO_API void
mono_error_init_flags (MonoError *error, unsigned short flags);
MONO_API void
mono_error_cleanup (MonoError *error);
MONO_API MONO_RT_EXTERNAL_ONLY mono_bool
mono_error_ok (MonoError *error);
MONO_API unsigned short
mono_error_get_error_code (MonoError *error);
MONO_API const char*
mono_error_get_message (MonoError *error);
MONO_END_DECLS
#endif
@@ -0,0 +1,15 @@
/**
* \file
*
* (C) 2018 Microsoft, Inc.
*
*/
#ifndef _MONO_UTILS_FORWARD_
#define _MONO_UTILS_FORWARD_
typedef struct _MonoDomain MonoDomain;
typedef struct _MonoJitInfo MonoJitInfo;
typedef void * MonoGCHandle;
#endif
@@ -0,0 +1,36 @@
/**
* \file
*
* Header for jemalloc registration code
*/
#ifndef __MONO_JEMALLOC_H__
#define __MONO_JEMALLOC_H__
#if defined(MONO_JEMALLOC_ENABLED)
#include <jemalloc/jemalloc.h>
/* Jemalloc can be configured in three ways.
* 1. You can use it with library loading hacks at run-time
* 2. You can use it as a global malloc replacement
* 3. You can use it with a prefix. If you use it with a prefix, you have to explicitly name the malloc function.
*
* In order to make this feature able to be toggled at run-time, I chose to use a prefix of mono_je.
* This mapping is captured below in the header, in the spirit of "no magic constants".
*
* The place that configures jemalloc and sets this prefix is in the Makefile in
* mono/jemalloc/Makefile.am
*
*/
#define MONO_JEMALLOC_MALLOC mono_jemalloc
#define MONO_JEMALLOC_REALLOC mono_jerealloc
#define MONO_JEMALLOC_FREE mono_jefree
#define MONO_JEMALLOC_CALLOC mono_jecalloc
void mono_init_jemalloc (void);
#endif
#endif
@@ -0,0 +1,31 @@
/**
* \file
*/
#ifndef __MONO_LOGGER_H__
#define __MONO_LOGGER_H__
#include <mono/utils/mono-publib.h>
MONO_BEGIN_DECLS
MONO_API void
mono_trace_set_level_string (const char *value);
MONO_API void
mono_trace_set_mask_string (const char *value);
typedef void (*MonoPrintCallback) (const char *string, mono_bool is_stdout);
typedef void (*MonoLogCallback) (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data);
MONO_API void
mono_trace_set_log_handler (MonoLogCallback callback, void *user_data);
MONO_API void
mono_trace_set_print_handler (MonoPrintCallback callback);
MONO_API void
mono_trace_set_printerr_handler (MonoPrintCallback callback);
MONO_END_DECLS
#endif /* __MONO_LOGGER_H__ */
@@ -0,0 +1,19 @@
/**
* \file
*
* Private unstable APIs.
*
* WARNING: The declarations and behavior of functions in this header are NOT STABLE and can be modified or removed at
* any time.
*
*/
#ifndef __MONO_UTILS_MONO_PRIVATE_UNSTABLE_H__
#define __MONO_UTILS_MONO_PRIVATE_UNSTABLE_H__
#include <mono/utils/mono-publib.h>
#endif /*__MONO_UTILS_MONO_PRIVATE_UNSTABLE_H__*/
@@ -0,0 +1,187 @@
/**
* \file
*/
#ifndef __MONO_PUBLIB_H__
#define __MONO_PUBLIB_H__
/*
* Minimal general purpose header for use in public mono header files.
* We can't include config.h, so we use compiler-specific preprocessor
* directives where needed.
*/
#ifdef __cplusplus
#define MONO_BEGIN_DECLS extern "C" {
#define MONO_END_DECLS }
#else
#define MONO_BEGIN_DECLS /* nothing */
#define MONO_END_DECLS /* nothing */
#endif
MONO_BEGIN_DECLS
/* VS 2010 and later have stdint.h */
#if defined(_MSC_VER)
#if _MSC_VER < 1600
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#define MONO_API_EXPORT __declspec(dllexport)
#define MONO_API_IMPORT __declspec(dllimport)
#else
#include <stdint.h>
#if defined (__clang__) || defined (__GNUC__)
#define MONO_API_EXPORT __attribute__ ((__visibility__ ("default")))
#else
#define MONO_API_EXPORT
#endif
#define MONO_API_IMPORT
#endif /* end of compiler-specific stuff */
#include <stdlib.h>
#ifdef __cplusplus
#define MONO_EXTERN_C extern "C"
#else
#define MONO_EXTERN_C /* nothing */
#endif
#if defined(MONO_DLL_EXPORT)
#define MONO_API_NO_EXTERN_C MONO_API_EXPORT
#elif defined(MONO_DLL_IMPORT)
#define MONO_API_NO_EXTERN_C MONO_API_IMPORT
#else
#define MONO_API_NO_EXTERN_C /* nothing */
#endif
#define MONO_API MONO_EXTERN_C MONO_API_NO_EXTERN_C
// Should (but not must) wrap in extern "C" (MONO_BEGIN_DECLS, MONO_END_DECLS).
#define MONO_API_DATA MONO_API_NO_EXTERN_C extern
typedef int32_t mono_bool;
typedef uint8_t mono_byte;
typedef mono_byte MonoBoolean;
#ifdef _WIN32
MONO_END_DECLS
#include <wchar.h>
typedef wchar_t mono_unichar2;
MONO_BEGIN_DECLS
#else
typedef uint16_t mono_unichar2;
#endif
typedef uint32_t mono_unichar4;
typedef void (*MonoFunc) (void* data, void* user_data);
typedef void (*MonoHFunc) (void* key, void* value, void* user_data);
MONO_API void mono_free (void *);
#define MONO_ALLOCATOR_VTABLE_VERSION 1
typedef struct {
int version;
void *(*malloc) (size_t size);
void *(*realloc) (void *mem, size_t count);
void (*free) (void *mem);
void *(*calloc) (size_t count, size_t size);
} MonoAllocatorVTable;
MONO_API mono_bool
mono_set_allocator_vtable (MonoAllocatorVTable* vtable);
#define MONO_CONST_RETURN const
/*
* When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any
* other Mono header file if you use a different compiler from the one used to
* build Mono.
*/
#ifndef MONO_ZERO_LEN_ARRAY
#ifdef __GNUC__
#define MONO_ZERO_LEN_ARRAY 0
#else
#define MONO_ZERO_LEN_ARRAY 1
#endif
#endif
#if defined (MONO_INSIDE_RUNTIME)
#if defined (__CENTRINEL__)
/* Centrinel is an analyzer that warns about raw pointer to managed objects
* inside Mono.
*/
#define MONO_RT_MANAGED_ATTR __CENTRINEL_MANAGED_ATTR
#define MONO_RT_CENTRINEL_SUPPRESS __CENTRINEL_SUPPRESS_ATTR(1)
#else
#define MONO_RT_MANAGED_ATTR
#define MONO_RT_CENTRINEL_SUPPRESS
#endif
#if defined (__clang__) || defined (__GNUC__)
// attribute(deprecated(message)) was introduced in gcc 4.5.
// attribute(deprecated)) was introduced in gcc 4.0.
// Compare: https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Function-Attributes.html
// https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Function-Attributes.html
// https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Function-Attributes.html
#if defined (__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define MONO_RT_EXTERNAL_ONLY \
__attribute__ ((__deprecated__ ("The mono runtime must not call this function."))) \
MONO_RT_CENTRINEL_SUPPRESS
#elif __GNUC__ >= 4
#define MONO_RT_EXTERNAL_ONLY __attribute__ ((__deprecated__)) MONO_RT_CENTRINEL_SUPPRESS
#else
#define MONO_RT_EXTERNAL_ONLY MONO_RT_CENTRINEL_SUPPRESS
#endif
#if defined (__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
// Pragmas for controlling diagnostics appear to be from gcc 4.2.
// This is used in place of configure gcc -Werror=deprecated-declarations:
// 1. To be portable across build systems.
// 2. configure is very sensitive to compiler flags; they break autoconf's probes.
// Though #2 can be mitigated by being late in configure.
#pragma GCC diagnostic error "-Wdeprecated-declarations"
#endif
#else
#define MONO_RT_EXTERNAL_ONLY MONO_RT_CENTRINEL_SUPPRESS
#endif // clang or gcc
#else
#define MONO_RT_EXTERNAL_ONLY
#define MONO_RT_MANAGED_ATTR
#endif /* MONO_INSIDE_RUNTIME */
#if defined (__clang__) || defined (__GNUC__)
#define _MONO_DEPRECATED __attribute__ ((__deprecated__))
#elif defined (_MSC_VER)
#define _MONO_DEPRECATED __declspec (deprecated)
#else
#define _MONO_DEPRECATED
#endif
#define MONO_DEPRECATED MONO_API MONO_RT_EXTERNAL_ONLY _MONO_DEPRECATED
MONO_END_DECLS
#endif /* __MONO_PUBLIB_H__ */
+11
View File
@@ -0,0 +1,11 @@
# Why mono?
Eventhough mono only supports up to donet Framework 4.8 while other options support all the latest features. As of now only mono supports reloading assemblies.
# Building Mono:
1. Clone the mono repository: `git clone --recursive https://github.com/mono/mono`
2. Build Mono:
- For Windows:
1. Open the solution `msvc/mono.sln`
2. Build the entire Solution (Debug and Release)
3. Binary output will be in `msvc\build\sgen\x64\lib\` (Debug and Release)
4. Include files will be in `msvc\include`
+2
View File
@@ -0,0 +1,2 @@
.vs/
obj/
+8
View File
@@ -0,0 +1,8 @@
FileVersion = 1
[Project]
Name = "ScriptCore"
TargetType = "CustomBuild"
[Configs.Debug.Win64]
PostBuildCmds = ["dotnet build \"$(WorkspaceDir)/ScriptCore/ScriptCore.csproj\" -c Debug"]
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace GlitchyEngine
{
public class CSharpTesting
{
public float MyPublicFloatVar = 5.0f;
public CSharpTesting()
{
Console.WriteLine("Hallo von C#!");
DoSomething();
Console.WriteLine(Sample());
}
[DllImport ("__Internal", EntryPoint="DoSomething")]
static extern void DoSomething();
[MethodImpl(MethodImplOptions.InternalCall)]
static extern string Sample();
public void PrintFloatVar()
{
Console.WriteLine("MyPublicFloatVar = {0:F}", MyPublicFloatVar);
}
private float IncrementFloatVar(float value)
{
MyPublicFloatVar += value;
return MyPublicFloatVar;
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("ScriptCore")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScriptCore")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("6222c226-fc78-498c-80ba-5cf10ac9123c")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+51
View File
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6222C226-FC78-498C-80BA-5CF10AC9123C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GlitchyEngine</RootNamespace>
<AssemblyName>ScriptCore</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\GlitchyEditor\resources\scripts\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>10</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\GlitchyEditor\resources\scripts\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>10</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CSharpTesting.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+25
View File
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptCore", "ScriptCore.csproj", "{6222C226-FC78-498C-80BA-5CF10AC9123C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {105B152D-6843-4A9F-AFA8-5F8A3920D95C}
EndGlobalSection
EndGlobal