jit.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /**
  2. * \file
  3. * Author:
  4. * Dietmar Maurer (dietmar@ximian.com)
  5. *
  6. * (C) 2001, 2002, 2003 Ximian, Inc.
  7. */
  8. #ifndef _MONO_JIT_JIT_H_
  9. #define _MONO_JIT_JIT_H_
  10. #include <mono/metadata/appdomain.h>
  11. MONO_BEGIN_DECLS
  12. MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain *
  13. mono_jit_init (const char *file);
  14. MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain *
  15. mono_jit_init_version (const char *root_domain_name, const char *runtime_version);
  16. MONO_API MonoDomain *
  17. mono_jit_init_version_for_test_only (const char *root_domain_name, const char *runtime_version);
  18. MONO_API int
  19. mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly,
  20. int argc, char *argv[]);
  21. MONO_API void
  22. mono_jit_cleanup (MonoDomain *domain);
  23. MONO_API mono_bool
  24. mono_jit_set_trace_options (const char* options);
  25. MONO_API void
  26. mono_set_signal_chaining (mono_bool chain_signals);
  27. MONO_API void
  28. mono_set_crash_chaining (mono_bool chain_signals);
  29. /**
  30. * This function is deprecated, use mono_jit_set_aot_mode instead.
  31. */
  32. MONO_API void
  33. mono_jit_set_aot_only (mono_bool aot_only);
  34. /**
  35. * Allows control over our AOT (Ahead-of-time) compilation mode.
  36. */
  37. typedef enum {
  38. /* Disables AOT mode */
  39. MONO_AOT_MODE_NONE,
  40. /* Enables normal AOT mode, equivalent to mono_jit_set_aot_only (false) */
  41. MONO_AOT_MODE_NORMAL,
  42. /* Enables hybrid AOT mode, JIT can still be used for wrappers */
  43. MONO_AOT_MODE_HYBRID,
  44. /* Enables full AOT mode, JIT is disabled and not allowed,
  45. * equivalent to mono_jit_set_aot_only (true) */
  46. MONO_AOT_MODE_FULL,
  47. /* Same as full, but use only llvm compiled code */
  48. MONO_AOT_MODE_LLVMONLY,
  49. /* Uses Interpreter, JIT is disabled and not allowed,
  50. * equivalent to "--full-aot --interpreter" */
  51. MONO_AOT_MODE_INTERP,
  52. /* Same as INTERP, but use only llvm compiled code */
  53. MONO_AOT_MODE_INTERP_LLVMONLY,
  54. /* Use only llvm compiled code, fall back to the interpeter */
  55. MONO_AOT_MODE_LLVMONLY_INTERP,
  56. /* Sentinel value used internally by the runtime. We use a large number to avoid clashing with some internal values. */
  57. MONO_AOT_MODE_LAST = 1000,
  58. } MonoAotMode;
  59. MONO_API void
  60. mono_jit_set_aot_mode (MonoAotMode mode);
  61. /*
  62. * Returns whether the runtime was invoked for the purpose of AOT-compiling an
  63. * assembly, i.e. no managed code will run.
  64. */
  65. MONO_API mono_bool
  66. mono_jit_aot_compiling (void);
  67. /* Allow embedders to decide wherther to actually obey breakpoint instructions
  68. * in specific methods (works for both break IL instructions and Debugger.Break ()
  69. * method calls).
  70. */
  71. typedef enum {
  72. /* the default is to always obey the breakpoint */
  73. MONO_BREAK_POLICY_ALWAYS,
  74. /* a nop is inserted instead of a breakpoint */
  75. MONO_BREAK_POLICY_NEVER,
  76. /* the breakpoint is executed only if the program has ben started under
  77. * the debugger (that is if a debugger was attached at the time the method
  78. * was compiled).
  79. */
  80. MONO_BREAK_POLICY_ON_DBG
  81. } MonoBreakPolicy;
  82. typedef MonoBreakPolicy (*MonoBreakPolicyFunc) (MonoMethod *method);
  83. MONO_API void mono_set_break_policy (MonoBreakPolicyFunc policy_callback);
  84. MONO_API void
  85. mono_jit_parse_options (int argc, char * argv[]);
  86. MONO_API char* mono_get_runtime_build_info (void);
  87. MONO_API MONO_RT_EXTERNAL_ONLY void
  88. mono_set_use_llvm (mono_bool use_llvm);
  89. MONO_API MONO_RT_EXTERNAL_ONLY void
  90. mono_aot_register_module (void **aot_info);
  91. MONO_API MONO_RT_EXTERNAL_ONLY
  92. MonoDomain* mono_jit_thread_attach (MonoDomain *domain);
  93. MONO_END_DECLS
  94. #endif