From 7758538bf00aaf26a0f1e3d7ec0d87b55428b86b Mon Sep 17 00:00:00 2001 From: Kernell Date: Sat, 28 Nov 2015 04:34:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=BD=D0=BA=D0=BB=D1=83=D0=B4=D1=8B=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20Mono=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mta-mono/src/include/mono/cil/opcode.def | 337 ++++++++++++ mta-mono/src/include/mono/jit/jit.h | 95 ++++ .../src/include/mono/metadata/appdomain.h | 230 ++++++++ mta-mono/src/include/mono/metadata/assembly.h | 112 ++++ mta-mono/src/include/mono/metadata/attrdefs.h | 273 ++++++++++ mta-mono/src/include/mono/metadata/blob.h | 117 ++++ mta-mono/src/include/mono/metadata/class.h | 273 ++++++++++ .../src/include/mono/metadata/debug-helpers.h | 48 ++ .../mono/metadata/debug-mono-symfile.h | 166 ++++++ .../src/include/mono/metadata/environment.h | 22 + .../src/include/mono/metadata/exception.h | 147 +++++ mta-mono/src/include/mono/metadata/image.h | 83 +++ mta-mono/src/include/mono/metadata/loader.h | 100 ++++ mta-mono/src/include/mono/metadata/metadata.h | 503 ++++++++++++++++++ .../src/include/mono/metadata/mono-config.h | 34 ++ .../src/include/mono/metadata/mono-debug.h | 218 ++++++++ mta-mono/src/include/mono/metadata/mono-gc.h | 27 + mta-mono/src/include/mono/metadata/object.h | 361 +++++++++++++ mta-mono/src/include/mono/metadata/opcodes.h | 76 +++ mta-mono/src/include/mono/metadata/profiler.h | 222 ++++++++ .../src/include/mono/metadata/reflection.h | 141 +++++ .../src/include/mono/metadata/row-indexes.h | 480 +++++++++++++++++ .../src/include/mono/metadata/sgen-bridge.h | 70 +++ mta-mono/src/include/mono/metadata/threads.h | 55 ++ .../src/include/mono/metadata/tokentype.h | 41 ++ mta-mono/src/include/mono/metadata/verify.h | 62 +++ .../src/include/mono/utils/mono-counters.h | 98 ++++ .../src/include/mono/utils/mono-dl-fallback.h | 34 ++ mta-mono/src/include/mono/utils/mono-error.h | 66 +++ mta-mono/src/include/mono/utils/mono-logger.h | 28 + mta-mono/src/include/mono/utils/mono-publib.h | 79 +++ 31 files changed, 4598 insertions(+) create mode 100644 mta-mono/src/include/mono/cil/opcode.def create mode 100644 mta-mono/src/include/mono/jit/jit.h create mode 100644 mta-mono/src/include/mono/metadata/appdomain.h create mode 100644 mta-mono/src/include/mono/metadata/assembly.h create mode 100644 mta-mono/src/include/mono/metadata/attrdefs.h create mode 100644 mta-mono/src/include/mono/metadata/blob.h create mode 100644 mta-mono/src/include/mono/metadata/class.h create mode 100644 mta-mono/src/include/mono/metadata/debug-helpers.h create mode 100644 mta-mono/src/include/mono/metadata/debug-mono-symfile.h create mode 100644 mta-mono/src/include/mono/metadata/environment.h create mode 100644 mta-mono/src/include/mono/metadata/exception.h create mode 100644 mta-mono/src/include/mono/metadata/image.h create mode 100644 mta-mono/src/include/mono/metadata/loader.h create mode 100644 mta-mono/src/include/mono/metadata/metadata.h create mode 100644 mta-mono/src/include/mono/metadata/mono-config.h create mode 100644 mta-mono/src/include/mono/metadata/mono-debug.h create mode 100644 mta-mono/src/include/mono/metadata/mono-gc.h create mode 100644 mta-mono/src/include/mono/metadata/object.h create mode 100644 mta-mono/src/include/mono/metadata/opcodes.h create mode 100644 mta-mono/src/include/mono/metadata/profiler.h create mode 100644 mta-mono/src/include/mono/metadata/reflection.h create mode 100644 mta-mono/src/include/mono/metadata/row-indexes.h create mode 100644 mta-mono/src/include/mono/metadata/sgen-bridge.h create mode 100644 mta-mono/src/include/mono/metadata/threads.h create mode 100644 mta-mono/src/include/mono/metadata/tokentype.h create mode 100644 mta-mono/src/include/mono/metadata/verify.h create mode 100644 mta-mono/src/include/mono/utils/mono-counters.h create mode 100644 mta-mono/src/include/mono/utils/mono-dl-fallback.h create mode 100644 mta-mono/src/include/mono/utils/mono-error.h create mode 100644 mta-mono/src/include/mono/utils/mono-logger.h create mode 100644 mta-mono/src/include/mono/utils/mono-publib.h diff --git a/mta-mono/src/include/mono/cil/opcode.def b/mta-mono/src/include/mono/cil/opcode.def new file mode 100644 index 0000000..037b5ef --- /dev/null +++ b/mta-mono/src/include/mono/cil/opcode.def @@ -0,0 +1,337 @@ +/* GENERATED FILE, DO NOT EDIT */ +OPDEF(CEE_NOP, "nop", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x00, NEXT) +OPDEF(CEE_BREAK, "break", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x01, ERROR) +OPDEF(CEE_LDARG_0, "ldarg.0", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x02, NEXT) +OPDEF(CEE_LDARG_1, "ldarg.1", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x03, NEXT) +OPDEF(CEE_LDARG_2, "ldarg.2", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x04, NEXT) +OPDEF(CEE_LDARG_3, "ldarg.3", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x05, NEXT) +OPDEF(CEE_LDLOC_0, "ldloc.0", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x06, NEXT) +OPDEF(CEE_LDLOC_1, "ldloc.1", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x07, NEXT) +OPDEF(CEE_LDLOC_2, "ldloc.2", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x08, NEXT) +OPDEF(CEE_LDLOC_3, "ldloc.3", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x09, NEXT) +OPDEF(CEE_STLOC_0, "stloc.0", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0A, NEXT) +OPDEF(CEE_STLOC_1, "stloc.1", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0B, NEXT) +OPDEF(CEE_STLOC_2, "stloc.2", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0C, NEXT) +OPDEF(CEE_STLOC_3, "stloc.3", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0D, NEXT) +OPDEF(CEE_LDARG_S, "ldarg.s", Pop0, Push1, ShortInlineVar, X, 1, 0xFF, 0x0E, NEXT) +OPDEF(CEE_LDARGA_S, "ldarga.s", Pop0, PushI, ShortInlineVar, X, 1, 0xFF, 0x0F, NEXT) +OPDEF(CEE_STARG_S, "starg.s", Pop1, Push0, ShortInlineVar, X, 1, 0xFF, 0x10, NEXT) +OPDEF(CEE_LDLOC_S, "ldloc.s", Pop0, Push1, ShortInlineVar, X, 1, 0xFF, 0x11, NEXT) +OPDEF(CEE_LDLOCA_S, "ldloca.s", Pop0, PushI, ShortInlineVar, X, 1, 0xFF, 0x12, NEXT) +OPDEF(CEE_STLOC_S, "stloc.s", Pop1, Push0, ShortInlineVar, X, 1, 0xFF, 0x13, NEXT) +OPDEF(CEE_LDNULL, "ldnull", Pop0, PushRef, InlineNone, X, 1, 0xFF, 0x14, NEXT) +OPDEF(CEE_LDC_I4_M1, "ldc.i4.m1", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x15, NEXT) +OPDEF(CEE_LDC_I4_0, "ldc.i4.0", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x16, NEXT) +OPDEF(CEE_LDC_I4_1, "ldc.i4.1", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x17, NEXT) +OPDEF(CEE_LDC_I4_2, "ldc.i4.2", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x18, NEXT) +OPDEF(CEE_LDC_I4_3, "ldc.i4.3", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x19, NEXT) +OPDEF(CEE_LDC_I4_4, "ldc.i4.4", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1A, NEXT) +OPDEF(CEE_LDC_I4_5, "ldc.i4.5", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1B, NEXT) +OPDEF(CEE_LDC_I4_6, "ldc.i4.6", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1C, NEXT) +OPDEF(CEE_LDC_I4_7, "ldc.i4.7", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1D, NEXT) +OPDEF(CEE_LDC_I4_8, "ldc.i4.8", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1E, NEXT) +OPDEF(CEE_LDC_I4_S, "ldc.i4.s", Pop0, PushI, ShortInlineI, X, 1, 0xFF, 0x1F, NEXT) +OPDEF(CEE_LDC_I4, "ldc.i4", Pop0, PushI, InlineI, X, 1, 0xFF, 0x20, NEXT) +OPDEF(CEE_LDC_I8, "ldc.i8", Pop0, PushI8, InlineI8, X, 1, 0xFF, 0x21, NEXT) +OPDEF(CEE_LDC_R4, "ldc.r4", Pop0, PushR4, ShortInlineR, X, 1, 0xFF, 0x22, NEXT) +OPDEF(CEE_LDC_R8, "ldc.r8", Pop0, PushR8, InlineR, X, 1, 0xFF, 0x23, NEXT) +OPDEF(CEE_UNUSED99, "unused99", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x24, NEXT) +OPDEF(CEE_DUP, "dup", Pop1, Push1+Push1, InlineNone, X, 1, 0xFF, 0x25, NEXT) +OPDEF(CEE_POP, "pop", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x26, NEXT) +OPDEF(CEE_JMP, "jmp", Pop0, Push0, InlineMethod, X, 1, 0xFF, 0x27, CALL) +OPDEF(CEE_CALL, "call", VarPop, VarPush, InlineMethod, X, 1, 0xFF, 0x28, CALL) +OPDEF(CEE_CALLI, "calli", VarPop, VarPush, InlineSig, X, 1, 0xFF, 0x29, CALL) +OPDEF(CEE_RET, "ret", VarPop, Push0, InlineNone, X, 1, 0xFF, 0x2A, RETURN) +OPDEF(CEE_BR_S, "br.s", Pop0, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2B, BRANCH) +OPDEF(CEE_BRFALSE_S, "brfalse.s", PopI, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2C, COND_BRANCH) +OPDEF(CEE_BRTRUE_S, "brtrue.s", PopI, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2D, COND_BRANCH) +OPDEF(CEE_BEQ_S, "beq.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2E, COND_BRANCH) +OPDEF(CEE_BGE_S, "bge.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2F, COND_BRANCH) +OPDEF(CEE_BGT_S, "bgt.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x30, COND_BRANCH) +OPDEF(CEE_BLE_S, "ble.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x31, COND_BRANCH) +OPDEF(CEE_BLT_S, "blt.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x32, COND_BRANCH) +OPDEF(CEE_BNE_UN_S, "bne.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x33, COND_BRANCH) +OPDEF(CEE_BGE_UN_S, "bge.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x34, COND_BRANCH) +OPDEF(CEE_BGT_UN_S, "bgt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x35, COND_BRANCH) +OPDEF(CEE_BLE_UN_S, "ble.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x36, COND_BRANCH) +OPDEF(CEE_BLT_UN_S, "blt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x37, COND_BRANCH) +OPDEF(CEE_BR, "br", Pop0, Push0, InlineBrTarget, X, 1, 0xFF, 0x38, BRANCH) +OPDEF(CEE_BRFALSE, "brfalse", PopI, Push0, InlineBrTarget, X, 1, 0xFF, 0x39, COND_BRANCH) +OPDEF(CEE_BRTRUE, "brtrue", PopI, Push0, InlineBrTarget, X, 1, 0xFF, 0x3A, COND_BRANCH) +OPDEF(CEE_BEQ, "beq", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3B, COND_BRANCH) +OPDEF(CEE_BGE, "bge", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3C, COND_BRANCH) +OPDEF(CEE_BGT, "bgt", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3D, COND_BRANCH) +OPDEF(CEE_BLE, "ble", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3E, COND_BRANCH) +OPDEF(CEE_BLT, "blt", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3F, COND_BRANCH) +OPDEF(CEE_BNE_UN, "bne.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x40, COND_BRANCH) +OPDEF(CEE_BGE_UN, "bge.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x41, COND_BRANCH) +OPDEF(CEE_BGT_UN, "bgt.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x42, COND_BRANCH) +OPDEF(CEE_BLE_UN, "ble.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x43, COND_BRANCH) +OPDEF(CEE_BLT_UN, "blt.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x44, COND_BRANCH) +OPDEF(CEE_SWITCH, "switch", PopI, Push0, InlineSwitch, X, 1, 0xFF, 0x45, COND_BRANCH) +OPDEF(CEE_LDIND_I1, "ldind.i1", PopI, PushI, InlineNone, X, 1, 0xFF, 0x46, NEXT) +OPDEF(CEE_LDIND_U1, "ldind.u1", PopI, PushI, InlineNone, X, 1, 0xFF, 0x47, NEXT) +OPDEF(CEE_LDIND_I2, "ldind.i2", PopI, PushI, InlineNone, X, 1, 0xFF, 0x48, NEXT) +OPDEF(CEE_LDIND_U2, "ldind.u2", PopI, PushI, InlineNone, X, 1, 0xFF, 0x49, NEXT) +OPDEF(CEE_LDIND_I4, "ldind.i4", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4A, NEXT) +OPDEF(CEE_LDIND_U4, "ldind.u4", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4B, NEXT) +OPDEF(CEE_LDIND_I8, "ldind.i8", PopI, PushI8, InlineNone, X, 1, 0xFF, 0x4C, NEXT) +OPDEF(CEE_LDIND_I, "ldind.i", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4D, NEXT) +OPDEF(CEE_LDIND_R4, "ldind.r4", PopI, PushR4, InlineNone, X, 1, 0xFF, 0x4E, NEXT) +OPDEF(CEE_LDIND_R8, "ldind.r8", PopI, PushR8, InlineNone, X, 1, 0xFF, 0x4F, NEXT) +OPDEF(CEE_LDIND_REF, "ldind.ref", PopI, PushRef, InlineNone, X, 1, 0xFF, 0x50, NEXT) +OPDEF(CEE_STIND_REF, "stind.ref", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x51, NEXT) +OPDEF(CEE_STIND_I1, "stind.i1", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x52, NEXT) +OPDEF(CEE_STIND_I2, "stind.i2", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x53, NEXT) +OPDEF(CEE_STIND_I4, "stind.i4", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x54, NEXT) +OPDEF(CEE_STIND_I8, "stind.i8", PopI+PopI8, Push0, InlineNone, X, 1, 0xFF, 0x55, NEXT) +OPDEF(CEE_STIND_R4, "stind.r4", PopI+PopR4, Push0, InlineNone, X, 1, 0xFF, 0x56, NEXT) +OPDEF(CEE_STIND_R8, "stind.r8", PopI+PopR8, Push0, InlineNone, X, 1, 0xFF, 0x57, NEXT) +OPDEF(CEE_ADD, "add", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x58, NEXT) +OPDEF(CEE_SUB, "sub", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x59, NEXT) +OPDEF(CEE_MUL, "mul", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5A, NEXT) +OPDEF(CEE_DIV, "div", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5B, NEXT) +OPDEF(CEE_DIV_UN, "div.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5C, NEXT) +OPDEF(CEE_REM, "rem", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5D, NEXT) +OPDEF(CEE_REM_UN, "rem.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5E, NEXT) +OPDEF(CEE_AND, "and", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5F, NEXT) +OPDEF(CEE_OR, "or", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x60, NEXT) +OPDEF(CEE_XOR, "xor", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x61, NEXT) +OPDEF(CEE_SHL, "shl", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x62, NEXT) +OPDEF(CEE_SHR, "shr", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x63, NEXT) +OPDEF(CEE_SHR_UN, "shr.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x64, NEXT) +OPDEF(CEE_NEG, "neg", Pop1, Push1, InlineNone, X, 1, 0xFF, 0x65, NEXT) +OPDEF(CEE_NOT, "not", Pop1, Push1, InlineNone, X, 1, 0xFF, 0x66, NEXT) +OPDEF(CEE_CONV_I1, "conv.i1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x67, NEXT) +OPDEF(CEE_CONV_I2, "conv.i2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x68, NEXT) +OPDEF(CEE_CONV_I4, "conv.i4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x69, NEXT) +OPDEF(CEE_CONV_I8, "conv.i8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x6A, NEXT) +OPDEF(CEE_CONV_R4, "conv.r4", Pop1, PushR4, InlineNone, X, 1, 0xFF, 0x6B, NEXT) +OPDEF(CEE_CONV_R8, "conv.r8", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0x6C, NEXT) +OPDEF(CEE_CONV_U4, "conv.u4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x6D, NEXT) +OPDEF(CEE_CONV_U8, "conv.u8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x6E, NEXT) +OPDEF(CEE_CALLVIRT, "callvirt", VarPop, VarPush, InlineMethod, X, 1, 0xFF, 0x6F, CALL) +OPDEF(CEE_CPOBJ, "cpobj", PopI+PopI, Push0, InlineType, X, 1, 0xFF, 0x70, NEXT) +OPDEF(CEE_LDOBJ, "ldobj", PopI, Push1, InlineType, X, 1, 0xFF, 0x71, NEXT) +OPDEF(CEE_LDSTR, "ldstr", Pop0, PushRef, InlineString, X, 1, 0xFF, 0x72, NEXT) +OPDEF(CEE_NEWOBJ, "newobj", VarPop, PushRef, InlineMethod, X, 1, 0xFF, 0x73, CALL) +OPDEF(CEE_CASTCLASS, "castclass", PopRef, PushRef, InlineType, X, 1, 0xFF, 0x74, NEXT) +OPDEF(CEE_ISINST, "isinst", PopRef, PushI, InlineType, X, 1, 0xFF, 0x75, NEXT) +OPDEF(CEE_CONV_R_UN, "conv.r.un", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0x76, NEXT) +OPDEF(CEE_UNUSED58, "unused58", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x77, NEXT) +OPDEF(CEE_UNUSED1, "unused1", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x78, NEXT) +OPDEF(CEE_UNBOX, "unbox", PopRef, PushI, InlineType, X, 1, 0xFF, 0x79, NEXT) +OPDEF(CEE_THROW, "throw", PopRef, Push0, InlineNone, X, 1, 0xFF, 0x7A, ERROR) +OPDEF(CEE_LDFLD, "ldfld", PopRef, Push1, InlineField, X, 1, 0xFF, 0x7B, NEXT) +OPDEF(CEE_LDFLDA, "ldflda", PopRef, PushI, InlineField, X, 1, 0xFF, 0x7C, NEXT) +OPDEF(CEE_STFLD, "stfld", PopRef+Pop1, Push0, InlineField, X, 1, 0xFF, 0x7D, NEXT) +OPDEF(CEE_LDSFLD, "ldsfld", Pop0, Push1, InlineField, X, 1, 0xFF, 0x7E, NEXT) +OPDEF(CEE_LDSFLDA, "ldsflda", Pop0, PushI, InlineField, X, 1, 0xFF, 0x7F, NEXT) +OPDEF(CEE_STSFLD, "stsfld", Pop1, Push0, InlineField, X, 1, 0xFF, 0x80, NEXT) +OPDEF(CEE_STOBJ, "stobj", PopI+Pop1, Push0, InlineType, X, 1, 0xFF, 0x81, NEXT) +OPDEF(CEE_CONV_OVF_I1_UN, "conv.ovf.i1.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x82, NEXT) +OPDEF(CEE_CONV_OVF_I2_UN, "conv.ovf.i2.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x83, NEXT) +OPDEF(CEE_CONV_OVF_I4_UN, "conv.ovf.i4.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x84, NEXT) +OPDEF(CEE_CONV_OVF_I8_UN, "conv.ovf.i8.un", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x85, NEXT) +OPDEF(CEE_CONV_OVF_U1_UN, "conv.ovf.u1.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x86, NEXT) +OPDEF(CEE_CONV_OVF_U2_UN, "conv.ovf.u2.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x87, NEXT) +OPDEF(CEE_CONV_OVF_U4_UN, "conv.ovf.u4.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x88, NEXT) +OPDEF(CEE_CONV_OVF_U8_UN, "conv.ovf.u8.un", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x89, NEXT) +OPDEF(CEE_CONV_OVF_I_UN, "conv.ovf.i.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x8A, NEXT) +OPDEF(CEE_CONV_OVF_U_UN, "conv.ovf.u.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x8B, NEXT) +OPDEF(CEE_BOX, "box", Pop1, PushRef, InlineType, X, 1, 0xFF, 0x8C, NEXT) +OPDEF(CEE_NEWARR, "newarr", PopI, PushRef, InlineType, X, 1, 0xFF, 0x8D, NEXT) +OPDEF(CEE_LDLEN, "ldlen", PopRef, PushI, InlineNone, X, 1, 0xFF, 0x8E, NEXT) +OPDEF(CEE_LDELEMA, "ldelema", PopRef+PopI, PushI, InlineType, X, 1, 0xFF, 0x8F, NEXT) +OPDEF(CEE_LDELEM_I1, "ldelem.i1", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x90, NEXT) +OPDEF(CEE_LDELEM_U1, "ldelem.u1", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x91, NEXT) +OPDEF(CEE_LDELEM_I2, "ldelem.i2", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x92, NEXT) +OPDEF(CEE_LDELEM_U2, "ldelem.u2", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x93, NEXT) +OPDEF(CEE_LDELEM_I4, "ldelem.i4", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x94, NEXT) +OPDEF(CEE_LDELEM_U4, "ldelem.u4", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x95, NEXT) +OPDEF(CEE_LDELEM_I8, "ldelem.i8", PopRef+PopI, PushI8, InlineNone, X, 1, 0xFF, 0x96, NEXT) +OPDEF(CEE_LDELEM_I, "ldelem.i", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x97, NEXT) +OPDEF(CEE_LDELEM_R4, "ldelem.r4", PopRef+PopI, PushR4, InlineNone, X, 1, 0xFF, 0x98, NEXT) +OPDEF(CEE_LDELEM_R8, "ldelem.r8", PopRef+PopI, PushR8, InlineNone, X, 1, 0xFF, 0x99, NEXT) +OPDEF(CEE_LDELEM_REF, "ldelem.ref", PopRef+PopI, PushRef, InlineNone, X, 1, 0xFF, 0x9A, NEXT) +OPDEF(CEE_STELEM_I, "stelem.i", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9B, NEXT) +OPDEF(CEE_STELEM_I1, "stelem.i1", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9C, NEXT) +OPDEF(CEE_STELEM_I2, "stelem.i2", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9D, NEXT) +OPDEF(CEE_STELEM_I4, "stelem.i4", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9E, NEXT) +OPDEF(CEE_STELEM_I8, "stelem.i8", PopRef+PopI+PopI8, Push0, InlineNone, X, 1, 0xFF, 0x9F, NEXT) +OPDEF(CEE_STELEM_R4, "stelem.r4", PopRef+PopI+PopR4, Push0, InlineNone, X, 1, 0xFF, 0xA0, NEXT) +OPDEF(CEE_STELEM_R8, "stelem.r8", PopRef+PopI+PopR8, Push0, InlineNone, X, 1, 0xFF, 0xA1, NEXT) +OPDEF(CEE_STELEM_REF, "stelem.ref", PopRef+PopI+PopRef, Push0, InlineNone, X, 1, 0xFF, 0xA2, NEXT) +OPDEF(CEE_LDELEM, "ldelem", PopRef+PopI, Push1, InlineType, X, 1, 0xFF, 0xA3, NEXT) +OPDEF(CEE_STELEM, "stelem", PopRef+PopI+Pop1, Push0, InlineType, X, 1, 0xFF, 0xA4, NEXT) +OPDEF(CEE_UNBOX_ANY, "unbox.any", PopRef, Push1, InlineType, X, 1, 0xFF, 0xA5, NEXT) +OPDEF(CEE_UNUSED5, "unused5", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA6, NEXT) +OPDEF(CEE_UNUSED6, "unused6", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA7, NEXT) +OPDEF(CEE_UNUSED7, "unused7", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA8, NEXT) +OPDEF(CEE_UNUSED8, "unused8", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA9, NEXT) +OPDEF(CEE_UNUSED9, "unused9", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAA, NEXT) +OPDEF(CEE_UNUSED10, "unused10", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAB, NEXT) +OPDEF(CEE_UNUSED11, "unused11", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAC, NEXT) +OPDEF(CEE_UNUSED12, "unused12", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAD, NEXT) +OPDEF(CEE_UNUSED13, "unused13", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAE, NEXT) +OPDEF(CEE_UNUSED14, "unused14", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAF, NEXT) +OPDEF(CEE_UNUSED15, "unused15", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB0, NEXT) +OPDEF(CEE_UNUSED16, "unused16", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB1, NEXT) +OPDEF(CEE_UNUSED17, "unused17", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB2, NEXT) +OPDEF(CEE_CONV_OVF_I1, "conv.ovf.i1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB3, NEXT) +OPDEF(CEE_CONV_OVF_U1, "conv.ovf.u1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB4, NEXT) +OPDEF(CEE_CONV_OVF_I2, "conv.ovf.i2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB5, NEXT) +OPDEF(CEE_CONV_OVF_U2, "conv.ovf.u2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB6, NEXT) +OPDEF(CEE_CONV_OVF_I4, "conv.ovf.i4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB7, NEXT) +OPDEF(CEE_CONV_OVF_U4, "conv.ovf.u4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB8, NEXT) +OPDEF(CEE_CONV_OVF_I8, "conv.ovf.i8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0xB9, NEXT) +OPDEF(CEE_CONV_OVF_U8, "conv.ovf.u8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0xBA, NEXT) +OPDEF(CEE_UNUSED50, "unused50", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBB, NEXT) +OPDEF(CEE_UNUSED18, "unused18", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBC, NEXT) +OPDEF(CEE_UNUSED19, "unused19", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBD, NEXT) +OPDEF(CEE_UNUSED20, "unused20", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBE, NEXT) +OPDEF(CEE_UNUSED21, "unused21", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBF, NEXT) +OPDEF(CEE_UNUSED22, "unused22", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC0, NEXT) +OPDEF(CEE_UNUSED23, "unused23", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC1, NEXT) +OPDEF(CEE_REFANYVAL, "refanyval", Pop1, PushI, InlineType, X, 1, 0xFF, 0xC2, NEXT) +OPDEF(CEE_CKFINITE, "ckfinite", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0xC3, NEXT) +OPDEF(CEE_UNUSED24, "unused24", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC4, NEXT) +OPDEF(CEE_UNUSED25, "unused25", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC5, NEXT) +OPDEF(CEE_MKREFANY, "mkrefany", PopI, Push1, InlineType, X, 1, 0xFF, 0xC6, NEXT) +OPDEF(CEE_UNUSED59, "unused59", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC7, NEXT) +OPDEF(CEE_UNUSED60, "unused60", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC8, NEXT) +OPDEF(CEE_UNUSED61, "unused61", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC9, NEXT) +OPDEF(CEE_UNUSED62, "unused62", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCA, NEXT) +OPDEF(CEE_UNUSED63, "unused63", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCB, NEXT) +OPDEF(CEE_UNUSED64, "unused64", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCC, NEXT) +OPDEF(CEE_UNUSED65, "unused65", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCD, NEXT) +OPDEF(CEE_UNUSED66, "unused66", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCE, NEXT) +OPDEF(CEE_UNUSED67, "unused67", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCF, NEXT) +OPDEF(CEE_LDTOKEN, "ldtoken", Pop0, PushI, InlineTok, X, 1, 0xFF, 0xD0, NEXT) +OPDEF(CEE_CONV_U2, "conv.u2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD1, NEXT) +OPDEF(CEE_CONV_U1, "conv.u1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD2, NEXT) +OPDEF(CEE_CONV_I, "conv.i", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD3, NEXT) +OPDEF(CEE_CONV_OVF_I, "conv.ovf.i", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD4, NEXT) +OPDEF(CEE_CONV_OVF_U, "conv.ovf.u", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD5, NEXT) +OPDEF(CEE_ADD_OVF, "add.ovf", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD6, NEXT) +OPDEF(CEE_ADD_OVF_UN, "add.ovf.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD7, NEXT) +OPDEF(CEE_MUL_OVF, "mul.ovf", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD8, NEXT) +OPDEF(CEE_MUL_OVF_UN, "mul.ovf.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD9, NEXT) +OPDEF(CEE_SUB_OVF, "sub.ovf", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xDA, NEXT) +OPDEF(CEE_SUB_OVF_UN, "sub.ovf.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xDB, NEXT) +OPDEF(CEE_ENDFINALLY, "endfinally", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xDC, RETURN) +OPDEF(CEE_LEAVE, "leave", Pop0, Push0, InlineBrTarget, X, 1, 0xFF, 0xDD, BRANCH) +OPDEF(CEE_LEAVE_S, "leave.s", Pop0, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0xDE, BRANCH) +OPDEF(CEE_STIND_I, "stind.i", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0xDF, NEXT) +OPDEF(CEE_CONV_U, "conv.u", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xE0, NEXT) +OPDEF(CEE_UNUSED26, "unused26", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE1, NEXT) +OPDEF(CEE_UNUSED27, "unused27", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE2, NEXT) +OPDEF(CEE_UNUSED28, "unused28", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE3, NEXT) +OPDEF(CEE_UNUSED29, "unused29", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE4, NEXT) +OPDEF(CEE_UNUSED30, "unused30", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE5, NEXT) +OPDEF(CEE_UNUSED31, "unused31", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE6, NEXT) +OPDEF(CEE_UNUSED32, "unused32", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE7, NEXT) +OPDEF(CEE_UNUSED33, "unused33", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE8, NEXT) +OPDEF(CEE_UNUSED34, "unused34", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE9, NEXT) +OPDEF(CEE_UNUSED35, "unused35", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEA, NEXT) +OPDEF(CEE_UNUSED36, "unused36", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEB, NEXT) +OPDEF(CEE_UNUSED37, "unused37", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEC, NEXT) +OPDEF(CEE_UNUSED38, "unused38", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xED, NEXT) +OPDEF(CEE_UNUSED39, "unused39", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEE, NEXT) +OPDEF(CEE_UNUSED40, "unused40", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEF, NEXT) +OPDEF(CEE_UNUSED41, "unused41", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF0, NEXT) +OPDEF(CEE_UNUSED42, "unused42", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF1, NEXT) +OPDEF(CEE_UNUSED43, "unused43", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF2, NEXT) +OPDEF(CEE_UNUSED44, "unused44", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF3, NEXT) +OPDEF(CEE_UNUSED45, "unused45", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF4, NEXT) +OPDEF(CEE_UNUSED46, "unused46", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF5, NEXT) +OPDEF(CEE_UNUSED47, "unused47", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF6, NEXT) +OPDEF(CEE_UNUSED48, "unused48", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF7, NEXT) +OPDEF(CEE_PREFIX7, "prefix7", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF8, META) +OPDEF(CEE_PREFIX6, "prefix6", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF9, META) +OPDEF(CEE_PREFIX5, "prefix5", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFA, META) +OPDEF(CEE_PREFIX4, "prefix4", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFB, META) +OPDEF(CEE_PREFIX3, "prefix3", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFC, META) +OPDEF(CEE_PREFIX2, "prefix2", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFD, META) +OPDEF(CEE_PREFIX1, "prefix1", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFE, META) +OPDEF(CEE_PREFIXREF, "prefixref", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFF, META) +OPDEF(CEE_ARGLIST, "arglist", Pop0, PushI, InlineNone, X, 2, 0xFE, 0x00, NEXT) +OPDEF(CEE_CEQ, "ceq", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x01, NEXT) +OPDEF(CEE_CGT, "cgt", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x02, NEXT) +OPDEF(CEE_CGT_UN, "cgt.un", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x03, NEXT) +OPDEF(CEE_CLT, "clt", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x04, NEXT) +OPDEF(CEE_CLT_UN, "clt.un", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x05, NEXT) +OPDEF(CEE_LDFTN, "ldftn", Pop0, PushI, InlineMethod, X, 2, 0xFE, 0x06, NEXT) +OPDEF(CEE_LDVIRTFTN, "ldvirtftn", PopRef, PushI, InlineMethod, X, 2, 0xFE, 0x07, NEXT) +OPDEF(CEE_UNUSED56, "unused56", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x08, NEXT) +OPDEF(CEE_LDARG, "ldarg", Pop0, Push1, InlineVar, X, 2, 0xFE, 0x09, NEXT) +OPDEF(CEE_LDARGA, "ldarga", Pop0, PushI, InlineVar, X, 2, 0xFE, 0x0A, NEXT) +OPDEF(CEE_STARG, "starg", Pop1, Push0, InlineVar, X, 2, 0xFE, 0x0B, NEXT) +OPDEF(CEE_LDLOC, "ldloc", Pop0, Push1, InlineVar, X, 2, 0xFE, 0x0C, NEXT) +OPDEF(CEE_LDLOCA, "ldloca", Pop0, PushI, InlineVar, X, 2, 0xFE, 0x0D, NEXT) +OPDEF(CEE_STLOC, "stloc", Pop1, Push0, InlineVar, X, 2, 0xFE, 0x0E, NEXT) +OPDEF(CEE_LOCALLOC, "localloc", PopI, PushI, InlineNone, X, 2, 0xFE, 0x0F, NEXT) +OPDEF(CEE_UNUSED57, "unused57", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x10, NEXT) +OPDEF(CEE_ENDFILTER, "endfilter", PopI, Push0, InlineNone, X, 2, 0xFE, 0x11, RETURN) +OPDEF(CEE_UNALIGNED_, "unaligned.", Pop0, Push0, ShortInlineI, X, 2, 0xFE, 0x12, META) +OPDEF(CEE_VOLATILE_, "volatile.", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x13, META) +OPDEF(CEE_TAIL_, "tail.", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x14, META) +OPDEF(CEE_INITOBJ, "initobj", PopI, Push0, InlineType, X, 2, 0xFE, 0x15, NEXT) +OPDEF(CEE_CONSTRAINED_, "constrained.", Pop0, Push0, InlineType, X, 2, 0xFE, 0x16, META) +OPDEF(CEE_CPBLK, "cpblk", PopI+PopI+PopI, Push0, InlineNone, X, 2, 0xFE, 0x17, NEXT) +OPDEF(CEE_INITBLK, "initblk", PopI+PopI+PopI, Push0, InlineNone, X, 2, 0xFE, 0x18, NEXT) +OPDEF(CEE_NO_, "no.", Pop0, Push0, ShortInlineI, X, 2, 0xFE, 0x19, NEXT) +OPDEF(CEE_RETHROW, "rethrow", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1A, ERROR) +OPDEF(CEE_UNUSED, "unused", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1B, NEXT) +OPDEF(CEE_SIZEOF, "sizeof", Pop0, PushI, InlineType, X, 2, 0xFE, 0x1C, NEXT) +OPDEF(CEE_REFANYTYPE, "refanytype", Pop1, PushI, InlineNone, X, 2, 0xFE, 0x1D, NEXT) +OPDEF(CEE_READONLY_, "readonly.", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1E, META) +OPDEF(CEE_UNUSED53, "unused53", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1F, NEXT) +OPDEF(CEE_UNUSED54, "unused54", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x20, NEXT) +OPDEF(CEE_UNUSED55, "unused55", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x21, NEXT) +OPDEF(CEE_UNUSED70, "unused70", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x22, NEXT) +OPDEF(CEE_ILLEGAL, "illegal", Pop0, Push0, InlineNone, X, 2, 0x00, 0x00, META) +OPDEF(CEE_ENDMAC, "endmac", Pop0, Push0, InlineNone, X, 2, 0x00, 0x00, META) +OPDEF(CEE_MONO_ICALL, "mono_icall", VarPop, VarPush, ShortInlineI, X, 2, 0xF0, 0x00, NEXT) +OPDEF(CEE_MONO_OBJADDR, "mono_objaddr", Pop1, PushI, InlineNone, X, 2, 0xF0, 0x01, NEXT) +OPDEF(CEE_MONO_LDPTR, "mono_ldptr", Pop0, PushI, InlineI, X, 2, 0xF0, 0x02, NEXT) +OPDEF(CEE_MONO_VTADDR, "mono_vtaddr", Pop1, PushI, InlineNone, X, 2, 0xF0, 0x03, NEXT) +OPDEF(CEE_MONO_NEWOBJ, "mono_newobj", Pop0, PushRef, InlineType, X, 2, 0xF0, 0x04, NEXT) +OPDEF(CEE_MONO_RETOBJ, "mono_retobj", PopI, Push0, InlineType, X, 2, 0xF0, 0x05, RETURN) +OPDEF(CEE_MONO_LDNATIVEOBJ, "mono_ldnativeobj", PopI, Push1, InlineType, X, 2, 0xF0, 0x06, RETURN) +OPDEF(CEE_MONO_CISINST, "mono_cisinst", PopRef, Push1, InlineType, X, 2, 0xF0, 0x07, NEXT) +OPDEF(CEE_MONO_CCASTCLASS, "mono_ccastclass", PopRef, Push1, InlineType, X, 2, 0xF0, 0x08, NEXT) +OPDEF(CEE_MONO_SAVE_LMF, "mono_save_lmf", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x09, NEXT) +OPDEF(CEE_MONO_RESTORE_LMF, "mono_restore_lmf", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x0A, NEXT) +OPDEF(CEE_MONO_CLASSCONST, "mono_classconst", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0B, NEXT) +OPDEF(CEE_MONO_NOT_TAKEN, "mono_not_taken", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x0C, NEXT) +OPDEF(CEE_MONO_TLS, "mono_tls", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0D, NEXT) +OPDEF(CEE_MONO_ICALL_ADDR, "mono_icall_addr", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0E, NEXT) +OPDEF(CEE_MONO_DYN_CALL, "mono_dyn_call", Pop0, PushI, InlineI, X, 2, 0xF0, 0x0F, NEXT) +OPDEF(CEE_MONO_MEMORY_BARRIER, "mono_memory_barrier", Pop0, Push0, InlineI, X, 2, 0xF0, 0x10, NEXT) +OPDEF(CEE_MONO_JIT_ATTACH, "mono_jit_attach", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x11, NEXT) +OPDEF(CEE_MONO_JIT_DETACH, "mono_jit_detach", Pop0, Push0, InlineNone, X, 2, 0xF0, 0x12, NEXT) +OPDEF(CEE_MONO_JIT_ICALL_ADDR, "mono_jit_icall_addr", Pop0, PushI, InlineI, X, 2, 0xF0, 0x13, NEXT) +OPDEF(CEE_MONO_LDPTR_INT_REQ_FLAG, "mono_ldptr_int_req_flag", Pop0, PushI, InlineNone, X, 2, 0xF0, 0x14, NEXT) +OPDEF(CEE_MONO_LDPTR_CARD_TABLE, "mono_ldptr_card_table", Pop0, PushI, InlineNone, X, 2, 0xF0, 0x15, NEXT) +OPDEF(CEE_MONO_LDPTR_NURSERY_START, "mono_ldptr_nursery_start", Pop0, PushI, InlineNone, X, 2, 0xF0, 0x16, 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 diff --git a/mta-mono/src/include/mono/jit/jit.h b/mta-mono/src/include/mono/jit/jit.h new file mode 100644 index 0000000..cbff1aa --- /dev/null +++ b/mta-mono/src/include/mono/jit/jit.h @@ -0,0 +1,95 @@ +/* + * Author: + * Dietmar Maurer (dietmar@ximian.com) + * + * (C) 2001, 2002, 2003 Ximian, Inc. + */ + +#ifndef _MONO_JIT_JIT_H_ +#define _MONO_JIT_JIT_H_ + +#include + +MONO_BEGIN_DECLS + +MONO_API MonoDomain * +mono_jit_init (const char *file); + +MONO_API MonoDomain * +mono_jit_init_version (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 hyrbid 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 +} MonoAotMode; + +MONO_API void +mono_jit_set_aot_mode (MonoAotMode mode); + +/* 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); + +/* The following APIs are not stable. Avoid if possible. */ + +MONO_API MonoJitInfo * +mono_get_jit_info_from_method (MonoDomain *domain, MonoMethod *method); + +MONO_API void * +mono_aot_get_method (MonoDomain *domain, MonoMethod *method); + +MONO_END_DECLS + +#endif + diff --git a/mta-mono/src/include/mono/metadata/appdomain.h b/mta-mono/src/include/mono/metadata/appdomain.h new file mode 100644 index 0000000..c80b878 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/appdomain.h @@ -0,0 +1,230 @@ +/* + * appdomain.h: AppDomain functions + * + * Author: + * Dietmar Maurer (dietmar@ximian.com) + * + * (C) 2001 Ximian, Inc. + */ + +#ifndef _MONO_METADATA_APPDOMAIN_H_ +#define _MONO_METADATA_APPDOMAIN_H_ + +#include + +#include +#include + +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 struct _MonoJitInfo MonoJitInfo; + +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 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 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 MonoDomain * +mono_domain_create_appdomain (char *friendly_name, char *configuration_file); + +MONO_API 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_bool +mono_domain_set (MonoDomain *domain, mono_bool force); + +MONO_API void +mono_domain_set_internal (MonoDomain *domain); + +MONO_API 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 MonoDomain * +mono_domain_from_appdomain (MonoAppDomain *appdomain); + +MONO_API void +mono_domain_foreach (MonoDomainFunc func, void* user_data); + +MONO_API MonoAssembly * +mono_domain_assembly_open (MonoDomain *domain, const char *name); + +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 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 void +mono_context_init (MonoDomain *domain); + +MONO_API 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, char *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_ */ + diff --git a/mta-mono/src/include/mono/metadata/assembly.h b/mta-mono/src/include/mono/metadata/assembly.h new file mode 100644 index 0000000..bdf3d75 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/assembly.h @@ -0,0 +1,112 @@ +#ifndef _MONONET_METADATA_ASSEMBLY_H_ +#define _MONONET_METADATA_ASSEMBLY_H_ + +#include + +MONO_BEGIN_DECLS + +MONO_API void mono_assemblies_init (void); +MONO_API void mono_assemblies_cleanup (void); +MONO_API MonoAssembly *mono_assembly_open (const char *filename, + MonoImageOpenStatus *status); +MONO_API MonoAssembly *mono_assembly_open_full (const char *filename, + MonoImageOpenStatus *status, + mono_bool refonly); +MONO_API MonoAssembly* mono_assembly_load (MonoAssemblyName *aname, + const char *basedir, + MonoImageOpenStatus *status); +MONO_API MonoAssembly* mono_assembly_load_full (MonoAssemblyName *aname, + const char *basedir, + MonoImageOpenStatus *status, + mono_bool refonly); +MONO_API MonoAssembly* mono_assembly_load_from (MonoImage *image, const char *fname, + MonoImageOpenStatus *status); +MONO_API MonoAssembly* mono_assembly_load_from_full (MonoImage *image, const char *fname, + MonoImageOpenStatus *status, + mono_bool refonly); + +MONO_API MonoAssembly* mono_assembly_load_with_partial_name (const char *name, MonoImageOpenStatus *status); + +MONO_API MonoAssembly* mono_assembly_loaded (MonoAssemblyName *aname); +MONO_API 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 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 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 MonoImage *mono_assembly_get_image (MonoAssembly *assembly); +MONO_API 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 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 void mono_install_assembly_search_hook (MonoAssemblySearchFunc func, void* user_data); +MONO_API void mono_install_assembly_refonly_search_hook (MonoAssemblySearchFunc func, void* user_data); + +MONO_API 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 void +mono_install_assembly_postload_search_hook (MonoAssemblySearchFunc func, void* user_data); + +MONO_API 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 void mono_install_assembly_preload_hook (MonoAssemblyPreLoadFunc func, + void* user_data); +MONO_API void mono_install_assembly_refonly_preload_hook (MonoAssemblyPreLoadFunc func, + void* user_data); + +MONO_API 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 void mono_assembly_name_free (MonoAssemblyName *aname); + +typedef struct { + const char *name; + const unsigned char *data; + const 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 + diff --git a/mta-mono/src/include/mono/metadata/attrdefs.h b/mta-mono/src/include/mono/metadata/attrdefs.h new file mode 100644 index 0000000..8ba0cba --- /dev/null +++ b/mta-mono/src/include/mono/metadata/attrdefs.h @@ -0,0 +1,273 @@ +/* + * attredefs.h: 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 diff --git a/mta-mono/src/include/mono/metadata/blob.h b/mta-mono/src/include/mono/metadata/blob.h new file mode 100644 index 0000000..dcc3c84 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/blob.h @@ -0,0 +1,117 @@ +/* + * blob.h: 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: token */ + MONO_TYPE_BYREF = 0x10, /* arg: token */ + MONO_TYPE_VALUETYPE = 0x11, /* arg: token */ + MONO_TYPE_CLASS = 0x12, /* arg: token */ + MONO_TYPE_VAR = 0x13, /* number */ + MONO_TYPE_ARRAY = 0x14, /* type, rank, boundsCount, bound1, loCount, lo1 */ + MONO_TYPE_GENERICINST= 0x15, /* \x{2026} */ + 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_UNUSED6, + MONO_TABLE_UNUSED7, + 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_ASYNCMETHOD, + MONO_TABLE_CUSTOMDEBUGINFORMATION + +#define MONO_TABLE_LAST MONO_TABLE_CUSTOMDEBUGINFORMATION +#define MONO_TABLE_NUM (MONO_TABLE_LAST + 1) + +} MonoMetaTableEnum; + +#endif + diff --git a/mta-mono/src/include/mono/metadata/class.h b/mta-mono/src/include/mono/metadata/class.h new file mode 100644 index 0000000..d9f3151 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/class.h @@ -0,0 +1,273 @@ +#ifndef _MONO_CLI_CLASS_H_ +#define _MONO_CLI_CLASS_H_ + +#include +#include +#include +#include + +MONO_BEGIN_DECLS + +typedef struct MonoVTable MonoVTable; + +typedef struct _MonoClassField MonoClassField; +typedef struct _MonoProperty MonoProperty; +typedef struct _MonoEvent MonoEvent; + +MONO_API MonoClass * +mono_class_get (MonoImage *image, uint32_t type_token); + +MONO_API MonoClass * +mono_class_get_full (MonoImage *image, uint32_t type_token, MonoGenericContext *context); + +MONO_API mono_bool +mono_class_init (MonoClass *klass); + +MONO_API MonoVTable * +mono_class_vtable (MonoDomain *domain, MonoClass *klass); + +MONO_API MonoClass * +mono_class_from_name (MonoImage *image, const char* name_space, const char *name); + +MONO_API MonoClass * +mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name); + +MONO_API MonoMethod * +mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int param_count, int flags); + +MONO_API 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 MonoClass * +mono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *image, mono_bool is_mvar); + +MONO_API MonoType* +mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context) /* MONO_DEPRECATED */; + +MONO_API MonoMethod* +mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context); + +MONO_API MonoMethod * +mono_get_inflated_method (MonoMethod *method); + +MONO_API MonoClassField* +mono_field_from_token (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context); + +MONO_API MonoClass * +mono_bounded_array_class_get (MonoClass *element_class, uint32_t rank, mono_bool bounded); + +MONO_API MonoClass * +mono_array_class_get (MonoClass *element_class, uint32_t rank); + +MONO_API MonoClass * +mono_ptr_class_get (MonoType *type); + +MONO_API MonoClassField * +mono_class_get_field (MonoClass *klass, uint32_t field_token); + +MONO_API 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 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 MonoClass * +mono_class_from_mono_type (MonoType *type); + +MONO_API mono_bool +mono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc, + mono_bool check_interfaces); + +MONO_API mono_bool +mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass); + +MONO_API void* +mono_ldtoken (MonoImage *image, uint32_t token, MonoClass **retclass, MonoGenericContext *context); + +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 MonoClass* +mono_class_get_element_class (MonoClass *klass); + +MONO_API mono_bool +mono_class_is_valuetype (MonoClass *klass); + +MONO_API mono_bool +mono_class_is_enum (MonoClass *klass); + +MONO_API MonoType* +mono_class_enum_basetype (MonoClass *klass); + +MONO_API 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 const char* +mono_class_get_name (MonoClass *klass); + +MONO_API const char* +mono_class_get_namespace (MonoClass *klass); + +MONO_API 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 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_bool +mono_class_is_delegate (MonoClass* klass); + +MONO_API 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 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_END_DECLS + +#endif /* _MONO_CLI_CLASS_H_ */ diff --git a/mta-mono/src/include/mono/metadata/debug-helpers.h b/mta-mono/src/include/mono/metadata/debug-helpers.h new file mode 100644 index 0000000..09092f9 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/debug-helpers.h @@ -0,0 +1,48 @@ +#ifndef __MONO_DEBUG_HELPERS_H__ +#define __MONO_DEBUG_HELPERS_H__ + +#include + +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_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_field_full_name (MonoClassField *field); + +MONO_END_DECLS + +#endif /* __MONO_DEBUG_HELPERS_H__ */ + diff --git a/mta-mono/src/include/mono/metadata/debug-mono-symfile.h b/mta-mono/src/include/mono/metadata/debug-mono-symfile.h new file mode 100644 index 0000000..6841689 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/debug-mono-symfile.h @@ -0,0 +1,166 @@ +/* + * 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) + */ + +#ifndef __MONO_DEBUG_MONO_SYMFILE_H__ +#define __MONO_DEBUG_MONO_SYMFILE_H__ + +#include +#include +#include +#include + +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]; +}; + +struct _MonoDebugMethodInfo { + MonoMethod *method; + MonoDebugHandle *handle; + uint32_t index; + uint32_t data_offset; + uint32_t lnt_offset; +}; + +typedef struct { + int parent; + int type; + /* IL offsets */ + int start_offset, end_offset; +} MonoDebugCodeBlock; + +typedef struct { + char *name; + int index; + /* Might be null for the main scope */ + MonoDebugCodeBlock *block; +} MonoDebugLocalVar; + +/* + * Information about local variables retrieved from a symbol file. + */ +struct _MonoDebugLocalsInfo { + int num_locals; + MonoDebugLocalVar *locals; + int num_blocks; + MonoDebugCodeBlock *code_blocks; +}; + +struct _MonoDebugLineNumberEntry { + uint32_t il_offset; + uint32_t native_offset; +}; + +/* + * Information about a source file retrieved from a symbol file. + */ +typedef struct { + char *source_file; + /* 16 byte long */ + guint8 *guid, *hash; +} MonoDebugSourceInfo; + +typedef struct { + int il_offset; + int line, column; + int end_line, end_column; +} MonoSymSeqPoint; + +#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); + +gboolean +mono_debug_image_has_debug_info (MonoImage *image); + +MONO_END_DECLS + +#endif /* __MONO_SYMFILE_H__ */ + diff --git a/mta-mono/src/include/mono/metadata/environment.h b/mta-mono/src/include/mono/metadata/environment.h new file mode 100644 index 0000000..360ba3b --- /dev/null +++ b/mta-mono/src/include/mono/metadata/environment.h @@ -0,0 +1,22 @@ +/* + * environment.h: 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_BEGIN_DECLS + +MONO_API extern int32_t mono_environment_exitcode_get (void); +MONO_API extern void mono_environment_exitcode_set (int32_t value); + +MONO_END_DECLS + +#endif /* _MONO_METADATA_ENVIRONMENT_H_ */ diff --git a/mta-mono/src/include/mono/metadata/exception.h b/mta-mono/src/include/mono/metadata/exception.h new file mode 100644 index 0000000..a03bde4 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/exception.h @@ -0,0 +1,147 @@ +#ifndef _MONO_METADATA_EXCEPTION_H_ +#define _MONO_METADATA_EXCEPTION_H_ + +#include +#include + +MONO_BEGIN_DECLS + +extern 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 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 MonoException * +mono_exception_from_token_two_strings (MonoImage *image, uint32_t token, + MonoString *a1, MonoString *a2); + +extern 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 MonoException * +mono_get_exception_thread_state (const char *msg); + +MONO_API 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 MonoException * +mono_get_exception_missing_method (const char *class_name, const char *member_name); + +MONO_API MonoException * +mono_get_exception_missing_field (const char *class_name, const char *member_name); + +MONO_API MonoException * +mono_get_exception_not_implemented (const char *msg); + +MONO_API MonoException * +mono_get_exception_not_supported (const char *msg); + +MONO_API 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 MonoException * +mono_get_exception_io (const char *msg); + +MONO_API MonoException * +mono_get_exception_file_not_found (MonoString *fname); + +MONO_API MonoException * +mono_get_exception_file_not_found2 (const char *msg, MonoString *fname); + +MONO_API MonoException * +mono_get_exception_type_initialization (const char *type_name, MonoException *inner); + +MONO_API 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 MonoException * +mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname); + +MONO_API MonoException * +mono_get_exception_stack_overflow (void); + +MONO_API MonoException * +mono_get_exception_out_of_memory (void); + +MONO_API MonoException * +mono_get_exception_field_access (void); + +MONO_API MonoException * +mono_get_exception_method_access (void); + +MONO_API MonoException * +mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions); + +MONO_API MonoException * +mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception); + +MONO_END_DECLS + +#endif /* _MONO_METADATA_EXCEPTION_H_ */ diff --git a/mta-mono/src/include/mono/metadata/image.h b/mta-mono/src/include/mono/metadata/image.h new file mode 100644 index 0000000..c3ad58b --- /dev/null +++ b/mta-mono/src/include/mono/metadata/image.h @@ -0,0 +1,83 @@ +#ifndef _MONONET_METADATA_IMAGE_H_ +#define _MONONET_METADATA_IMAGE_H_ + +#include +#include + +MONO_BEGIN_DECLS + +typedef struct _MonoImage MonoImage; +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 MonoImage *mono_image_open_full (const char *fname, + MonoImageOpenStatus *status, mono_bool refonly); +MONO_API MonoImage *mono_pe_file_open (const char *fname, + MonoImageOpenStatus *status); +MONO_API MonoImage *mono_image_open_from_data (char *data, uint32_t data_len, mono_bool need_copy, + MonoImageOpenStatus *status); +MONO_API MonoImage *mono_image_open_from_data_full (char *data, uint32_t data_len, mono_bool need_copy, + MonoImageOpenStatus *status, mono_bool refonly); +MONO_API 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 MonoImage *mono_image_loaded (const char *name); +MONO_API MonoImage *mono_image_loaded_full (const char *name, mono_bool refonly); +MONO_API MonoImage *mono_image_loaded_by_guid (const char *guid); +MONO_API 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 MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx); + +MONO_API 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_END_DECLS + +#endif diff --git a/mta-mono/src/include/mono/metadata/loader.h b/mta-mono/src/include/mono/metadata/loader.h new file mode 100644 index 0000000..74d8281 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/loader.h @@ -0,0 +1,100 @@ +#ifndef _MONO_METADATA_LOADER_H_ +#define _MONO_METADATA_LOADER_H_ 1 + +#include +#include + +MONO_BEGIN_DECLS + +typedef mono_bool (*MonoStackWalk) (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data); + +MONO_API MonoMethod * +mono_get_method (MonoImage *image, uint32_t token, MonoClass *klass); + +MONO_API MonoMethod * +mono_get_method_full (MonoImage *image, uint32_t token, MonoClass *klass, + MonoGenericContext *context); + +MONO_API 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 MonoMethodSignature* +mono_method_get_signature_full (MonoMethod *method, MonoImage *image, uint32_t token, + MonoGenericContext *context); + +MONO_API MonoMethodSignature* +mono_method_get_signature (MonoMethod *method, MonoImage *image, uint32_t token); + +MONO_API MonoMethodSignature* +mono_method_signature (MonoMethod *method); + +MONO_API 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 MonoImage * +mono_load_image (const char *fname, MonoImageOpenStatus *status); + +MONO_API void +mono_add_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 void +mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, const char *tdll, const char *tfunc); + +MONO_API 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_END_DECLS + +#endif + diff --git a/mta-mono/src/include/mono/metadata/metadata.h b/mta-mono/src/include/mono/metadata/metadata.h new file mode 100644 index 0000000..0a61a2d --- /dev/null +++ b/mta-mono/src/include/mono/metadata/metadata.h @@ -0,0 +1,503 @@ + +#ifndef __MONO_METADATA_H__ +#define __MONO_METADATA_H__ + +#include + +#include +#include +#include + +MONO_BEGIN_DECLS + +/* + * 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 + +#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) ((c->flags & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR)) + +#define MONO_CLASS_IS_IMPORT(c) ((c->flags & TYPE_ATTRIBUTE_IMPORT)) + +typedef struct _MonoClass MonoClass; +typedef struct _MonoDomain MonoDomain; +typedef struct _MonoMethod MonoMethod; + +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 +} 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, + 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 +} MonoMarshalConv; + +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); + +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 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 _MonoDynamicGenericClass MonoDynamicGenericClass; +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; + +struct _MonoArrayType { + MonoClass *eklass; + uint8_t rank; + 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_bool +mono_type_is_byref (MonoType *type); + +MONO_API int +mono_type_get_type (MonoType *type); + +/* For MONO_TYPE_FNPTR */ +MONO_API MonoMethodSignature* +mono_type_get_signature (MonoType *type); + +/* For MONO_TYPE_CLASS, VALUETYPE */ +MONO_API 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 MonoType* +mono_signature_get_return_type (MonoMethodSignature *sig); + +MONO_API 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 MonoArrayType *mono_metadata_parse_array (MonoImage *m, + const char *ptr, + const char **rptr); +MONO_API void mono_metadata_free_array (MonoArrayType *array); +MONO_API MonoType *mono_metadata_parse_type (MonoImage *m, + MonoParseTypeMode mode, + short opt_attrs, + const char *ptr, + const char **rptr); +MONO_API MonoType *mono_metadata_parse_param (MonoImage *m, + const char *ptr, + const char **rptr); +MONO_API MonoType *mono_metadata_parse_ret_type (MonoImage *m, + const char *ptr, + const char **rptr); +MONO_API MonoType *mono_metadata_parse_field_type (MonoImage *m, + short field_flags, + const char *ptr, + const char **rptr); +MONO_API 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_generic_class_hash (MonoGenericClass *gclass); +MONO_API mono_bool mono_metadata_generic_class_equal (MonoGenericClass *g1, MonoGenericClass *g2); + +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 MonoMethodSignature *mono_metadata_parse_signature (MonoImage *image, + uint32_t token); + +MONO_API 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 MonoMethodHeader *mono_metadata_parse_mh (MonoImage *m, const char *ptr); +MONO_API void mono_metadata_free_mh (MonoMethodHeader *mh); + +/* MonoMethodHeader acccessors */ +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 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__ */ diff --git a/mta-mono/src/include/mono/metadata/mono-config.h b/mta-mono/src/include/mono/metadata/mono-config.h new file mode 100644 index 0000000..4e68b8a --- /dev/null +++ b/mta-mono/src/include/mono/metadata/mono-config.h @@ -0,0 +1,34 @@ +/* + * mono-config.h + * + * Author: Paolo Molaro (lupus@ximian.com) + * + * (C) 2002 Ximian, Inc. + */ +#ifndef __MONO_METADATA_CONFIG_H__ +#define __MONO_METADATA_CONFIG_H__ + +#include +#include + +MONO_BEGIN_DECLS + +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 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__ */ + diff --git a/mta-mono/src/include/mono/metadata/mono-debug.h b/mta-mono/src/include/mono/metadata/mono-debug.h new file mode 100644 index 0000000..c2134bb --- /dev/null +++ b/mta-mono/src/include/mono/metadata/mono-debug.h @@ -0,0 +1,218 @@ +/* + * 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 +#include +#include + +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 _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 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 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); + +/* + * 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__ */ diff --git a/mta-mono/src/include/mono/metadata/mono-gc.h b/mta-mono/src/include/mono/metadata/mono-gc.h new file mode 100644 index 0000000..689cad2 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/mono-gc.h @@ -0,0 +1,27 @@ +/* + * mono-gc.h: GC related public interface + * + */ +#ifndef __METADATA_MONO_GC_H__ +#define __METADATA_MONO_GC_H__ + +#include + +MONO_BEGIN_DECLS + +typedef int (*MonoGCReferences) (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data); + +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 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_END_DECLS + +#endif /* __METADATA_MONO_GC_H__ */ + diff --git a/mta-mono/src/include/mono/metadata/object.h b/mta-mono/src/include/mono/metadata/object.h new file mode 100644 index 0000000..7aef3ad --- /dev/null +++ b/mta-mono/src/include/mono/metadata/object.h @@ -0,0 +1,361 @@ +#ifndef _MONO_CLI_OBJECT_H_ +#define _MONO_CLI_OBJECT_H_ + +#include +#include + +MONO_BEGIN_DECLS + +typedef mono_byte MonoBoolean; + +typedef struct _MonoString MonoString; +typedef struct _MonoArray MonoArray; +typedef struct _MonoReflectionMethod MonoReflectionMethod; +typedef struct _MonoReflectionAssembly MonoReflectionAssembly; +typedef struct _MonoReflectionModule MonoReflectionModule; +typedef struct _MonoReflectionField MonoReflectionField; +typedef struct _MonoReflectionProperty MonoReflectionProperty; +typedef struct _MonoReflectionEvent MonoReflectionEvent; +typedef struct _MonoReflectionType MonoReflectionType; +typedef struct _MonoDelegate MonoDelegate; +typedef struct _MonoException MonoException; +typedef struct _MonoThreadsSync MonoThreadsSync; +typedef struct _MonoThread MonoThread; +typedef struct _MonoDynamicAssembly MonoDynamicAssembly; +typedef struct _MonoDynamicImage MonoDynamicImage; +typedef struct _MonoReflectionMethodBody MonoReflectionMethodBody; +typedef struct _MonoAppContext MonoAppContext; + +typedef struct _MonoObject { + MonoVTable *vtable; + MonoThreadsSync *synchronisation; +} MonoObject; + +typedef MonoObject* (*MonoInvokeFunc) (MonoMethod *method, void *obj, void **params, MonoObject **exc); +typedef void* (*MonoCompileFunc) (MonoMethod *method); +typedef void (*MonoMainThreadFunc) (void* user_data); + +#define MONO_OBJECT_SETREF(obj,fieldname,value) do { \ + g_assert (sizeof((obj)->fieldname) == sizeof (gpointer*)); \ + 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*)(void*) 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_unichar2 *mono_string_chars (MonoString *s); +MONO_API int mono_string_length (MonoString *s); + +MONO_API MonoObject * +mono_object_new (MonoDomain *domain, MonoClass *klass); + +MONO_API MonoObject * +mono_object_new_specific (MonoVTable *vtable); + +/* can be used for classes without finalizer in non-profiling mode */ +MONO_API MonoObject * +mono_object_new_fast (MonoVTable *vtable); + +MONO_API MonoObject * +mono_object_new_alloc_specific (MonoVTable *vtable); + +MONO_API MonoObject * +mono_object_new_from_token (MonoDomain *domain, MonoImage *image, uint32_t token); + +MONO_API MonoArray* +mono_array_new (MonoDomain *domain, MonoClass *eclass, uintptr_t n); + +MONO_API MonoArray* +mono_array_new_full (MonoDomain *domain, MonoClass *array_class, + uintptr_t *lengths, intptr_t *lower_bounds); + +MONO_API MonoArray * +mono_array_new_specific (MonoVTable *vtable, uintptr_t n); + +MONO_API MonoArray* +mono_array_clone (MonoArray *array); + +MONO_API char* +mono_array_addr_with_size (MonoArray *array, int size, uintptr_t idx); + +MONO_API uintptr_t +mono_array_length (MonoArray *array); + +MONO_API MonoString* +mono_string_new_utf16 (MonoDomain *domain, const mono_unichar2 *text, int32_t len); + +MONO_API MonoString* +mono_string_new_size (MonoDomain *domain, int32_t len); + +MONO_API MonoString* +mono_ldstr (MonoDomain *domain, MonoImage *image, uint32_t str_index); + +MONO_API MonoString* +mono_string_is_interned (MonoString *str); + +MONO_API MonoString* +mono_string_intern (MonoString *str); + +MONO_API MonoString* +mono_string_new (MonoDomain *domain, const char *text); + +MONO_API MonoString* +mono_string_new_wrapper (const char *text); + +MONO_API MonoString* +mono_string_new_len (MonoDomain *domain, const char *text, unsigned int length); + +MONO_API MonoString* +mono_string_new_utf32 (MonoDomain *domain, const mono_unichar4 *text, int32_t len); + +MONO_API char * +mono_string_to_utf8 (MonoString *string_obj); + +MONO_API char * +mono_string_to_utf8_checked (MonoString *string_obj, MonoError *error); + +MONO_API mono_unichar2 * +mono_string_to_utf16 (MonoString *string_obj); + +MONO_API mono_unichar4 * +mono_string_to_utf32 (MonoString *string_obj); + +MONO_API MonoString * +mono_string_from_utf16 (mono_unichar2 *data); + +MONO_API MonoString * +mono_string_from_utf32 (mono_unichar4 *data); + +MONO_API mono_bool +mono_string_equal (MonoString *s1, MonoString *s2); + +MONO_API unsigned int +mono_string_hash (MonoString *s); + +MONO_API int +mono_object_hash (MonoObject* obj); + +MONO_API MonoString * +mono_object_to_string (MonoObject *obj, MonoObject **exc); + +MONO_API MonoObject * +mono_value_box (MonoDomain *domain, MonoClass *klass, void* val); + +MONO_API void +mono_value_copy (void* dest, void* src, MonoClass *klass); + +MONO_API void +mono_value_copy_array (MonoArray *dest, int dest_idx, void* src, int count); + +MONO_API MonoDomain* +mono_object_get_domain (MonoObject *obj); + +MONO_API MonoClass* +mono_object_get_class (MonoObject *obj); + +MONO_API void* +mono_object_unbox (MonoObject *obj); + +MONO_API MonoObject * +mono_object_clone (MonoObject *obj); + +MONO_API MonoObject * +mono_object_isinst (MonoObject *obj, MonoClass *klass); + +MONO_API MonoObject * +mono_object_isinst_mbyref (MonoObject *obj, MonoClass *klass); + +MONO_API MonoObject * +mono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass); + +MONO_API mono_bool +mono_monitor_try_enter (MonoObject *obj, uint32_t ms); + +MONO_API mono_bool +mono_monitor_enter (MonoObject *obj); + +MONO_API void +mono_monitor_enter_v4 (MonoObject *obj, char *lock_taken); + +MONO_API unsigned int +mono_object_get_size (MonoObject *o); + +MONO_API void +mono_monitor_exit (MonoObject *obj); + +MONO_API void +mono_raise_exception (MonoException *ex); + +MONO_API void +mono_runtime_object_init (MonoObject *this_obj); + +MONO_API void +mono_runtime_class_init (MonoVTable *vtable); + +MONO_API MonoMethod* +mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method); + +MONO_API MonoObject* +mono_runtime_invoke (MonoMethod *method, void *obj, void **params, + MonoObject **exc); + +MONO_API MonoMethod * +mono_get_delegate_invoke (MonoClass *klass); + +MONO_API MonoMethod * +mono_get_delegate_begin_invoke (MonoClass *klass); + +MONO_API MonoMethod * +mono_get_delegate_end_invoke (MonoClass *klass); + +MONO_API MonoObject* +mono_runtime_delegate_invoke (MonoObject *delegate, void **params, + MonoObject **exc); + +MONO_API MonoObject* +mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params, + MonoObject **exc); + +MONO_API void* +mono_method_get_unmanaged_thunk (MonoMethod *method); + +MONO_API MonoArray* +mono_runtime_get_main_args (void); + +MONO_API void +mono_runtime_exec_managed_code (MonoDomain *domain, + MonoMainThreadFunc main_func, + void* main_args); + +MONO_API int +mono_runtime_run_main (MonoMethod *method, int argc, char* argv[], + MonoObject **exc); + +MONO_API int +mono_runtime_exec_main (MonoMethod *method, MonoArray *args, + MonoObject **exc); + +MONO_API 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 void* +mono_load_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void **res); + +MONO_API MonoObject * +mono_load_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field); + +MONO_API void +mono_store_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void* val); + +MONO_API void +mono_store_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg); + +/* #endif */ + +MONO_API void +mono_unhandled_exception (MonoObject *exc); + +MONO_API void +mono_print_unhandled_exception (MonoObject *exc); + +MONO_API void* +mono_compile_method (MonoMethod *method); + +/* accessors for fields and properties */ +MONO_API void +mono_field_set_value (MonoObject *obj, MonoClassField *field, void *value); + +MONO_API void +mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value); + +MONO_API void +mono_field_get_value (MonoObject *obj, MonoClassField *field, void *value); + +MONO_API void +mono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value); + +MONO_API MonoObject * +mono_field_get_value_object (MonoDomain *domain, MonoClassField *field, MonoObject *obj); + +MONO_API void +mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc); + +MONO_API 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 uint32_t mono_gchandle_new (MonoObject *obj, mono_bool pinned); +MONO_API uint32_t mono_gchandle_new_weakref (MonoObject *obj, mono_bool track_resurrection); +MONO_API MonoObject* mono_gchandle_get_target (uint32_t gchandle); +MONO_API void mono_gchandle_free (uint32_t 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 MonoReferenceQueue* mono_gc_reference_queue_new (mono_reference_queue_callback callback); +MONO_API void mono_gc_reference_queue_free (MonoReferenceQueue *queue); +MONO_API mono_bool mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void *user_data); + + + +/* GC write barriers support */ +MONO_API void mono_gc_wbarrier_set_field (MonoObject *obj, void* field_ptr, MonoObject* value); +MONO_API void mono_gc_wbarrier_set_arrayref (MonoArray *arr, void* slot_ptr, MonoObject* value); +MONO_API void mono_gc_wbarrier_arrayref_copy (void* dest_ptr, void* src_ptr, int count); +MONO_API void mono_gc_wbarrier_generic_store (void* ptr, MonoObject* value); +MONO_API void mono_gc_wbarrier_generic_store_atomic (void *ptr, MonoObject *value); +MONO_API void mono_gc_wbarrier_generic_nostore (void* ptr); +MONO_API void mono_gc_wbarrier_value_copy (void* dest, void* src, int count, MonoClass *klass); +MONO_API void mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src); + +MONO_END_DECLS + +#endif + diff --git a/mta-mono/src/include/mono/metadata/opcodes.h b/mta-mono/src/include/mono/metadata/opcodes.h new file mode 100644 index 0000000..71b4cb4 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/opcodes.h @@ -0,0 +1,76 @@ +#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_BEGIN_DECLS + +#define MONO_CUSTOM_PREFIX 0xf0 + +#define OPDEF(a,b,c,d,e,f,g,h,i,j) \ + MONO_ ## a, + +typedef enum { +#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, + MonoInlineType, + MonoInlineField, + MonoInlineMethod, + MonoInlineTok, + MonoInlineString, + MonoInlineSig, + MonoInlineVar, + MonoShortInlineVar, + MonoInlineBrTarget, + MonoShortInlineBrTarget, + MonoInlineSwitch, + MonoInlineR, + MonoShortInlineR, + MonoInlineI, + MonoShortInlineI, + MonoInlineI8 +}; + +typedef struct { + unsigned char argument; + unsigned char flow_type; + unsigned short opval; +} MonoOpcode; + +extern const MonoOpcode mono_opcodes []; + +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__ */ + diff --git a/mta-mono/src/include/mono/metadata/profiler.h b/mta-mono/src/include/mono/metadata/profiler.h new file mode 100644 index 0000000..17128a1 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/profiler.h @@ -0,0 +1,222 @@ +#ifndef __MONO_PROFILER_H__ +#define __MONO_PROFILER_H__ + +#include +#include + +MONO_BEGIN_DECLS + +#define MONO_PROFILER_MAX_STAT_CALL_CHAIN_DEPTH 128 + +typedef enum { + MONO_PROFILE_NONE = 0, + MONO_PROFILE_APPDOMAIN_EVENTS = 1 << 0, + MONO_PROFILE_ASSEMBLY_EVENTS = 1 << 1, + MONO_PROFILE_MODULE_EVENTS = 1 << 2, + MONO_PROFILE_CLASS_EVENTS = 1 << 3, + MONO_PROFILE_JIT_COMPILATION = 1 << 4, + MONO_PROFILE_INLINING = 1 << 5, + MONO_PROFILE_EXCEPTIONS = 1 << 6, + MONO_PROFILE_ALLOCATIONS = 1 << 7, + MONO_PROFILE_GC = 1 << 8, + MONO_PROFILE_THREADS = 1 << 9, + MONO_PROFILE_REMOTING = 1 << 10, + MONO_PROFILE_TRANSITIONS = 1 << 11, + MONO_PROFILE_ENTER_LEAVE = 1 << 12, + MONO_PROFILE_COVERAGE = 1 << 13, + MONO_PROFILE_INS_COVERAGE = 1 << 14, + MONO_PROFILE_STATISTICAL = 1 << 15, + MONO_PROFILE_METHOD_EVENTS = 1 << 16, + MONO_PROFILE_MONITOR_EVENTS = 1 << 17, + MONO_PROFILE_IOMAP_EVENTS = 1 << 18, /* this should likely be removed, too */ + MONO_PROFILE_GC_MOVES = 1 << 19, + MONO_PROFILE_GC_ROOTS = 1 << 20, + MONO_PROFILE_CONTEXT_EVENTS = 1 << 21 +} MonoProfileFlags; + +typedef enum { + MONO_PROFILE_OK, + MONO_PROFILE_FAILED +} MonoProfileResult; + +typedef enum { + MONO_GC_EVENT_START, + MONO_GC_EVENT_MARK_START, + MONO_GC_EVENT_MARK_END, + MONO_GC_EVENT_RECLAIM_START, + MONO_GC_EVENT_RECLAIM_END, + MONO_GC_EVENT_END, + MONO_GC_EVENT_PRE_STOP_WORLD, + MONO_GC_EVENT_POST_STOP_WORLD, + MONO_GC_EVENT_PRE_START_WORLD, + MONO_GC_EVENT_POST_START_WORLD +} MonoGCEvent; + +/* coverage info */ +typedef struct { + MonoMethod *method; + int iloffset; + int counter; + const char *filename; + int line; + int col; +} MonoProfileCoverageEntry; + +/* executable code buffer info */ +typedef enum { + MONO_PROFILER_CODE_BUFFER_UNKNOWN, + MONO_PROFILER_CODE_BUFFER_METHOD, + MONO_PROFILER_CODE_BUFFER_METHOD_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_UNBOX_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_GENERICS_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_SPECIFIC_TRAMPOLINE, + MONO_PROFILER_CODE_BUFFER_HELPER, + MONO_PROFILER_CODE_BUFFER_MONITOR, + MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE, + MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, + MONO_PROFILER_CODE_BUFFER_LAST +} MonoProfilerCodeBufferType; + +typedef struct _MonoProfiler MonoProfiler; + +typedef enum { + MONO_PROFILER_MONITOR_CONTENTION = 1, + MONO_PROFILER_MONITOR_DONE = 2, + MONO_PROFILER_MONITOR_FAIL = 3 +} MonoProfilerMonitorEvent; + +typedef enum { + MONO_PROFILER_CALL_CHAIN_NONE = 0, + MONO_PROFILER_CALL_CHAIN_NATIVE = 1, + MONO_PROFILER_CALL_CHAIN_GLIBC = 2, + MONO_PROFILER_CALL_CHAIN_MANAGED = 3, + MONO_PROFILER_CALL_CHAIN_INVALID = 4 +} MonoProfilerCallChainStrategy; + +typedef enum { + MONO_PROFILER_GC_HANDLE_CREATED, + MONO_PROFILER_GC_HANDLE_DESTROYED +} MonoProfileGCHandleEvent; + +typedef enum { + MONO_PROFILE_GC_ROOT_PINNING = 1 << 8, + MONO_PROFILE_GC_ROOT_WEAKREF = 2 << 8, + MONO_PROFILE_GC_ROOT_INTERIOR = 4 << 8, + /* the above are flags, the type is in the low 2 bytes */ + MONO_PROFILE_GC_ROOT_STACK = 0, + MONO_PROFILE_GC_ROOT_FINALIZER = 1, + MONO_PROFILE_GC_ROOT_HANDLE = 2, + MONO_PROFILE_GC_ROOT_OTHER = 3, + MONO_PROFILE_GC_ROOT_MISC = 4, /* could be stack, handle, etc. */ + MONO_PROFILE_GC_ROOT_TYPEMASK = 0xff +} MonoProfileGCRootType; + +/* + * Functions that the runtime will call on the profiler. + */ + +typedef void (*MonoProfileFunc) (MonoProfiler *prof); + +typedef void (*MonoProfileAppDomainFunc) (MonoProfiler *prof, MonoDomain *domain); +typedef void (*MonoProfileContextFunc) (MonoProfiler *prof, MonoAppContext *context); +typedef void (*MonoProfileMethodFunc) (MonoProfiler *prof, MonoMethod *method); +typedef void (*MonoProfileClassFunc) (MonoProfiler *prof, MonoClass *klass); +typedef void (*MonoProfileModuleFunc) (MonoProfiler *prof, MonoImage *module); +typedef void (*MonoProfileAssemblyFunc) (MonoProfiler *prof, MonoAssembly *assembly); +typedef void (*MonoProfileMonitorFunc) (MonoProfiler *prof, MonoObject *obj, MonoProfilerMonitorEvent event); + +typedef void (*MonoProfileExceptionFunc) (MonoProfiler *prof, MonoObject *object); +typedef void (*MonoProfileExceptionClauseFunc) (MonoProfiler *prof, MonoMethod *method, int clause_type, int clause_num); + +typedef void (*MonoProfileAppDomainResult)(MonoProfiler *prof, MonoDomain *domain, int result); +typedef void (*MonoProfileAppDomainFriendlyNameFunc) (MonoProfiler *prof, MonoDomain *domain, const char *name); +typedef void (*MonoProfileMethodResult) (MonoProfiler *prof, MonoMethod *method, int result); +typedef void (*MonoProfileJitResult) (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo, int result); +typedef void (*MonoProfileClassResult) (MonoProfiler *prof, MonoClass *klass, int result); +typedef void (*MonoProfileModuleResult) (MonoProfiler *prof, MonoImage *module, int result); +typedef void (*MonoProfileAssemblyResult) (MonoProfiler *prof, MonoAssembly *assembly, int result); + +typedef void (*MonoProfileMethodInline) (MonoProfiler *prof, MonoMethod *parent, MonoMethod *child, int *ok); + +typedef void (*MonoProfileThreadFunc) (MonoProfiler *prof, uintptr_t tid); +typedef void (*MonoProfileThreadNameFunc) (MonoProfiler *prof, uintptr_t tid, const char *name); +typedef void (*MonoProfileAllocFunc) (MonoProfiler *prof, MonoObject *obj, MonoClass *klass); +typedef void (*MonoProfileStatFunc) (MonoProfiler *prof, mono_byte *ip, void *context); +typedef void (*MonoProfileStatCallChainFunc) (MonoProfiler *prof, int call_chain_depth, mono_byte **ip, void *context); +typedef void (*MonoProfileGCFunc) (MonoProfiler *prof, MonoGCEvent event, int generation); +typedef void (*MonoProfileGCMoveFunc) (MonoProfiler *prof, void **objects, int num); +typedef void (*MonoProfileGCResizeFunc) (MonoProfiler *prof, int64_t new_size); +typedef void (*MonoProfileGCHandleFunc) (MonoProfiler *prof, int op, int type, uintptr_t handle, MonoObject *obj); +typedef void (*MonoProfileGCRootFunc) (MonoProfiler *prof, int num_roots, void **objects, int *root_types, uintptr_t *extra_info); + +typedef void (*MonoProfileIomapFunc) (MonoProfiler *prof, const char *report, const char *pathname, const char *new_pathname); + +typedef mono_bool (*MonoProfileCoverageFilterFunc) (MonoProfiler *prof, MonoMethod *method); + +typedef void (*MonoProfileCoverageFunc) (MonoProfiler *prof, const MonoProfileCoverageEntry *entry); + +typedef void (*MonoProfilerCodeChunkNew) (MonoProfiler *prof, void* chunk, int size); +typedef void (*MonoProfilerCodeChunkDestroy) (MonoProfiler *prof, void* chunk); +typedef void (*MonoProfilerCodeBufferNew) (MonoProfiler *prof, void* buffer, int size, MonoProfilerCodeBufferType type, void *data); + +/* + * Function the profiler may call. + */ +MONO_API void mono_profiler_install (MonoProfiler *prof, MonoProfileFunc shutdown_callback); +MONO_API void mono_profiler_set_events (MonoProfileFlags events); + +MONO_API MonoProfileFlags mono_profiler_get_events (void); + +MONO_API void mono_profiler_install_appdomain (MonoProfileAppDomainFunc start_load, MonoProfileAppDomainResult end_load, + MonoProfileAppDomainFunc start_unload, MonoProfileAppDomainFunc end_unload); +MONO_API void mono_profiler_install_appdomain_name (MonoProfileAppDomainFriendlyNameFunc domain_name_cb); +MONO_API void mono_profiler_install_context (MonoProfileContextFunc load, MonoProfileContextFunc unload); +MONO_API void mono_profiler_install_assembly (MonoProfileAssemblyFunc start_load, MonoProfileAssemblyResult end_load, + MonoProfileAssemblyFunc start_unload, MonoProfileAssemblyFunc end_unload); +MONO_API void mono_profiler_install_module (MonoProfileModuleFunc start_load, MonoProfileModuleResult end_load, + MonoProfileModuleFunc start_unload, MonoProfileModuleFunc end_unload); +MONO_API void mono_profiler_install_class (MonoProfileClassFunc start_load, MonoProfileClassResult end_load, + MonoProfileClassFunc start_unload, MonoProfileClassFunc end_unload); + +MONO_API void mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end); +MONO_API void mono_profiler_install_jit_end (MonoProfileJitResult end); +MONO_API void mono_profiler_install_method_free (MonoProfileMethodFunc callback); +MONO_API void mono_profiler_install_method_invoke (MonoProfileMethodFunc start, MonoProfileMethodFunc end); +MONO_API void mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc fleave); +MONO_API void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end); +MONO_API void mono_profiler_install_thread_name (MonoProfileThreadNameFunc thread_name_cb); +MONO_API void mono_profiler_install_transition (MonoProfileMethodResult callback); +MONO_API void mono_profiler_install_allocation (MonoProfileAllocFunc callback); +MONO_API void mono_profiler_install_monitor (MonoProfileMonitorFunc callback); +MONO_API void mono_profiler_install_statistical (MonoProfileStatFunc callback); +MONO_API void mono_profiler_install_statistical_call_chain (MonoProfileStatCallChainFunc callback, int call_chain_depth, MonoProfilerCallChainStrategy call_chain_strategy); +MONO_API void mono_profiler_install_exception (MonoProfileExceptionFunc throw_callback, MonoProfileMethodFunc exc_method_leave, MonoProfileExceptionClauseFunc clause_callback); +MONO_API void mono_profiler_install_coverage_filter (MonoProfileCoverageFilterFunc callback); +MONO_API void mono_profiler_coverage_get (MonoProfiler *prof, MonoMethod *method, MonoProfileCoverageFunc func); +MONO_API void mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback); +MONO_API void mono_profiler_install_gc_moves (MonoProfileGCMoveFunc callback); +MONO_API void mono_profiler_install_gc_roots (MonoProfileGCHandleFunc handle_callback, MonoProfileGCRootFunc roots_callback); +MONO_API void mono_profiler_install_runtime_initialized (MonoProfileFunc runtime_initialized_callback); + +MONO_API void mono_profiler_install_code_chunk_new (MonoProfilerCodeChunkNew callback); +MONO_API void mono_profiler_install_code_chunk_destroy (MonoProfilerCodeChunkDestroy callback); +MONO_API void mono_profiler_install_code_buffer_new (MonoProfilerCodeBufferNew callback); + +MONO_API void mono_profiler_install_iomap (MonoProfileIomapFunc callback); + +MONO_API void mono_profiler_load (const char *desc); + +typedef enum { + /* Elapsed time is tracked by user+kernel time of the process - this is the default*/ + MONO_PROFILER_STAT_MODE_PROCESS = 0, + /* Elapsed time is tracked by wallclock time */ + MONO_PROFILER_STAT_MODE_REAL = 1, +} MonoProfileSamplingMode; + +MONO_API void mono_profiler_set_statistical_mode (MonoProfileSamplingMode mode, int64_t sampling_frequency_is_us); + +MONO_END_DECLS + +#endif /* __MONO_PROFILER_H__ */ + diff --git a/mta-mono/src/include/mono/metadata/reflection.h b/mta-mono/src/include/mono/metadata/reflection.h new file mode 100644 index 0000000..a080809 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/reflection.h @@ -0,0 +1,141 @@ +#ifndef __METADATA_REFLECTION_H__ +#define __METADATA_REFLECTION_H__ + +#include + +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 int mono_reflection_parse_type (char *name, MonoTypeNameParse *info); +MONO_API 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 MonoType* mono_reflection_type_from_name (char *name, MonoImage *image); +MONO_API uint32_t mono_reflection_get_token (MonoObject *obj); + +MONO_API MonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly); +MONO_API MonoReflectionModule* mono_module_get_object (MonoDomain *domain, MonoImage *image); +MONO_API MonoReflectionModule* mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index); +MONO_API MonoReflectionType* mono_type_get_object (MonoDomain *domain, MonoType *type); +MONO_API MonoReflectionMethod* mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass); +MONO_API MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field); +MONO_API MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property); +MONO_API 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 MonoArray* mono_param_get_objects (MonoDomain *domain, MonoMethod *method); +MONO_API 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 MonoArray* mono_reflection_get_custom_attrs_data (MonoObject *obj); +MONO_API MonoArray* mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues); + +MONO_API MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj); +MONO_API MonoArray* mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo); +MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_index (MonoImage *image, uint32_t idx); +MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_method (MonoMethod *method); +MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_class (MonoClass *klass); +MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_assembly (MonoAssembly *assembly); +MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property); +MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event); +MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field); +MONO_API 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 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 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__ */ diff --git a/mta-mono/src/include/mono/metadata/row-indexes.h b/mta-mono/src/include/mono/metadata/row-indexes.h new file mode 100644 index 0000000..ccca123 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/row-indexes.h @@ -0,0 +1,480 @@ + +#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_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_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 +}; + +/* + * 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_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__ */ + + diff --git a/mta-mono/src/include/mono/metadata/sgen-bridge.h b/mta-mono/src/include/mono/metadata/sgen-bridge.h new file mode 100644 index 0000000..2a658f7 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/sgen-bridge.h @@ -0,0 +1,70 @@ +/* + * Copyright 2011 Novell, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _MONO_SGEN_BRIDGE_H_ +#define _MONO_SGEN_BRIDGE_H_ + +#include + +MONO_BEGIN_DECLS + +enum { + SGEN_BRIDGE_VERSION = 4 +}; + +typedef enum { + /* Instances of this class should be scanned when computing the transitive dependency among bridges. E.g. List*/ + 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; + MonoGCBridgeObjectKind (*bridge_class_kind) (MonoClass *klass); + mono_bool (*is_bridge_object) (MonoObject *object); + void (*cross_references) (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, MonoGCBridgeXRef *xrefs); +} MonoGCBridgeCallbacks; + +MONO_API void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks); + +MONO_API void mono_gc_wait_for_bridge_processing (void); + +MONO_END_DECLS + +#endif diff --git a/mta-mono/src/include/mono/metadata/threads.h b/mta-mono/src/include/mono/metadata/threads.h new file mode 100644 index 0000000..79b5b36 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/threads.h @@ -0,0 +1,55 @@ +/* + * threads.h: 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 +#include +#include + +MONO_BEGIN_DECLS + +/* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */ +typedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread); + +extern MONO_API void mono_thread_init (MonoThreadStartCB start_cb, + MonoThreadAttachCB attach_cb); +extern MONO_API void mono_thread_cleanup (void); +extern MONO_API void mono_thread_manage(void); + +extern MONO_API MonoThread *mono_thread_current (void); + +extern MONO_API void mono_thread_set_main (MonoThread *thread); +extern MONO_API MonoThread *mono_thread_get_main (void); + +extern MONO_API void mono_thread_stop (MonoThread *thread); + +extern MONO_API void mono_thread_new_init (intptr_t tid, void* stack_start, + void* func); +extern MONO_API void mono_thread_create (MonoDomain *domain, void* func, void* arg); +extern MONO_API MonoThread *mono_thread_attach (MonoDomain *domain); +extern MONO_API void mono_thread_detach (MonoThread *thread); +extern MONO_API void mono_thread_exit (void); + +MONO_API void mono_thread_set_manage_callback (MonoThread *thread, MonoThreadManageCallback func); + +extern MONO_API void mono_threads_set_default_stacksize (uint32_t stacksize); +extern 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); + +extern MONO_API void mono_thread_detach_if_exiting (void); + +MONO_END_DECLS + +#endif /* _MONO_METADATA_THREADS_H_ */ diff --git a/mta-mono/src/include/mono/metadata/tokentype.h b/mta-mono/src/include/mono/metadata/tokentype.h new file mode 100644 index 0000000..be8904c --- /dev/null +++ b/mta-mono/src/include/mono/metadata/tokentype.h @@ -0,0 +1,41 @@ +#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_ */ diff --git a/mta-mono/src/include/mono/metadata/verify.h b/mta-mono/src/include/mono/metadata/verify.h new file mode 100644 index 0000000..75f52c6 --- /dev/null +++ b/mta-mono/src/include/mono/metadata/verify.h @@ -0,0 +1,62 @@ +#ifndef __MONO_METADATA_VERIFY_H__ +#define __MONO_METADATA_VERIFY_H__ + +#include +#include +#include +#include /* 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__ */ + diff --git a/mta-mono/src/include/mono/utils/mono-counters.h b/mta-mono/src/include/mono/utils/mono-counters.h new file mode 100644 index 0000000..a8e6928 --- /dev/null +++ b/mta-mono/src/include/mono/utils/mono-counters.h @@ -0,0 +1,98 @@ +#ifndef __MONO_COUNTERS_H__ +#define __MONO_COUNTERS_H__ + +#include +#include + +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_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__ */ + diff --git a/mta-mono/src/include/mono/utils/mono-dl-fallback.h b/mta-mono/src/include/mono/utils/mono-dl-fallback.h new file mode 100644 index 0000000..97b13c6 --- /dev/null +++ b/mta-mono/src/include/mono/utils/mono-dl-fallback.h @@ -0,0 +1,34 @@ +#ifndef __MONO_UTILS_DL_FALLBACK_H__ +#define __MONO_UTILS_DL_FALLBACK_H__ + +#include + +MONO_BEGIN_DECLS + +enum { + MONO_DL_LAZY = 1, + MONO_DL_LOCAL = 2, + MONO_DL_MASK = 3 +}; + +/* + * 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__ */ + diff --git a/mta-mono/src/include/mono/utils/mono-error.h b/mta-mono/src/include/mono/utils/mono-error.h new file mode 100644 index 0000000..1da46d6 --- /dev/null +++ b/mta-mono/src/include/mono/utils/mono-error.h @@ -0,0 +1,66 @@ +#ifndef __MONO_ERROR_H__ +#define __MONO_ERROR_H__ + +#include + +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 +}; + +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_NOT_VERIFIABLE = 8, + /* + * 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 +}; + +/*Keep in sync with MonoErrorInternal*/ +typedef struct _MonoError { + unsigned short error_code; + unsigned short hidden_0; /*DON'T TOUCH */ + + void *hidden_1 [12]; /*DON'T TOUCH */ + char hidden_2 [128]; /*DON'T TOUCH */ +} MonoError; + +MONO_BEGIN_DECLS + +MONO_API 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_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 diff --git a/mta-mono/src/include/mono/utils/mono-logger.h b/mta-mono/src/include/mono/utils/mono-logger.h new file mode 100644 index 0000000..36f7714 --- /dev/null +++ b/mta-mono/src/include/mono/utils/mono-logger.h @@ -0,0 +1,28 @@ +#ifndef __MONO_LOGGER_H__ +#define __MONO_LOGGER_H__ + +#include +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 (*MonoLogCallback) (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data); +typedef void (*MonoPrintCallback) (const char *string, mono_bool is_stdout); + +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__ */ diff --git a/mta-mono/src/include/mono/utils/mono-publib.h b/mta-mono/src/include/mono/utils/mono-publib.h new file mode 100644 index 0000000..c9becb2 --- /dev/null +++ b/mta-mono/src/include/mono/utils/mono-publib.h @@ -0,0 +1,79 @@ +#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 +#define MONO_END_DECLS +#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 + +#endif + +#define MONO_API_EXPORT __declspec(dllexport) +#define MONO_API_IMPORT __declspec(dllimport) + +#else + +#include + +#ifdef __GNUC__ +#define MONO_API_EXPORT __attribute__ ((visibility ("default"))) +#else +#define MONO_API_EXPORT +#endif +#define MONO_API_IMPORT + +#endif /* end of compiler-specific stuff */ + +#if defined(MONO_DLL_EXPORT) + #define MONO_API MONO_API_EXPORT +#elif defined(MONO_DLL_IMPORT) + #define MONO_API MONO_API_IMPORT +#else + #define MONO_API +#endif + +typedef int32_t mono_bool; +typedef uint8_t mono_byte; +typedef uint16_t mono_unichar2; +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_CONST_RETURN const + +MONO_END_DECLS + +#endif /* __MONO_PUBLIB_H__ */ +