egra: agg will respect clip rect now
[iv.d.git] / libjit / package.d
blob871826dd454d503f37e162c29fa7d1d46f67b2ae
1 /*
2 * jit.h - General definitions for JIT back-ends.
4 * Copyright (C) 2004 Southern Storm Software, Pty Ltd.
5 * Copyright (C) 2016 Ketmar Dark
7 * The libjit library is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation, either version 2.1 of
10 * the License, or (at your option) any later version.
12 * The libjit library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with the libjit library. If not, see
19 * <http://www.gnu.org/licenses/>.
21 module iv.libjit /*is aliced*/;
22 pragma(lib, "jit");
23 import iv.alice;
24 extern(C) /*nothrow*/ /*@nogc*/:
25 // "@nogc" removed due to callbacks -- there's no reason to forbid GC usage there
28 alias jit_sbyte = byte;
29 alias jit_ubyte = ubyte;
30 alias jit_short = short;
31 alias jit_ushort = ushort;
32 alias jit_int = int;
33 alias jit_uint = uint;
34 static if ((void*).sizeof == 4) {
35 alias jit_nint = int; // "native"
36 alias jit_nuint = uint; // "native"
37 } else {
38 alias jit_nint = long; // "native"
39 alias jit_nuint = ulong; // "native"
41 alias jit_long = long;
42 alias jit_ulong = ulong;
43 alias jit_float32 = float;
44 alias jit_float64 = double;
45 alias jit_nfloat = real/*long double*/; //k8: seems to be the same for x86
46 alias jit_ptr = void*;
48 static if ((void*).sizeof == 4) {
49 enum JIT_NATIVE_INT32 = true;
50 } else {
51 static assert((void*).sizeof == 8, "wtf?!");
52 enum JIT_NATIVE_INT32 = false;
57 #if defined(__cplusplus) && defined(__GNUC__)
58 #define JIT_NOTHROW throw()
59 #else
60 #define JIT_NOTHROW
61 #endif
64 enum jit_min_int = ((cast(jit_int)1) << (jit_int.sizeof * 8 - 1));
65 enum jit_max_int = (cast(jit_int)(~jit_min_int));
66 enum jit_max_uint = (cast(jit_uint)(~(cast(jit_uint)0)));
67 enum jit_min_long = ((cast(jit_long)1) << (jit_long.sizeof * 8 - 1));
68 enum jit_max_long = (cast(jit_long)(~jit_min_long));
69 enum jit_max_ulong = (cast(jit_ulong)(~(cast(jit_ulong)0)));
72 * Opaque structure that represents a context.
74 struct _jit_context {}
75 alias jit_context_t = _jit_context*;
78 * Opaque structure that represents a function.
80 struct _jit_function {}
81 alias jit_function_t = _jit_function*;
84 * Opaque structure that represents a block.
86 struct _jit_block {}
87 alias jit_block_t = _jit_block*;
90 * Opaque structure that represents an instruction.
92 struct _jit_insn {}
93 alias jit_insn_t = _jit_insn*;
96 * Opaque structure that represents a value.
98 struct _jit_value {}
99 alias jit_value_t = _jit_value*;
102 * Opaque structure that represents a type descriptor.
104 struct _jit_type {}
105 alias jit_type_t = _jit_type*;
108 * Opaque type that represents an exception stack trace.
110 struct jit_stack_trace {}
111 alias jit_stack_trace_t = jit_stack_trace*;
114 * Block label identifier.
116 alias jit_label_t = jit_nuint;
119 * Value that represents an undefined label.
121 enum jit_label_undefined = (cast(jit_label_t)~(cast(jit_uint)0));
124 * Value that represents an undefined offset.
126 enum JIT_NO_OFFSET = (~(cast(uint)0));
129 * Function that is used to free user-supplied metadata.
131 alias jit_meta_free_func = void function (void* data) nothrow;
134 * Function that is used to compile a function on demand.
135 * Returns zero if the compilation process failed for some reason.
137 alias jit_on_demand_func = int function (jit_function_t func) nothrow;
140 * Function that is used to control on demand compilation.
141 * Typically, it should take care of the context locking and unlocking,
142 * calling function's on demand compiler, and final compilation.
144 alias jit_on_demand_driver_func = void* function (jit_function_t func) nothrow;
147 jit_context_t jit_context_create () nothrow @nogc;
148 void jit_context_destroy (jit_context_t context) nothrow @nogc;
150 void jit_context_build_start (jit_context_t context) nothrow @nogc;
151 void jit_context_build_end (jit_context_t context) nothrow @nogc;
153 void jit_context_set_on_demand_driver (jit_context_t context, jit_on_demand_driver_func driver) nothrow @nogc;
155 void jit_context_set_memory_manager (jit_context_t context, jit_memory_manager_t manager) nothrow @nogc;
157 int jit_context_set_meta (jit_context_t context, int type, void* data, jit_meta_free_func free_data) nothrow @nogc;
158 int jit_context_set_meta_numeric (jit_context_t context, int type, jit_nuint data) nothrow @nogc;
159 void* jit_context_get_meta (jit_context_t context, int type) nothrow @nogc;
160 jit_nuint jit_context_get_meta_numeric (jit_context_t context, int type) nothrow @nogc;
161 void jit_context_free_meta (jit_context_t context, int type) nothrow @nogc;
164 * Standard meta values for builtin configurable options.
166 enum JIT_OPTION_CACHE_LIMIT = 10000;
167 enum JIT_OPTION_CACHE_PAGE_SIZE = 10001;
168 enum JIT_OPTION_PRE_COMPILE = 10002;
169 enum JIT_OPTION_DONT_FOLD = 10003;
170 enum JIT_OPTION_POSITION_INDEPENDENT = 10004;
171 enum JIT_OPTION_CACHE_MAX_PAGE_FACTOR = 10005;
175 * Prototype for closure functions.
177 alias jit_closure_func = void function (jit_type_t signature, void* result, void** args, void* user_data) nothrow;
180 * Opaque type for accessing vararg parameters on closures.
182 struct jit_closure_va_list {}
183 alias jit_closure_va_list_t = jit_closure_va_list*;
186 * External function declarations.
188 void jit_apply (jit_type_t signature, void* func, void** args, uint num_fixed_args, void* return_value) nothrow;
189 void jit_apply_raw (jit_type_t signature, void* func, void* args, void* return_value) nothrow;
190 int jit_raw_supported (jit_type_t signature) nothrow @nogc;
192 void* jit_closure_create (jit_context_t context, jit_type_t signature, jit_closure_func func, void* user_data) nothrow @nogc;
194 jit_nint jit_closure_va_get_nint (jit_closure_va_list_t va) nothrow @nogc;
195 jit_nuint jit_closure_va_get_nuint (jit_closure_va_list_t va) nothrow @nogc;
196 jit_long jit_closure_va_get_long (jit_closure_va_list_t va) nothrow @nogc;
197 jit_ulong jit_closure_va_get_ulong (jit_closure_va_list_t va) nothrow @nogc;
198 jit_float32 jit_closure_va_get_float32 (jit_closure_va_list_t va) nothrow @nogc;
199 jit_float64 jit_closure_va_get_float64 (jit_closure_va_list_t va) nothrow @nogc;
200 jit_nfloat jit_closure_va_get_nfloat (jit_closure_va_list_t va) nothrow @nogc;
201 void* jit_closure_va_get_ptr (jit_closure_va_list_t va) nothrow @nogc;
202 void jit_closure_va_get_struct (jit_closure_va_list_t va, void* buf, jit_type_t type) nothrow @nogc;
204 jit_function_t jit_block_get_function (jit_block_t block) nothrow @nogc;
205 jit_context_t jit_block_get_context (jit_block_t block) nothrow @nogc;
206 jit_label_t jit_block_get_label (jit_block_t block) nothrow @nogc;
207 jit_label_t jit_block_get_next_label (jit_block_t block, jit_label_t label) nothrow @nogc;
208 jit_block_t jit_block_next (jit_function_t func, jit_block_t previous) nothrow @nogc;
209 jit_block_t jit_block_previous (jit_function_t func, jit_block_t previous) nothrow @nogc;
210 jit_block_t jit_block_from_label (jit_function_t func, jit_label_t label) nothrow @nogc;
211 int jit_block_set_meta (jit_block_t block, int type, void* data, jit_meta_free_func free_data) nothrow @nogc;
212 void* jit_block_get_meta (jit_block_t block, int type) nothrow @nogc;
213 void jit_block_free_meta (jit_block_t block, int type) nothrow @nogc;
214 int jit_block_is_reachable (jit_block_t block) nothrow @nogc;
215 int jit_block_ends_in_dead (jit_block_t block) nothrow @nogc;
216 int jit_block_current_is_dead (jit_function_t func) nothrow @nogc;
218 struct jit_debugger {}
219 alias jit_debugger_t = jit_debugger*;
220 alias jit_debugger_thread_id_t = jit_nint;
221 alias jit_debugger_breakpoint_id_t = jit_nint;
223 struct jit_debugger_event {
224 int type;
225 jit_debugger_thread_id_t thread;
226 jit_function_t function_;
227 jit_nint data1;
228 jit_nint data2;
229 jit_debugger_breakpoint_id_t id;
230 jit_stack_trace_t trace;
232 alias jit_debugger_event_t = jit_debugger_event;
234 enum JIT_DEBUGGER_TYPE_QUIT = 0;
235 enum JIT_DEBUGGER_TYPE_HARD_BREAKPOINT = 1;
236 enum JIT_DEBUGGER_TYPE_SOFT_BREAKPOINT = 2;
237 enum JIT_DEBUGGER_TYPE_USER_BREAKPOINT = 3;
238 enum JIT_DEBUGGER_TYPE_ATTACH_THREAD = 4;
239 enum JIT_DEBUGGER_TYPE_DETACH_THREAD = 5;
241 struct jit_debugger_breakpoint_info {
242 int flags;
243 jit_debugger_thread_id_t thread;
244 jit_function_t function_;
245 jit_nint data1;
246 jit_nint data2;
248 alias jit_debugger_breakpoint_info_t = jit_debugger_breakpoint_info*;
250 enum JIT_DEBUGGER_FLAG_THREAD = (1 << 0);
251 enum JIT_DEBUGGER_FLAG_FUNCTION = (1 << 1);
252 enum JIT_DEBUGGER_FLAG_DATA1 = (1 << 2);
253 enum JIT_DEBUGGER_FLAG_DATA2 = (1 << 3);
255 enum JIT_DEBUGGER_DATA1_FIRST = 10000;
256 enum JIT_DEBUGGER_DATA1_LINE = 10000;
257 enum JIT_DEBUGGER_DATA1_ENTER = 10001;
258 enum JIT_DEBUGGER_DATA1_LEAVE = 10002;
259 enum JIT_DEBUGGER_DATA1_THROW = 10003;
261 alias jit_debugger_hook_func = void function (jit_function_t func, jit_nint data1, jit_nint data2) nothrow;
263 int jit_debugging_possible () nothrow @nogc;
265 jit_debugger_t jit_debugger_create (jit_context_t context) nothrow @nogc;
266 void jit_debugger_destroy (jit_debugger_t dbg) nothrow @nogc;
268 jit_context_t jit_debugger_get_context (jit_debugger_t dbg) nothrow @nogc;
269 jit_debugger_t jit_debugger_from_context (jit_context_t context) nothrow @nogc;
271 jit_debugger_thread_id_t jit_debugger_get_self (jit_debugger_t dbg) nothrow @nogc;
272 jit_debugger_thread_id_t jit_debugger_get_thread (jit_debugger_t dbg, const(void)* native_thread) nothrow @nogc;
273 int jit_debugger_get_native_thread (jit_debugger_t dbg, jit_debugger_thread_id_t thread, void* native_thread) nothrow @nogc;
274 void jit_debugger_set_breakable (jit_debugger_t dbg, const(void)* native_thread, int flag) nothrow @nogc;
276 void jit_debugger_attach_self (jit_debugger_t dbg, int stop_immediately) nothrow @nogc;
277 void jit_debugger_detach_self (jit_debugger_t dbg) nothrow @nogc;
279 int jit_debugger_wait_event (jit_debugger_t dbg, jit_debugger_event_t* event, jit_int timeout) nothrow @nogc;
281 jit_debugger_breakpoint_id_t jit_debugger_add_breakpoint (jit_debugger_t dbg, jit_debugger_breakpoint_info_t info) nothrow @nogc;
282 void jit_debugger_remove_breakpoint (jit_debugger_t dbg, jit_debugger_breakpoint_id_t id) nothrow @nogc;
283 void jit_debugger_remove_all_breakpoints (jit_debugger_t dbg) nothrow @nogc;
285 int jit_debugger_is_alive (jit_debugger_t dbg, jit_debugger_thread_id_t thread) nothrow @nogc;
286 int jit_debugger_is_running (jit_debugger_t dbg, jit_debugger_thread_id_t thread) nothrow @nogc;
287 void jit_debugger_run (jit_debugger_t dbg, jit_debugger_thread_id_t thread) nothrow @nogc;
288 void jit_debugger_step (jit_debugger_t dbg, jit_debugger_thread_id_t thread) nothrow @nogc;
289 void jit_debugger_next (jit_debugger_t dbg, jit_debugger_thread_id_t thread) nothrow @nogc;
290 void jit_debugger_finish (jit_debugger_t dbg, jit_debugger_thread_id_t thread) nothrow @nogc;
292 void jit_debugger_break (jit_debugger_t dbg) nothrow @nogc;
294 void jit_debugger_quit (jit_debugger_t dbg) nothrow @nogc;
296 jit_debugger_hook_func jit_debugger_set_hook (jit_context_t context, jit_debugger_hook_func hook) nothrow @nogc;
300 * Opaque types that represent a loaded ELF binary in read or write mode.
302 struct jit_readelf {}
303 alias jit_readelf_t = jit_readelf*;
304 struct jit_writeelf {}
305 alias jit_writeelf_t = jit_writeelf*;
308 * Flags for "jit_readelf_open".
310 enum JIT_READELF_FLAG_FORCE = (1 << 0); /* Force file to load */
311 enum JIT_READELF_FLAG_DEBUG = (1 << 1); /* Print debugging information */
314 * Result codes from "jit_readelf_open".
316 enum JIT_READELF_OK = 0; /* File was opened successfully */
317 enum JIT_READELF_CANNOT_OPEN = 1; /* Could not open the file */
318 enum JIT_READELF_NOT_ELF = 2; /* Not an ELF-format binary */
319 enum JIT_READELF_WRONG_ARCH = 3; /* Wrong architecture for local system */
320 enum JIT_READELF_BAD_FORMAT = 4; /* ELF file, but badly formatted */
321 enum JIT_READELF_MEMORY = 5; /* Insufficient memory to load the file */
324 * External function declarations.
326 int jit_readelf_open (jit_readelf_t* readelf, const(char)* filename, int flags) nothrow @nogc;
327 void jit_readelf_close (jit_readelf_t readelf) nothrow @nogc;
328 const(char)* jit_readelf_get_name (jit_readelf_t readelf) nothrow @nogc;
329 void* jit_readelf_get_symbol (jit_readelf_t readelf, const(char)* name) nothrow @nogc;
330 void* jit_readelf_get_section (jit_readelf_t readelf, const(char)* name, jit_nuint* size) nothrow @nogc;
331 void* jit_readelf_get_section_by_type (jit_readelf_t readelf, jit_int type, jit_nuint* size) nothrow @nogc;
332 void* jit_readelf_map_vaddr (jit_readelf_t readelf, jit_nuint vaddr) nothrow @nogc;
333 uint jit_readelf_num_needed (jit_readelf_t readelf) nothrow @nogc;
334 const(char)* jit_readelf_get_needed (jit_readelf_t readelf, uint index) nothrow @nogc;
335 void jit_readelf_add_to_context (jit_readelf_t readelf, jit_context_t context) nothrow @nogc;
336 int jit_readelf_resolve_all (jit_context_t context, int print_failures) nothrow @nogc;
337 int jit_readelf_register_symbol (jit_context_t context, const(char)* name, void* value, int after) nothrow @nogc;
339 jit_writeelf_t jit_writeelf_create (const(char)* library_name) nothrow @nogc;
340 void jit_writeelf_destroy (jit_writeelf_t writeelf) nothrow @nogc;
341 int jit_writeelf_write (jit_writeelf_t writeelf, const(char)* filename) nothrow @nogc;
342 int jit_writeelf_add_function (jit_writeelf_t writeelf, jit_function_t func, const(char)* name) nothrow @nogc;
343 int jit_writeelf_add_needed (jit_writeelf_t writeelf, const(char)* library_name) nothrow @nogc;
344 int jit_writeelf_write_section (jit_writeelf_t writeelf, const(char)* name, jit_int type, const(void)* buf, uint len, int discardable) nothrow @nogc;
347 * Builtin exception type codes, and result values for intrinsic functions.
349 enum JIT_RESULT_OK = (1);
350 enum JIT_RESULT_OVERFLOW = (0);
351 enum JIT_RESULT_ARITHMETIC = (-1);
352 enum JIT_RESULT_DIVISION_BY_ZERO = (-2);
353 enum JIT_RESULT_COMPILE_ERROR = (-3);
354 enum JIT_RESULT_OUT_OF_MEMORY = (-4);
355 enum JIT_RESULT_NULL_REFERENCE = (-5);
356 enum JIT_RESULT_NULL_FUNCTION = (-6);
357 enum JIT_RESULT_CALLED_NESTED = (-7);
358 enum JIT_RESULT_OUT_OF_BOUNDS = (-8);
359 enum JIT_RESULT_UNDEFINED_LABEL = (-9);
360 enum JIT_RESULT_MEMORY_FULL = (-10000);
363 * Exception handling function for builtin exceptions.
365 alias jit_exception_func = void* function (int exception_type) nothrow;
368 * External function declarations.
370 void* jit_exception_get_last () nothrow @nogc;
371 void* jit_exception_get_last_and_clear () nothrow @nogc;
372 void jit_exception_set_last (void* object) nothrow @nogc;
373 void jit_exception_clear_last () nothrow @nogc;
374 void jit_exception_throw (void* object) nothrow @nogc;
375 void jit_exception_builtin (int exception_type) nothrow @nogc;
376 jit_exception_func jit_exception_set_handler (jit_exception_func handler) nothrow @nogc;
377 jit_exception_func jit_exception_get_handler () nothrow @nogc;
378 jit_stack_trace_t jit_exception_get_stack_trace () nothrow @nogc;
379 uint jit_stack_trace_get_size (jit_stack_trace_t trace) nothrow @nogc;
380 jit_function_t jit_stack_trace_get_function (jit_context_t context, jit_stack_trace_t trace, uint posn) nothrow @nogc;
381 void* jit_stack_trace_get_pc (jit_stack_trace_t trace, uint posn) nothrow @nogc;
382 uint jit_stack_trace_get_offset (jit_context_t context, jit_stack_trace_t trace, uint posn) nothrow @nogc;
383 void jit_stack_trace_free (jit_stack_trace_t trace) nothrow @nogc;
386 /* Optimization levels */
387 enum JIT_OPTLEVEL_NONE = 0;
388 enum JIT_OPTLEVEL_NORMAL = 1;
390 jit_function_t jit_function_create (jit_context_t context, jit_type_t signature) nothrow @nogc;
391 jit_function_t jit_function_create_nested (jit_context_t context, jit_type_t signature, jit_function_t parent) nothrow @nogc;
392 void jit_function_abandon (jit_function_t func) nothrow @nogc;
393 jit_context_t jit_function_get_context (jit_function_t func) nothrow @nogc;
394 jit_type_t jit_function_get_signature (jit_function_t func) nothrow @nogc;
395 int jit_function_set_meta (jit_function_t func, int type, void* data, jit_meta_free_func free_data, int build_only) nothrow @nogc;
396 void* jit_function_get_meta (jit_function_t func, int type) nothrow @nogc;
397 void jit_function_free_meta (jit_function_t func, int type) nothrow @nogc;
398 jit_function_t jit_function_next (jit_context_t context, jit_function_t prev) nothrow @nogc;
399 jit_function_t jit_function_previous (jit_context_t context, jit_function_t prev) nothrow @nogc;
400 jit_block_t jit_function_get_entry (jit_function_t func) nothrow @nogc;
401 jit_block_t jit_function_get_current (jit_function_t func) nothrow @nogc;
402 jit_function_t jit_function_get_nested_parent (jit_function_t func) nothrow @nogc;
403 int jit_function_compile (jit_function_t func) nothrow @nogc;
404 int jit_function_is_compiled (jit_function_t func) nothrow @nogc;
405 void jit_function_set_recompilable (jit_function_t func) nothrow @nogc;
406 void jit_function_clear_recompilable (jit_function_t func) nothrow @nogc;
407 int jit_function_is_recompilable (jit_function_t func) nothrow @nogc;
408 int jit_function_compile_entry (jit_function_t func, void** entry_point) nothrow @nogc;
409 void jit_function_setup_entry (jit_function_t func, void* entry_point) nothrow @nogc;
410 void* jit_function_to_closure (jit_function_t func) nothrow @nogc;
411 jit_function_t jit_function_from_closure (jit_context_t context, void* closure) nothrow @nogc;
412 jit_function_t jit_function_from_pc (jit_context_t context, void* pc, void** handler) nothrow @nogc;
413 void* jit_function_to_vtable_pointer (jit_function_t func) nothrow @nogc;
414 jit_function_t jit_function_from_vtable_pointer (jit_context_t context, void* vtable_pointer) nothrow @nogc;
415 void jit_function_set_on_demand_compiler (jit_function_t func, jit_on_demand_func on_demand) nothrow @nogc;
416 jit_on_demand_func jit_function_get_on_demand_compiler (jit_function_t func) nothrow @nogc;
417 int jit_function_apply (jit_function_t func, void** args, void* return_area) nothrow;
418 int jit_function_apply_vararg (jit_function_t func, jit_type_t signature, void** args, void* return_area) nothrow;
419 void jit_function_set_optimization_level (jit_function_t func, uint level) nothrow @nogc;
420 uint jit_function_get_optimization_level (jit_function_t func) nothrow @nogc;
421 uint jit_function_get_max_optimization_level () nothrow @nogc;
422 jit_label_t jit_function_reserve_label (jit_function_t func) nothrow @nogc;
423 int jit_function_labels_equal (jit_function_t func, jit_label_t label, jit_label_t label2) nothrow @nogc;
426 void jit_init () nothrow @nogc;
428 int jit_uses_interpreter () nothrow @nogc;
430 int jit_supports_threads () nothrow @nogc;
432 int jit_supports_virtual_memory () nothrow @nogc;
434 int jit_supports_closures () nothrow @nogc;
436 uint jit_get_closure_size () nothrow @nogc;
437 uint jit_get_closure_alignment () nothrow @nogc;
438 uint jit_get_trampoline_size () nothrow @nogc;
439 uint jit_get_trampoline_alignment () nothrow @nogc;
443 * Descriptor for an intrinsic function.
445 struct jit_intrinsic_descr_t {
446 jit_type_t return_type;
447 jit_type_t ptr_result_type;
448 jit_type_t arg1_type;
449 jit_type_t arg2_type;
453 * Structure for iterating over the instructions in a block.
454 * This should be treated as opaque.
456 struct jit_insn_iter_t {
457 jit_block_t block;
458 int posn;
462 * Flags for "jit_insn_call" and friends.
464 enum JIT_CALL_NOTHROW = (1 << 0);
465 enum JIT_CALL_NORETURN = (1 << 1);
466 enum JIT_CALL_TAIL = (1 << 2);
468 int jit_insn_get_opcode (jit_insn_t insn) nothrow @nogc;
469 jit_value_t jit_insn_get_dest (jit_insn_t insn) nothrow @nogc;
470 jit_value_t jit_insn_get_value1 (jit_insn_t insn) nothrow @nogc;
471 jit_value_t jit_insn_get_value2 (jit_insn_t insn) nothrow @nogc;
472 jit_label_t jit_insn_get_label (jit_insn_t insn) nothrow @nogc;
473 jit_function_t jit_insn_get_function (jit_insn_t insn) nothrow @nogc;
474 void* jit_insn_get_native (jit_insn_t insn) nothrow @nogc;
475 const(char)* jit_insn_get_name (jit_insn_t insn) nothrow @nogc;
476 jit_type_t jit_insn_get_signature (jit_insn_t insn) nothrow @nogc;
477 int jit_insn_dest_is_value (jit_insn_t insn) nothrow @nogc;
479 int jit_insn_label (jit_function_t func, jit_label_t* label) nothrow @nogc;
480 int jit_insn_label_tight (jit_function_t func, jit_label_t* label) nothrow @nogc;
481 int jit_insn_new_block (jit_function_t func) nothrow @nogc;
482 jit_value_t jit_insn_load (jit_function_t func, jit_value_t value) nothrow @nogc;
483 jit_value_t jit_insn_dup (jit_function_t func, jit_value_t value) nothrow @nogc;
484 int jit_insn_store (jit_function_t func, jit_value_t dest, jit_value_t value) nothrow @nogc;
485 jit_value_t jit_insn_load_relative (jit_function_t func, jit_value_t value, jit_nint offset, jit_type_t type) nothrow @nogc;
486 int jit_insn_store_relative (jit_function_t func, jit_value_t dest, jit_nint offset, jit_value_t value) nothrow @nogc;
487 jit_value_t jit_insn_add_relative (jit_function_t func, jit_value_t value, jit_nint offset) nothrow @nogc;
488 jit_value_t jit_insn_load_elem (jit_function_t func, jit_value_t base_addr, jit_value_t index, jit_type_t elem_type) nothrow @nogc;
489 jit_value_t jit_insn_load_elem_address (jit_function_t func, jit_value_t base_addr, jit_value_t index, jit_type_t elem_type) nothrow @nogc;
490 int jit_insn_store_elem (jit_function_t func, jit_value_t base_addr, jit_value_t index, jit_value_t value) nothrow @nogc;
491 int jit_insn_check_null (jit_function_t func, jit_value_t value) nothrow @nogc;
492 int jit_insn_nop (jit_function_t func) nothrow @nogc;
494 jit_value_t jit_insn_add (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
495 jit_value_t jit_insn_add_ovf (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
496 jit_value_t jit_insn_sub (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
497 jit_value_t jit_insn_sub_ovf (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
498 jit_value_t jit_insn_mul (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
499 jit_value_t jit_insn_mul_ovf (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
500 jit_value_t jit_insn_div (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
501 jit_value_t jit_insn_rem (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
502 jit_value_t jit_insn_rem_ieee (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
503 jit_value_t jit_insn_neg (jit_function_t func, jit_value_t value1) nothrow @nogc;
504 jit_value_t jit_insn_and (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
505 jit_value_t jit_insn_or (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
506 jit_value_t jit_insn_xor (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
507 jit_value_t jit_insn_not (jit_function_t func, jit_value_t value1) nothrow @nogc;
508 jit_value_t jit_insn_shl (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
509 jit_value_t jit_insn_shr (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
510 jit_value_t jit_insn_ushr (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
511 jit_value_t jit_insn_sshr (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
512 jit_value_t jit_insn_eq (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
513 jit_value_t jit_insn_ne (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
514 jit_value_t jit_insn_lt (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
515 jit_value_t jit_insn_le (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
516 jit_value_t jit_insn_gt (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
517 jit_value_t jit_insn_ge (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
518 jit_value_t jit_insn_cmpl (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
519 jit_value_t jit_insn_cmpg (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
520 jit_value_t jit_insn_to_bool (jit_function_t func, jit_value_t value1) nothrow @nogc;
521 jit_value_t jit_insn_to_not_bool (jit_function_t func, jit_value_t value1) nothrow @nogc;
522 jit_value_t jit_insn_acos (jit_function_t func, jit_value_t value1) nothrow @nogc;
523 jit_value_t jit_insn_asin (jit_function_t func, jit_value_t value1) nothrow @nogc;
524 jit_value_t jit_insn_atan (jit_function_t func, jit_value_t value1) nothrow @nogc;
525 jit_value_t jit_insn_atan2 (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
526 jit_value_t jit_insn_ceil (jit_function_t func, jit_value_t value1) nothrow @nogc;
527 jit_value_t jit_insn_cos (jit_function_t func, jit_value_t value1) nothrow @nogc;
528 jit_value_t jit_insn_cosh (jit_function_t func, jit_value_t value1) nothrow @nogc;
529 jit_value_t jit_insn_exp (jit_function_t func, jit_value_t value1) nothrow @nogc;
530 jit_value_t jit_insn_floor (jit_function_t func, jit_value_t value1) nothrow @nogc;
531 jit_value_t jit_insn_log (jit_function_t func, jit_value_t value1) nothrow @nogc;
532 jit_value_t jit_insn_log10 (jit_function_t func, jit_value_t value1) nothrow @nogc;
533 jit_value_t jit_insn_pow (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
534 jit_value_t jit_insn_rint (jit_function_t func, jit_value_t value1) nothrow @nogc;
535 jit_value_t jit_insn_round (jit_function_t func, jit_value_t value1) nothrow @nogc;
536 jit_value_t jit_insn_sin (jit_function_t func, jit_value_t value1) nothrow @nogc;
537 jit_value_t jit_insn_sinh (jit_function_t func, jit_value_t value1) nothrow @nogc;
538 jit_value_t jit_insn_sqrt (jit_function_t func, jit_value_t value1) nothrow @nogc;
539 jit_value_t jit_insn_tan (jit_function_t func, jit_value_t value1) nothrow @nogc;
540 jit_value_t jit_insn_tanh (jit_function_t func, jit_value_t value1) nothrow @nogc;
541 jit_value_t jit_insn_trunc (jit_function_t func, jit_value_t value1) nothrow @nogc;
542 jit_value_t jit_insn_is_nan (jit_function_t func, jit_value_t value1) nothrow @nogc;
543 jit_value_t jit_insn_is_finite (jit_function_t func, jit_value_t value1) nothrow @nogc;
544 jit_value_t jit_insn_is_inf (jit_function_t func, jit_value_t value1) nothrow @nogc;
545 jit_value_t jit_insn_abs (jit_function_t func, jit_value_t value1) nothrow @nogc;
546 jit_value_t jit_insn_min (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
547 jit_value_t jit_insn_max (jit_function_t func, jit_value_t value1, jit_value_t value2) nothrow @nogc;
548 jit_value_t jit_insn_sign (jit_function_t func, jit_value_t value1) nothrow @nogc;
549 int jit_insn_branch (jit_function_t func, jit_label_t* label) nothrow @nogc;
550 int jit_insn_branch_if (jit_function_t func, jit_value_t value, jit_label_t* label) nothrow @nogc;
551 int jit_insn_branch_if_not (jit_function_t func, jit_value_t value, jit_label_t* label) nothrow @nogc;
552 int jit_insn_jump_table (jit_function_t func, jit_value_t value, jit_label_t* labels, uint num_labels) nothrow @nogc;
553 jit_value_t jit_insn_address_of (jit_function_t func, jit_value_t value1) nothrow @nogc;
554 jit_value_t jit_insn_address_of_label (jit_function_t func, jit_label_t* label) nothrow @nogc;
555 jit_value_t jit_insn_convert (jit_function_t func, jit_value_t value, jit_type_t type, int overflow_check) nothrow @nogc;
557 jit_value_t jit_insn_call (jit_function_t func, const(char)* name, jit_function_t jit_func, jit_type_t signature, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
558 jit_value_t jit_insn_call_indirect (jit_function_t func, jit_value_t value, jit_type_t signature, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
559 jit_value_t jit_insn_call_indirect_vtable (jit_function_t func, jit_value_t value, jit_type_t signature, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
560 jit_value_t jit_insn_call_native (jit_function_t func, const(char)* name, void* native_func, jit_type_t signature, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
561 jit_value_t jit_insn_call_intrinsic (jit_function_t func, const(char)* name, void* intrinsic_func, const jit_intrinsic_descr_t* descriptor, jit_value_t arg1, jit_value_t arg2) nothrow @nogc;
562 int jit_insn_incoming_reg (jit_function_t func, jit_value_t value, int reg) nothrow @nogc;
563 int jit_insn_incoming_frame_posn (jit_function_t func, jit_value_t value, jit_nint frame_offset) nothrow @nogc;
564 int jit_insn_outgoing_reg (jit_function_t func, jit_value_t value, int reg) nothrow @nogc;
565 int jit_insn_outgoing_frame_posn (jit_function_t func, jit_value_t value, jit_nint frame_offset) nothrow @nogc;
566 int jit_insn_return_reg (jit_function_t func, jit_value_t value, int reg) nothrow @nogc;
567 int jit_insn_setup_for_nested (jit_function_t func, int nested_level, int reg) nothrow @nogc;
568 int jit_insn_flush_struct (jit_function_t func, jit_value_t value) nothrow @nogc;
569 jit_value_t jit_insn_import (jit_function_t func, jit_value_t value) nothrow @nogc;
570 int jit_insn_push (jit_function_t func, jit_value_t value) nothrow @nogc;
571 int jit_insn_push_ptr (jit_function_t func, jit_value_t value, jit_type_t type) nothrow @nogc;
572 int jit_insn_set_param (jit_function_t func, jit_value_t value, jit_nint offset) nothrow @nogc;
573 int jit_insn_set_param_ptr (jit_function_t func, jit_value_t value, jit_type_t type, jit_nint offset) nothrow @nogc;
574 int jit_insn_push_return_area_ptr (jit_function_t func) nothrow @nogc;
575 int jit_insn_pop_stack (jit_function_t func, jit_nint num_items) nothrow @nogc;
576 int jit_insn_defer_pop_stack (jit_function_t func, jit_nint num_items) nothrow @nogc;
577 int jit_insn_flush_defer_pop (jit_function_t func, jit_nint num_items) nothrow @nogc;
578 int jit_insn_return (jit_function_t func, jit_value_t value) nothrow @nogc;
579 int jit_insn_return_ptr (jit_function_t func, jit_value_t value, jit_type_t type) nothrow @nogc;
580 int jit_insn_default_return (jit_function_t func) nothrow @nogc;
581 int jit_insn_throw (jit_function_t func, jit_value_t value) nothrow @nogc;
582 jit_value_t jit_insn_get_call_stack (jit_function_t func) nothrow @nogc;
584 jit_value_t jit_insn_thrown_exception (jit_function_t func) nothrow @nogc;
585 int jit_insn_uses_catcher (jit_function_t func) nothrow @nogc;
586 jit_value_t jit_insn_start_catcher (jit_function_t func) nothrow @nogc;
587 int jit_insn_branch_if_pc_not_in_range (jit_function_t func, jit_label_t start_label, jit_label_t end_label, jit_label_t* label) nothrow @nogc;
588 int jit_insn_rethrow_unhandled (jit_function_t func) nothrow @nogc;
589 int jit_insn_start_finally (jit_function_t func, jit_label_t* finally_label) nothrow @nogc;
590 int jit_insn_return_from_finally (jit_function_t func) nothrow @nogc;
591 int jit_insn_call_finally (jit_function_t func, jit_label_t* finally_label) nothrow @nogc;
592 jit_value_t jit_insn_start_filter (jit_function_t func, jit_label_t* label, jit_type_t type) nothrow @nogc;
593 int jit_insn_return_from_filter (jit_function_t func, jit_value_t value) nothrow @nogc;
594 jit_value_t jit_insn_call_filter (jit_function_t func, jit_label_t* label, jit_value_t value, jit_type_t type) nothrow @nogc;
596 int jit_insn_memcpy (jit_function_t func, jit_value_t dest, jit_value_t src, jit_value_t size) nothrow @nogc;
597 int jit_insn_memmove (jit_function_t func, jit_value_t dest, jit_value_t src, jit_value_t size) nothrow @nogc;
598 int jit_insn_memset (jit_function_t func, jit_value_t dest, jit_value_t value, jit_value_t size) nothrow @nogc;
599 jit_value_t jit_insn_alloca (jit_function_t func, jit_value_t size) nothrow @nogc;
601 int jit_insn_move_blocks_to_end (jit_function_t func, jit_label_t from_label, jit_label_t to_label) nothrow @nogc;
602 int jit_insn_move_blocks_to_start (jit_function_t func, jit_label_t from_label, jit_label_t to_label) nothrow @nogc;
604 int jit_insn_mark_offset (jit_function_t func, jit_int offset) nothrow @nogc;
605 int jit_insn_mark_breakpoint (jit_function_t func, jit_nint data1, jit_nint data2) nothrow @nogc;
606 int jit_insn_mark_breakpoint_variable (jit_function_t func, jit_value_t data1, jit_value_t data2) nothrow @nogc;
608 void jit_insn_iter_init (jit_insn_iter_t* iter, jit_block_t block) nothrow @nogc;
609 void jit_insn_iter_init_last (jit_insn_iter_t* iter, jit_block_t block) nothrow @nogc;
610 jit_insn_t jit_insn_iter_next (jit_insn_iter_t* iter) nothrow @nogc;
611 jit_insn_t jit_insn_iter_previous (jit_insn_iter_t* iter) nothrow @nogc;
615 * Perform operations on signed 32-bit integers.
617 jit_int jit_int_add (jit_int value1, jit_int value2) nothrow @nogc;
618 jit_int jit_int_sub (jit_int value1, jit_int value2) nothrow @nogc;
619 jit_int jit_int_mul (jit_int value1, jit_int value2) nothrow @nogc;
620 jit_int jit_int_div (jit_int* result, jit_int value1, jit_int value2) nothrow @nogc;
621 jit_int jit_int_rem (jit_int* result, jit_int value1, jit_int value2) nothrow @nogc;
622 jit_int jit_int_add_ovf (jit_int* result, jit_int value1, jit_int value2) nothrow @nogc;
623 jit_int jit_int_sub_ovf (jit_int* result, jit_int value1, jit_int value2) nothrow @nogc;
624 jit_int jit_int_mul_ovf (jit_int* result, jit_int value1, jit_int value2) nothrow @nogc;
625 jit_int jit_int_neg (jit_int value1) nothrow @nogc;
626 jit_int jit_int_and (jit_int value1, jit_int value2) nothrow @nogc;
627 jit_int jit_int_or (jit_int value1, jit_int value2) nothrow @nogc;
628 jit_int jit_int_xor (jit_int value1, jit_int value2) nothrow @nogc;
629 jit_int jit_int_not (jit_int value1) nothrow @nogc;
630 jit_int jit_int_shl (jit_int value1, jit_uint value2) nothrow @nogc;
631 jit_int jit_int_shr (jit_int value1, jit_uint value2) nothrow @nogc;
632 jit_int jit_int_eq (jit_int value1, jit_int value2) nothrow @nogc;
633 jit_int jit_int_ne (jit_int value1, jit_int value2) nothrow @nogc;
634 jit_int jit_int_lt (jit_int value1, jit_int value2) nothrow @nogc;
635 jit_int jit_int_le (jit_int value1, jit_int value2) nothrow @nogc;
636 jit_int jit_int_gt (jit_int value1, jit_int value2) nothrow @nogc;
637 jit_int jit_int_ge (jit_int value1, jit_int value2) nothrow @nogc;
638 jit_int jit_int_cmp (jit_int value1, jit_int value2) nothrow @nogc;
639 jit_int jit_int_abs (jit_int value1) nothrow @nogc;
640 jit_int jit_int_min (jit_int value1, jit_int value2) nothrow @nogc;
641 jit_int jit_int_max (jit_int value1, jit_int value2) nothrow @nogc;
642 jit_int jit_int_sign (jit_int value1) nothrow @nogc;
645 * Perform operations on unsigned 32-bit integers.
647 jit_uint jit_uint_add (jit_uint value1, jit_uint value2) nothrow @nogc;
648 jit_uint jit_uint_sub (jit_uint value1, jit_uint value2) nothrow @nogc;
649 jit_uint jit_uint_mul (jit_uint value1, jit_uint value2) nothrow @nogc;
650 jit_int jit_uint_div (jit_uint* result, jit_uint value1, jit_uint value2) nothrow @nogc;
651 jit_int jit_uint_rem (jit_uint* result, jit_uint value1, jit_uint value2) nothrow @nogc;
652 jit_int jit_uint_add_ovf (jit_uint* result, jit_uint value1, jit_uint value2) nothrow @nogc;
653 jit_int jit_uint_sub_ovf (jit_uint* result, jit_uint value1, jit_uint value2) nothrow @nogc;
654 jit_int jit_uint_mul_ovf (jit_uint* result, jit_uint value1, jit_uint value2) nothrow @nogc;
655 jit_uint jit_uint_neg (jit_uint value1) nothrow @nogc;
656 jit_uint jit_uint_and (jit_uint value1, jit_uint value2) nothrow @nogc;
657 jit_uint jit_uint_or (jit_uint value1, jit_uint value2) nothrow @nogc;
658 jit_uint jit_uint_xor (jit_uint value1, jit_uint value2) nothrow @nogc;
659 jit_uint jit_uint_not (jit_uint value1) nothrow @nogc;
660 jit_uint jit_uint_shl (jit_uint value1, jit_uint value2) nothrow @nogc;
661 jit_uint jit_uint_shr (jit_uint value1, jit_uint value2) nothrow @nogc;
662 jit_int jit_uint_eq (jit_uint value1, jit_uint value2) nothrow @nogc;
663 jit_int jit_uint_ne (jit_uint value1, jit_uint value2) nothrow @nogc;
664 jit_int jit_uint_lt (jit_uint value1, jit_uint value2) nothrow @nogc;
665 jit_int jit_uint_le (jit_uint value1, jit_uint value2) nothrow @nogc;
666 jit_int jit_uint_gt (jit_uint value1, jit_uint value2) nothrow @nogc;
667 jit_int jit_uint_ge (jit_uint value1, jit_uint value2) nothrow @nogc;
668 jit_int jit_uint_cmp (jit_uint value1, jit_uint value2) nothrow @nogc;
669 jit_uint jit_uint_min (jit_uint value1, jit_uint value2) nothrow @nogc;
670 jit_uint jit_uint_max (jit_uint value1, jit_uint value2) nothrow @nogc;
673 * Perform operations on signed 64-bit integers.
675 jit_long jit_long_add (jit_long value1, jit_long value2) nothrow @nogc;
676 jit_long jit_long_sub (jit_long value1, jit_long value2) nothrow @nogc;
677 jit_long jit_long_mul (jit_long value1, jit_long value2) nothrow @nogc;
678 jit_int jit_long_div (jit_long* result, jit_long value1, jit_long value2) nothrow @nogc;
679 jit_int jit_long_rem (jit_long* result, jit_long value1, jit_long value2) nothrow @nogc;
680 jit_int jit_long_add_ovf (jit_long* result, jit_long value1, jit_long value2) nothrow @nogc;
681 jit_int jit_long_sub_ovf (jit_long* result, jit_long value1, jit_long value2) nothrow @nogc;
682 jit_int jit_long_mul_ovf (jit_long* result, jit_long value1, jit_long value2) nothrow @nogc;
683 jit_long jit_long_neg (jit_long value1) nothrow @nogc;
684 jit_long jit_long_and (jit_long value1, jit_long value2) nothrow @nogc;
685 jit_long jit_long_or (jit_long value1, jit_long value2) nothrow @nogc;
686 jit_long jit_long_xor (jit_long value1, jit_long value2) nothrow @nogc;
687 jit_long jit_long_not (jit_long value1) nothrow @nogc;
688 jit_long jit_long_shl (jit_long value1, jit_uint value2) nothrow @nogc;
689 jit_long jit_long_shr (jit_long value1, jit_uint value2) nothrow @nogc;
690 jit_int jit_long_eq (jit_long value1, jit_long value2) nothrow @nogc;
691 jit_int jit_long_ne (jit_long value1, jit_long value2) nothrow @nogc;
692 jit_int jit_long_lt (jit_long value1, jit_long value2) nothrow @nogc;
693 jit_int jit_long_le (jit_long value1, jit_long value2) nothrow @nogc;
694 jit_int jit_long_gt (jit_long value1, jit_long value2) nothrow @nogc;
695 jit_int jit_long_ge (jit_long value1, jit_long value2) nothrow @nogc;
696 jit_int jit_long_cmp (jit_long value1, jit_long value2) nothrow @nogc;
697 jit_long jit_long_abs (jit_long value1) nothrow @nogc;
698 jit_long jit_long_min (jit_long value1, jit_long value2) nothrow @nogc;
699 jit_long jit_long_max (jit_long value1, jit_long value2) nothrow @nogc;
700 jit_int jit_long_sign (jit_long value1) nothrow @nogc;
703 * Perform operations on unsigned 64-bit integers.
705 jit_ulong jit_ulong_add (jit_ulong value1, jit_ulong value2) nothrow @nogc;
706 jit_ulong jit_ulong_sub (jit_ulong value1, jit_ulong value2) nothrow @nogc;
707 jit_ulong jit_ulong_mul (jit_ulong value1, jit_ulong value2) nothrow @nogc;
708 jit_int jit_ulong_div (jit_ulong* result, jit_ulong value1, jit_ulong value2) nothrow @nogc;
709 jit_int jit_ulong_rem (jit_ulong* result, jit_ulong value1, jit_ulong value2) nothrow @nogc;
710 jit_int jit_ulong_add_ovf (jit_ulong* result, jit_ulong value1, jit_ulong value2) nothrow @nogc;
711 jit_int jit_ulong_sub_ovf (jit_ulong* result, jit_ulong value1, jit_ulong value2) nothrow @nogc;
712 jit_int jit_ulong_mul_ovf (jit_ulong* result, jit_ulong value1, jit_ulong value2) nothrow @nogc;
713 jit_ulong jit_ulong_neg (jit_ulong value1) nothrow @nogc;
714 jit_ulong jit_ulong_and (jit_ulong value1, jit_ulong value2) nothrow @nogc;
715 jit_ulong jit_ulong_or (jit_ulong value1, jit_ulong value2) nothrow @nogc;
716 jit_ulong jit_ulong_xor (jit_ulong value1, jit_ulong value2) nothrow @nogc;
717 jit_ulong jit_ulong_not (jit_ulong value1) nothrow @nogc;
718 jit_ulong jit_ulong_shl (jit_ulong value1, jit_uint value2) nothrow @nogc;
719 jit_ulong jit_ulong_shr (jit_ulong value1, jit_uint value2) nothrow @nogc;
720 jit_int jit_ulong_eq (jit_ulong value1, jit_ulong value2) nothrow @nogc;
721 jit_int jit_ulong_ne (jit_ulong value1, jit_ulong value2) nothrow @nogc;
722 jit_int jit_ulong_lt (jit_ulong value1, jit_ulong value2) nothrow @nogc;
723 jit_int jit_ulong_le (jit_ulong value1, jit_ulong value2) nothrow @nogc;
724 jit_int jit_ulong_gt (jit_ulong value1, jit_ulong value2) nothrow @nogc;
725 jit_int jit_ulong_ge (jit_ulong value1, jit_ulong value2) nothrow @nogc;
726 jit_int jit_ulong_cmp (jit_ulong value1, jit_ulong value2) nothrow @nogc;
727 jit_ulong jit_ulong_min (jit_ulong value1, jit_ulong value2) nothrow @nogc;
728 jit_ulong jit_ulong_max (jit_ulong value1, jit_ulong value2) nothrow @nogc;
731 * Perform operations on 32-bit floating-point values.
733 jit_float32 jit_float32_add (jit_float32 value1, jit_float32 value2) nothrow @nogc;
734 jit_float32 jit_float32_sub (jit_float32 value1, jit_float32 value2) nothrow @nogc;
735 jit_float32 jit_float32_mul (jit_float32 value1, jit_float32 value2) nothrow @nogc;
736 jit_float32 jit_float32_div (jit_float32 value1, jit_float32 value2) nothrow @nogc;
737 jit_float32 jit_float32_rem (jit_float32 value1, jit_float32 value2) nothrow @nogc;
738 jit_float32 jit_float32_ieee_rem (jit_float32 value1, jit_float32 value2) nothrow @nogc;
739 jit_float32 jit_float32_neg (jit_float32 value1) nothrow @nogc;
740 jit_int jit_float32_eq (jit_float32 value1, jit_float32 value2) nothrow @nogc;
741 jit_int jit_float32_ne (jit_float32 value1, jit_float32 value2) nothrow @nogc;
742 jit_int jit_float32_lt (jit_float32 value1, jit_float32 value2) nothrow @nogc;
743 jit_int jit_float32_le (jit_float32 value1, jit_float32 value2) nothrow @nogc;
744 jit_int jit_float32_gt (jit_float32 value1, jit_float32 value2) nothrow @nogc;
745 jit_int jit_float32_ge (jit_float32 value1, jit_float32 value2) nothrow @nogc;
746 jit_int jit_float32_cmpl (jit_float32 value1, jit_float32 value2) nothrow @nogc;
747 jit_int jit_float32_cmpg (jit_float32 value1, jit_float32 value2) nothrow @nogc;
748 jit_float32 jit_float32_acos (jit_float32 value1) nothrow @nogc;
749 jit_float32 jit_float32_asin (jit_float32 value1) nothrow @nogc;
750 jit_float32 jit_float32_atan (jit_float32 value1) nothrow @nogc;
751 jit_float32 jit_float32_atan2 (jit_float32 value1, jit_float32 value2) nothrow @nogc;
752 jit_float32 jit_float32_ceil (jit_float32 value1) nothrow @nogc;
753 jit_float32 jit_float32_cos (jit_float32 value1) nothrow @nogc;
754 jit_float32 jit_float32_cosh (jit_float32 value1) nothrow @nogc;
755 jit_float32 jit_float32_exp (jit_float32 value1) nothrow @nogc;
756 jit_float32 jit_float32_floor (jit_float32 value1) nothrow @nogc;
757 jit_float32 jit_float32_log (jit_float32 value1) nothrow @nogc;
758 jit_float32 jit_float32_log10 (jit_float32 value1) nothrow @nogc;
759 jit_float32 jit_float32_pow (jit_float32 value1, jit_float32 value2) nothrow @nogc;
760 jit_float32 jit_float32_rint (jit_float32 value1) nothrow @nogc;
761 jit_float32 jit_float32_round (jit_float32 value1) nothrow @nogc;
762 jit_float32 jit_float32_sin (jit_float32 value1) nothrow @nogc;
763 jit_float32 jit_float32_sinh (jit_float32 value1) nothrow @nogc;
764 jit_float32 jit_float32_sqrt (jit_float32 value1) nothrow @nogc;
765 jit_float32 jit_float32_tan (jit_float32 value1) nothrow @nogc;
766 jit_float32 jit_float32_tanh (jit_float32 value1) nothrow @nogc;
767 jit_float32 jit_float32_trunc (jit_float32 value1) nothrow @nogc;
768 jit_int jit_float32_is_finite (jit_float32 value) nothrow @nogc;
769 jit_int jit_float32_is_nan (jit_float32 value) nothrow @nogc;
770 jit_int jit_float32_is_inf (jit_float32 value) nothrow @nogc;
771 jit_float32 jit_float32_abs (jit_float32 value1) nothrow @nogc;
772 jit_float32 jit_float32_min (jit_float32 value1, jit_float32 value2) nothrow @nogc;
773 jit_float32 jit_float32_max (jit_float32 value1, jit_float32 value2) nothrow @nogc;
774 jit_int jit_float32_sign (jit_float32 value1) nothrow @nogc;
777 * Perform operations on 64-bit floating-point values.
779 jit_float64 jit_float64_add (jit_float64 value1, jit_float64 value2) nothrow @nogc;
780 jit_float64 jit_float64_sub (jit_float64 value1, jit_float64 value2) nothrow @nogc;
781 jit_float64 jit_float64_mul (jit_float64 value1, jit_float64 value2) nothrow @nogc;
782 jit_float64 jit_float64_div (jit_float64 value1, jit_float64 value2) nothrow @nogc;
783 jit_float64 jit_float64_rem (jit_float64 value1, jit_float64 value2) nothrow @nogc;
784 jit_float64 jit_float64_ieee_rem (jit_float64 value1, jit_float64 value2) nothrow @nogc;
785 jit_float64 jit_float64_neg (jit_float64 value1) nothrow @nogc;
786 jit_int jit_float64_eq (jit_float64 value1, jit_float64 value2) nothrow @nogc;
787 jit_int jit_float64_ne (jit_float64 value1, jit_float64 value2) nothrow @nogc;
788 jit_int jit_float64_lt (jit_float64 value1, jit_float64 value2) nothrow @nogc;
789 jit_int jit_float64_le (jit_float64 value1, jit_float64 value2) nothrow @nogc;
790 jit_int jit_float64_gt (jit_float64 value1, jit_float64 value2) nothrow @nogc;
791 jit_int jit_float64_ge (jit_float64 value1, jit_float64 value2) nothrow @nogc;
792 jit_int jit_float64_cmpl (jit_float64 value1, jit_float64 value2) nothrow @nogc;
793 jit_int jit_float64_cmpg (jit_float64 value1, jit_float64 value2) nothrow @nogc;
794 jit_float64 jit_float64_acos (jit_float64 value1) nothrow @nogc;
795 jit_float64 jit_float64_asin (jit_float64 value1) nothrow @nogc;
796 jit_float64 jit_float64_atan (jit_float64 value1) nothrow @nogc;
797 jit_float64 jit_float64_atan2 (jit_float64 value1, jit_float64 value2) nothrow @nogc;
798 jit_float64 jit_float64_ceil (jit_float64 value1) nothrow @nogc;
799 jit_float64 jit_float64_cos (jit_float64 value1) nothrow @nogc;
800 jit_float64 jit_float64_cosh (jit_float64 value1) nothrow @nogc;
801 jit_float64 jit_float64_exp (jit_float64 value1) nothrow @nogc;
802 jit_float64 jit_float64_floor (jit_float64 value1) nothrow @nogc;
803 jit_float64 jit_float64_log (jit_float64 value1) nothrow @nogc;
804 jit_float64 jit_float64_log10 (jit_float64 value1) nothrow @nogc;
805 jit_float64 jit_float64_pow (jit_float64 value1, jit_float64 value2) nothrow @nogc;
806 jit_float64 jit_float64_rint (jit_float64 value1) nothrow @nogc;
807 jit_float64 jit_float64_round (jit_float64 value1) nothrow @nogc;
808 jit_float64 jit_float64_sin (jit_float64 value1) nothrow @nogc;
809 jit_float64 jit_float64_sinh (jit_float64 value1) nothrow @nogc;
810 jit_float64 jit_float64_sqrt (jit_float64 value1) nothrow @nogc;
811 jit_float64 jit_float64_tan (jit_float64 value1) nothrow @nogc;
812 jit_float64 jit_float64_tanh (jit_float64 value1) nothrow @nogc;
813 jit_float64 jit_float64_trunc (jit_float64 value1) nothrow @nogc;
814 jit_int jit_float64_is_finite (jit_float64 value) nothrow @nogc;
815 jit_int jit_float64_is_nan (jit_float64 value) nothrow @nogc;
816 jit_int jit_float64_is_inf (jit_float64 value) nothrow @nogc;
817 jit_float64 jit_float64_abs (jit_float64 value1) nothrow @nogc;
818 jit_float64 jit_float64_min (jit_float64 value1, jit_float64 value2) nothrow @nogc;
819 jit_float64 jit_float64_max (jit_float64 value1, jit_float64 value2) nothrow @nogc;
820 jit_int jit_float64_sign (jit_float64 value1) nothrow @nogc;
823 * Perform operations on native floating-point values.
825 jit_nfloat jit_nfloat_add (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
826 jit_nfloat jit_nfloat_sub (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
827 jit_nfloat jit_nfloat_mul (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
828 jit_nfloat jit_nfloat_div (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
829 jit_nfloat jit_nfloat_rem (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
830 jit_nfloat jit_nfloat_ieee_rem (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
831 jit_nfloat jit_nfloat_neg (jit_nfloat value1) nothrow @nogc;
832 jit_int jit_nfloat_eq (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
833 jit_int jit_nfloat_ne (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
834 jit_int jit_nfloat_lt (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
835 jit_int jit_nfloat_le (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
836 jit_int jit_nfloat_gt (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
837 jit_int jit_nfloat_ge (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
838 jit_int jit_nfloat_cmpl (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
839 jit_int jit_nfloat_cmpg (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
840 jit_nfloat jit_nfloat_acos (jit_nfloat value1) nothrow @nogc;
841 jit_nfloat jit_nfloat_asin (jit_nfloat value1) nothrow @nogc;
842 jit_nfloat jit_nfloat_atan (jit_nfloat value1) nothrow @nogc;
843 jit_nfloat jit_nfloat_atan2 (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
844 jit_nfloat jit_nfloat_ceil (jit_nfloat value1) nothrow @nogc;
845 jit_nfloat jit_nfloat_cos (jit_nfloat value1) nothrow @nogc;
846 jit_nfloat jit_nfloat_cosh (jit_nfloat value1) nothrow @nogc;
847 jit_nfloat jit_nfloat_exp (jit_nfloat value1) nothrow @nogc;
848 jit_nfloat jit_nfloat_floor (jit_nfloat value1) nothrow @nogc;
849 jit_nfloat jit_nfloat_log (jit_nfloat value1) nothrow @nogc;
850 jit_nfloat jit_nfloat_log10 (jit_nfloat value1) nothrow @nogc;
851 jit_nfloat jit_nfloat_pow (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
852 jit_nfloat jit_nfloat_rint (jit_nfloat value1) nothrow @nogc;
853 jit_nfloat jit_nfloat_round (jit_nfloat value1) nothrow @nogc;
854 jit_nfloat jit_nfloat_sin (jit_nfloat value1) nothrow @nogc;
855 jit_nfloat jit_nfloat_sinh (jit_nfloat value1) nothrow @nogc;
856 jit_nfloat jit_nfloat_sqrt (jit_nfloat value1) nothrow @nogc;
857 jit_nfloat jit_nfloat_tan (jit_nfloat value1) nothrow @nogc;
858 jit_nfloat jit_nfloat_tanh (jit_nfloat value1) nothrow @nogc;
859 jit_nfloat jit_nfloat_trunc (jit_nfloat value1) nothrow @nogc;
860 jit_int jit_nfloat_is_finite (jit_nfloat value) nothrow @nogc;
861 jit_int jit_nfloat_is_nan (jit_nfloat value) nothrow @nogc;
862 jit_int jit_nfloat_is_inf (jit_nfloat value) nothrow @nogc;
863 jit_nfloat jit_nfloat_abs (jit_nfloat value1) nothrow @nogc;
864 jit_nfloat jit_nfloat_min (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
865 jit_nfloat jit_nfloat_max (jit_nfloat value1, jit_nfloat value2) nothrow @nogc;
866 jit_int jit_nfloat_sign (jit_nfloat value1) nothrow @nogc;
869 * Convert between integer types.
871 jit_int jit_int_to_sbyte (jit_int value) nothrow @nogc;
872 jit_int jit_int_to_ubyte (jit_int value) nothrow @nogc;
873 jit_int jit_int_to_short (jit_int value) nothrow @nogc;
874 jit_int jit_int_to_ushort (jit_int value) nothrow @nogc;
875 jit_int jit_int_to_int (jit_int value) nothrow @nogc;
876 jit_uint jit_int_to_uint (jit_int value) nothrow @nogc;
877 jit_long jit_int_to_long (jit_int value) nothrow @nogc;
878 jit_ulong jit_int_to_ulong (jit_int value) nothrow @nogc;
879 jit_int jit_uint_to_int (jit_uint value) nothrow @nogc;
880 jit_uint jit_uint_to_uint (jit_uint value) nothrow @nogc;
881 jit_long jit_uint_to_long (jit_uint value) nothrow @nogc;
882 jit_ulong jit_uint_to_ulong (jit_uint value) nothrow @nogc;
883 jit_int jit_long_to_int (jit_long value) nothrow @nogc;
884 jit_uint jit_long_to_uint (jit_long value) nothrow @nogc;
885 jit_long jit_long_to_long (jit_long value) nothrow @nogc;
886 jit_ulong jit_long_to_ulong (jit_long value) nothrow @nogc;
887 jit_int jit_ulong_to_int (jit_ulong value) nothrow @nogc;
888 jit_uint jit_ulong_to_uint (jit_ulong value) nothrow @nogc;
889 jit_long jit_ulong_to_long (jit_ulong value) nothrow @nogc;
890 jit_ulong jit_ulong_to_ulong (jit_ulong value) nothrow @nogc;
893 * Convert between integer types with overflow detection.
895 jit_int jit_int_to_sbyte_ovf (jit_int* result, jit_int value) nothrow @nogc;
896 jit_int jit_int_to_ubyte_ovf (jit_int* result, jit_int value) nothrow @nogc;
897 jit_int jit_int_to_short_ovf (jit_int* result, jit_int value) nothrow @nogc;
898 jit_int jit_int_to_ushort_ovf (jit_int* result, jit_int value) nothrow @nogc;
899 jit_int jit_int_to_int_ovf (jit_int* result, jit_int value) nothrow @nogc;
900 jit_int jit_int_to_uint_ovf (jit_uint* result, jit_int value) nothrow @nogc;
901 jit_int jit_int_to_long_ovf (jit_long* result, jit_int value) nothrow @nogc;
902 jit_int jit_int_to_ulong_ovf (jit_ulong* result, jit_int value) nothrow @nogc;
903 jit_int jit_uint_to_int_ovf (jit_int* result, jit_uint value) nothrow @nogc;
904 jit_int jit_uint_to_uint_ovf (jit_uint* result, jit_uint value) nothrow @nogc;
905 jit_int jit_uint_to_long_ovf (jit_long* result, jit_uint value) nothrow @nogc;
906 jit_int jit_uint_to_ulong_ovf (jit_ulong* result, jit_uint value) nothrow @nogc;
907 jit_int jit_long_to_int_ovf (jit_int* result, jit_long value) nothrow @nogc;
908 jit_int jit_long_to_uint_ovf (jit_uint* result, jit_long value) nothrow @nogc;
909 jit_int jit_long_to_long_ovf (jit_long* result, jit_long value) nothrow @nogc;
910 jit_int jit_long_to_ulong_ovf (jit_ulong* result, jit_long value) nothrow @nogc;
911 jit_int jit_ulong_to_int_ovf (jit_int* result, jit_ulong value) nothrow @nogc;
912 jit_int jit_ulong_to_uint_ovf (jit_uint* result, jit_ulong value) nothrow @nogc;
913 jit_int jit_ulong_to_long_ovf (jit_long* result, jit_ulong value) nothrow @nogc;
914 jit_int jit_ulong_to_ulong_ovf (jit_ulong* result, jit_ulong value) nothrow @nogc;
917 * Convert a 32-bit floating-point value into various integer types.
919 jit_int jit_float32_to_int (jit_float32 value) nothrow @nogc;
920 jit_uint jit_float32_to_uint (jit_float32 value) nothrow @nogc;
921 jit_long jit_float32_to_long (jit_float32 value) nothrow @nogc;
922 jit_ulong jit_float32_to_ulong (jit_float32 value) nothrow @nogc;
925 * Convert a 32-bit floating-point value into various integer types,
926 * with overflow detection.
928 jit_int jit_float32_to_int_ovf (jit_int* result, jit_float32 value) nothrow @nogc;
929 jit_int jit_float32_to_uint_ovf (jit_uint* result, jit_float32 value) nothrow @nogc;
930 jit_int jit_float32_to_long_ovf (jit_long* result, jit_float32 value) nothrow @nogc;
931 jit_int jit_float32_to_ulong_ovf (jit_ulong* result, jit_float32 value) nothrow @nogc;
934 * Convert a 64-bit floating-point value into various integer types.
936 jit_int jit_float64_to_int (jit_float64 value) nothrow @nogc;
937 jit_uint jit_float64_to_uint (jit_float64 value) nothrow @nogc;
938 jit_long jit_float64_to_long (jit_float64 value) nothrow @nogc;
939 jit_ulong jit_float64_to_ulong (jit_float64 value) nothrow @nogc;
942 * Convert a 64-bit floating-point value into various integer types,
943 * with overflow detection.
945 jit_int jit_float64_to_int_ovf (jit_int* result, jit_float64 value) nothrow @nogc;
946 jit_int jit_float64_to_uint_ovf (jit_uint* result, jit_float64 value) nothrow @nogc;
947 jit_int jit_float64_to_long_ovf (jit_long* result, jit_float64 value) nothrow @nogc;
948 jit_int jit_float64_to_ulong_ovf (jit_ulong* result, jit_float64 value) nothrow @nogc;
951 * Convert a native floating-point value into various integer types.
953 jit_int jit_nfloat_to_int (jit_nfloat value) nothrow @nogc;
954 jit_uint jit_nfloat_to_uint (jit_nfloat value) nothrow @nogc;
955 jit_long jit_nfloat_to_long (jit_nfloat value) nothrow @nogc;
956 jit_ulong jit_nfloat_to_ulong (jit_nfloat value) nothrow @nogc;
959 * Convert a native floating-point value into various integer types,
960 * with overflow detection.
962 jit_int jit_nfloat_to_int_ovf (jit_int* result, jit_nfloat value) nothrow @nogc;
963 jit_int jit_nfloat_to_uint_ovf (jit_uint* result, jit_nfloat value) nothrow @nogc;
964 jit_int jit_nfloat_to_long_ovf (jit_long* result, jit_nfloat value) nothrow @nogc;
965 jit_int jit_nfloat_to_ulong_ovf (jit_ulong* result, jit_nfloat value) nothrow @nogc;
968 * Convert integer types into floating-point values.
970 jit_float32 jit_int_to_float32 (jit_int value) nothrow @nogc;
971 jit_float64 jit_int_to_float64 (jit_int value) nothrow @nogc;
972 jit_nfloat jit_int_to_nfloat (jit_int value) nothrow @nogc;
973 jit_float32 jit_uint_to_float32 (jit_uint value) nothrow @nogc;
974 jit_float64 jit_uint_to_float64 (jit_uint value) nothrow @nogc;
975 jit_nfloat jit_uint_to_nfloat (jit_uint value) nothrow @nogc;
976 jit_float32 jit_long_to_float32 (jit_long value) nothrow @nogc;
977 jit_float64 jit_long_to_float64 (jit_long value) nothrow @nogc;
978 jit_nfloat jit_long_to_nfloat (jit_long value) nothrow @nogc;
979 jit_float32 jit_ulong_to_float32 (jit_ulong value) nothrow @nogc;
980 jit_float64 jit_ulong_to_float64 (jit_ulong value) nothrow @nogc;
981 jit_nfloat jit_ulong_to_nfloat (jit_ulong value) nothrow @nogc;
984 * Convert between floating-point types.
986 jit_float64 jit_float32_to_float64 (jit_float32 value) nothrow @nogc;
987 jit_nfloat jit_float32_to_nfloat (jit_float32 value) nothrow @nogc;
988 jit_float32 jit_float64_to_float32 (jit_float64 value) nothrow @nogc;
989 jit_nfloat jit_float64_to_nfloat (jit_float64 value) nothrow @nogc;
990 jit_float32 jit_nfloat_to_float32 (jit_nfloat value) nothrow @nogc;
991 jit_float64 jit_nfloat_to_float64 (jit_nfloat value) nothrow @nogc;
994 struct _jit_meta {}
995 alias jit_meta_t = _jit_meta*;
997 int jit_meta_set (jit_meta_t* list, int type, void* data, jit_meta_free_func free_data, jit_function_t pool_owner) nothrow @nogc;
998 void* jit_meta_get (jit_meta_t list, int type) nothrow @nogc;
999 void jit_meta_free (jit_meta_t* list, int type) nothrow @nogc;
1000 void jit_meta_destroy (jit_meta_t* list) nothrow @nogc;
1004 * Opaque types that describe object model elements.
1006 //struct jit_objmodel {}
1008 * Internal structure of an object model handler.
1010 struct jit_objmodel {
1012 * Size of this structure, for versioning.
1014 uint size;
1017 * Reserved fields that can be used by the handler to store its state.
1019 void* reserved0;
1020 void* reserved1;
1021 void* reserved2;
1022 void* reserved3;
1025 * Operations on object models.
1027 void function (jit_objmodel_t model) nothrow destroy_model;
1028 jitom_class_t function (jit_objmodel_t model, const(char)* name) nothrow get_class_by_name;
1031 * Operations on object model classes.
1033 char* function (jit_objmodel_t model, jitom_class_t klass) nothrow class_get_name;
1034 int function (jit_objmodel_t model, jitom_class_t klass) nothrow class_get_modifiers;
1035 jit_type_t function (jit_objmodel_t model, jitom_class_t klass) nothrow class_get_type;
1036 jit_type_t function (jit_objmodel_t model, jitom_class_t klass) nothrow class_get_value_type;
1037 jitom_class_t function (jit_objmodel_t model, jitom_class_t klass) nothrow class_get_primary_super;
1038 jitom_class_t* function (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow class_get_all_supers;
1039 jitom_class_t* function (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow class_get_interfaces;
1040 jitom_field_t* function (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow class_get_fields;
1041 jitom_method_t* function (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow class_get_methods;
1042 jit_value_t function (jit_objmodel_t model, jitom_class_t klass, jitom_method_t ctor, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow class_new;
1043 jit_value_t function (jit_objmodel_t model, jitom_class_t klass, jitom_method_t ctor, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow class_new_value;
1044 int function (jit_objmodel_t model, jitom_class_t klass, jit_value_t obj_value) nothrow class_delete;
1045 int function (jit_objmodel_t model, jitom_class_t klass, jit_value_t obj_value) nothrow class_add_ref;
1048 * Operations on object model fields.
1050 char* function (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field) nothrow field_get_name;
1051 jit_type_t function (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field) nothrow field_get_type;
1052 int function (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field) nothrow field_get_modifiers;
1053 jit_value_t function (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field, jit_function_t func, jit_value_t obj_value) nothrow field_load;
1054 jit_value_t function (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field, jit_function_t func, jit_value_t obj_value) nothrow field_load_address;
1055 int function (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field, jit_function_t func, jit_value_t obj_value, jit_value_t value) nothrow field_store;
1058 * Operations on object model methods.
1060 char* function (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method) nothrow method_get_name;
1061 jit_type_t function (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method) nothrow method_get_type;
1062 int function (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method) nothrow method_get_modifiers;
1063 jit_value_t function (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow method_invoke;
1064 jit_value_t function (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow method_invoke_virtual;
1066 alias jit_objmodel_t = jit_objmodel*;
1068 struct jitom_class {}
1069 alias jitom_class_t = jitom_class*;
1070 struct jitom_field {}
1071 alias jitom_field_t = jitom_field*;
1072 struct jitom_method {}
1073 alias jitom_method_t = jitom_method*;
1076 * Modifier flags that describe an item's properties.
1078 enum JITOM_MODIFIER_ACCESS_MASK = 0x0007;
1079 enum JITOM_MODIFIER_PUBLIC = 0x0000;
1080 enum JITOM_MODIFIER_PRIVATE = 0x0001;
1081 enum JITOM_MODIFIER_PROTECTED = 0x0002;
1082 enum JITOM_MODIFIER_PACKAGE = 0x0003;
1083 enum JITOM_MODIFIER_PACKAGE_OR_PROTECTED = 0x0004;
1084 enum JITOM_MODIFIER_PACKAGE_AND_PROTECTED = 0x0005;
1085 enum JITOM_MODIFIER_OTHER1 = 0x0006;
1086 enum JITOM_MODIFIER_OTHER2 = 0x0007;
1087 enum JITOM_MODIFIER_STATIC = 0x0008;
1088 enum JITOM_MODIFIER_VIRTUAL = 0x0010;
1089 enum JITOM_MODIFIER_NEW_SLOT = 0x0020;
1090 enum JITOM_MODIFIER_ABSTRACT = 0x0040;
1091 enum JITOM_MODIFIER_LITERAL = 0x0080;
1092 enum JITOM_MODIFIER_CTOR = 0x0100;
1093 enum JITOM_MODIFIER_STATIC_CTOR = 0x0200;
1094 enum JITOM_MODIFIER_DTOR = 0x0400;
1095 enum JITOM_MODIFIER_INTERFACE = 0x0800;
1096 enum JITOM_MODIFIER_VALUE = 0x1000;
1097 enum JITOM_MODIFIER_FINAL = 0x2000;
1098 enum JITOM_MODIFIER_DELETE = 0x4000;
1099 enum JITOM_MODIFIER_REFERENCE_COUNTED = 0x8000;
1102 * Type tags that are used to mark instances of object model classes.
1104 enum JITOM_TYPETAG_CLASS = 11000; /* Object reference */
1105 enum JITOM_TYPETAG_VALUE = 11001; /* Inline stack value */
1108 * Operations on object models.
1110 void jitom_destroy_model (jit_objmodel_t model) nothrow @nogc;
1111 jitom_class_t jitom_get_class_by_name (jit_objmodel_t model, const(char)* name) nothrow @nogc;
1114 * Operations on object model classes.
1116 char* jitom_class_get_name (jit_objmodel_t model, jitom_class_t klass) nothrow @nogc;
1117 int jitom_class_get_modifiers (jit_objmodel_t model, jitom_class_t klass) nothrow @nogc;
1118 jit_type_t jitom_class_get_type (jit_objmodel_t model, jitom_class_t klass) nothrow @nogc;
1119 jit_type_t jitom_class_get_value_type (jit_objmodel_t model, jitom_class_t klass) nothrow @nogc;
1120 jitom_class_t jitom_class_get_primary_super (jit_objmodel_t model, jitom_class_t klass) nothrow @nogc;
1121 jitom_class_t* jitom_class_get_all_supers (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow @nogc;
1122 jitom_class_t* jitom_class_get_interfaces (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow @nogc;
1123 jitom_field_t* jitom_class_get_fields (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow @nogc;
1124 jitom_method_t* jitom_class_get_methods (jit_objmodel_t model, jitom_class_t klass, uint* num) nothrow @nogc;
1125 jit_value_t jitom_class_new (jit_objmodel_t model, jitom_class_t klass, jitom_method_t ctor, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
1126 jit_value_t jitom_class_new_value (jit_objmodel_t model, jitom_class_t klass, jitom_method_t ctor, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
1127 int jitom_class_delete (jit_objmodel_t model, jitom_class_t klass, jit_value_t obj_value) nothrow @nogc;
1128 int jitom_class_add_ref (jit_objmodel_t model, jitom_class_t klass, jit_value_t obj_value) nothrow @nogc;
1131 * Operations on object model fields.
1133 const(char)* jitom_field_get_name (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field) nothrow @nogc;
1134 jit_type_t jitom_field_get_type (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field) nothrow @nogc;
1135 int jitom_field_get_modifiers (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field) nothrow @nogc;
1136 jit_value_t jitom_field_load (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field, jit_function_t func, jit_value_t obj_value) nothrow @nogc;
1137 jit_value_t jitom_field_load_address (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field, jit_function_t func, jit_value_t obj_value) nothrow @nogc;
1138 int jitom_field_store (jit_objmodel_t model, jitom_class_t klass, jitom_field_t field, jit_function_t func, jit_value_t obj_value, jit_value_t value) nothrow @nogc;
1141 * Operations on object model methods.
1143 const(char)* jitom_method_get_name (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method) nothrow @nogc;
1144 jit_type_t jitom_method_get_type (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method) nothrow @nogc;
1145 int jitom_method_get_modifiers (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method) nothrow @nogc;
1146 jit_value_t jitom_method_invoke (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
1147 jit_value_t jitom_method_invoke_virtual (jit_objmodel_t model, jitom_class_t klass, jitom_method_t method, jit_function_t func, jit_value_t* args, uint num_args, int flags) nothrow @nogc;
1150 * Manipulate types that represent objects and inline values.
1152 jit_type_t jitom_type_tag_as_class (jit_type_t type, jit_objmodel_t model, jitom_class_t klass, int incref) nothrow @nogc;
1153 jit_type_t jitom_type_tag_as_value (jit_type_t type, jit_objmodel_t model, jitom_class_t klass, int incref) nothrow @nogc;
1154 int jitom_type_is_class(jit_type_t type) nothrow @nogc;
1155 int jitom_type_is_value(jit_type_t type) nothrow @nogc;
1156 jit_objmodel_t jitom_type_get_model(jit_type_t type) nothrow @nogc;
1157 jitom_class_t jitom_type_get_class(jit_type_t type) nothrow @nogc;
1160 enum JIT_OP_NOP = 0x0000;
1161 enum JIT_OP_TRUNC_SBYTE = 0x0001;
1162 enum JIT_OP_TRUNC_UBYTE = 0x0002;
1163 enum JIT_OP_TRUNC_SHORT = 0x0003;
1164 enum JIT_OP_TRUNC_USHORT = 0x0004;
1165 enum JIT_OP_TRUNC_INT = 0x0005;
1166 enum JIT_OP_TRUNC_UINT = 0x0006;
1167 enum JIT_OP_CHECK_SBYTE = 0x0007;
1168 enum JIT_OP_CHECK_UBYTE = 0x0008;
1169 enum JIT_OP_CHECK_SHORT = 0x0009;
1170 enum JIT_OP_CHECK_USHORT = 0x000A;
1171 enum JIT_OP_CHECK_INT = 0x000B;
1172 enum JIT_OP_CHECK_UINT = 0x000C;
1173 enum JIT_OP_LOW_WORD = 0x000D;
1174 enum JIT_OP_EXPAND_INT = 0x000E;
1175 enum JIT_OP_EXPAND_UINT = 0x000F;
1176 enum JIT_OP_CHECK_LOW_WORD = 0x0010;
1177 enum JIT_OP_CHECK_SIGNED_LOW_WORD = 0x0011;
1178 enum JIT_OP_CHECK_LONG = 0x0012;
1179 enum JIT_OP_CHECK_ULONG = 0x0013;
1180 enum JIT_OP_FLOAT32_TO_INT = 0x0014;
1181 enum JIT_OP_FLOAT32_TO_UINT = 0x0015;
1182 enum JIT_OP_FLOAT32_TO_LONG = 0x0016;
1183 enum JIT_OP_FLOAT32_TO_ULONG = 0x0017;
1184 enum JIT_OP_CHECK_FLOAT32_TO_INT = 0x0018;
1185 enum JIT_OP_CHECK_FLOAT32_TO_UINT = 0x0019;
1186 enum JIT_OP_CHECK_FLOAT32_TO_LONG = 0x001A;
1187 enum JIT_OP_CHECK_FLOAT32_TO_ULONG = 0x001B;
1188 enum JIT_OP_INT_TO_FLOAT32 = 0x001C;
1189 enum JIT_OP_UINT_TO_FLOAT32 = 0x001D;
1190 enum JIT_OP_LONG_TO_FLOAT32 = 0x001E;
1191 enum JIT_OP_ULONG_TO_FLOAT32 = 0x001F;
1192 enum JIT_OP_FLOAT32_TO_FLOAT64 = 0x0020;
1193 enum JIT_OP_FLOAT64_TO_INT = 0x0021;
1194 enum JIT_OP_FLOAT64_TO_UINT = 0x0022;
1195 enum JIT_OP_FLOAT64_TO_LONG = 0x0023;
1196 enum JIT_OP_FLOAT64_TO_ULONG = 0x0024;
1197 enum JIT_OP_CHECK_FLOAT64_TO_INT = 0x0025;
1198 enum JIT_OP_CHECK_FLOAT64_TO_UINT = 0x0026;
1199 enum JIT_OP_CHECK_FLOAT64_TO_LONG = 0x0027;
1200 enum JIT_OP_CHECK_FLOAT64_TO_ULONG = 0x0028;
1201 enum JIT_OP_INT_TO_FLOAT64 = 0x0029;
1202 enum JIT_OP_UINT_TO_FLOAT64 = 0x002A;
1203 enum JIT_OP_LONG_TO_FLOAT64 = 0x002B;
1204 enum JIT_OP_ULONG_TO_FLOAT64 = 0x002C;
1205 enum JIT_OP_FLOAT64_TO_FLOAT32 = 0x002D;
1206 enum JIT_OP_NFLOAT_TO_INT = 0x002E;
1207 enum JIT_OP_NFLOAT_TO_UINT = 0x002F;
1208 enum JIT_OP_NFLOAT_TO_LONG = 0x0030;
1209 enum JIT_OP_NFLOAT_TO_ULONG = 0x0031;
1210 enum JIT_OP_CHECK_NFLOAT_TO_INT = 0x0032;
1211 enum JIT_OP_CHECK_NFLOAT_TO_UINT = 0x0033;
1212 enum JIT_OP_CHECK_NFLOAT_TO_LONG = 0x0034;
1213 enum JIT_OP_CHECK_NFLOAT_TO_ULONG = 0x0035;
1214 enum JIT_OP_INT_TO_NFLOAT = 0x0036;
1215 enum JIT_OP_UINT_TO_NFLOAT = 0x0037;
1216 enum JIT_OP_LONG_TO_NFLOAT = 0x0038;
1217 enum JIT_OP_ULONG_TO_NFLOAT = 0x0039;
1218 enum JIT_OP_NFLOAT_TO_FLOAT32 = 0x003A;
1219 enum JIT_OP_NFLOAT_TO_FLOAT64 = 0x003B;
1220 enum JIT_OP_FLOAT32_TO_NFLOAT = 0x003C;
1221 enum JIT_OP_FLOAT64_TO_NFLOAT = 0x003D;
1222 enum JIT_OP_IADD = 0x003E;
1223 enum JIT_OP_IADD_OVF = 0x003F;
1224 enum JIT_OP_IADD_OVF_UN = 0x0040;
1225 enum JIT_OP_ISUB = 0x0041;
1226 enum JIT_OP_ISUB_OVF = 0x0042;
1227 enum JIT_OP_ISUB_OVF_UN = 0x0043;
1228 enum JIT_OP_IMUL = 0x0044;
1229 enum JIT_OP_IMUL_OVF = 0x0045;
1230 enum JIT_OP_IMUL_OVF_UN = 0x0046;
1231 enum JIT_OP_IDIV = 0x0047;
1232 enum JIT_OP_IDIV_UN = 0x0048;
1233 enum JIT_OP_IREM = 0x0049;
1234 enum JIT_OP_IREM_UN = 0x004A;
1235 enum JIT_OP_INEG = 0x004B;
1236 enum JIT_OP_LADD = 0x004C;
1237 enum JIT_OP_LADD_OVF = 0x004D;
1238 enum JIT_OP_LADD_OVF_UN = 0x004E;
1239 enum JIT_OP_LSUB = 0x004F;
1240 enum JIT_OP_LSUB_OVF = 0x0050;
1241 enum JIT_OP_LSUB_OVF_UN = 0x0051;
1242 enum JIT_OP_LMUL = 0x0052;
1243 enum JIT_OP_LMUL_OVF = 0x0053;
1244 enum JIT_OP_LMUL_OVF_UN = 0x0054;
1245 enum JIT_OP_LDIV = 0x0055;
1246 enum JIT_OP_LDIV_UN = 0x0056;
1247 enum JIT_OP_LREM = 0x0057;
1248 enum JIT_OP_LREM_UN = 0x0058;
1249 enum JIT_OP_LNEG = 0x0059;
1250 enum JIT_OP_FADD = 0x005A;
1251 enum JIT_OP_FSUB = 0x005B;
1252 enum JIT_OP_FMUL = 0x005C;
1253 enum JIT_OP_FDIV = 0x005D;
1254 enum JIT_OP_FREM = 0x005E;
1255 enum JIT_OP_FREM_IEEE = 0x005F;
1256 enum JIT_OP_FNEG = 0x0060;
1257 enum JIT_OP_DADD = 0x0061;
1258 enum JIT_OP_DSUB = 0x0062;
1259 enum JIT_OP_DMUL = 0x0063;
1260 enum JIT_OP_DDIV = 0x0064;
1261 enum JIT_OP_DREM = 0x0065;
1262 enum JIT_OP_DREM_IEEE = 0x0066;
1263 enum JIT_OP_DNEG = 0x0067;
1264 enum JIT_OP_NFADD = 0x0068;
1265 enum JIT_OP_NFSUB = 0x0069;
1266 enum JIT_OP_NFMUL = 0x006A;
1267 enum JIT_OP_NFDIV = 0x006B;
1268 enum JIT_OP_NFREM = 0x006C;
1269 enum JIT_OP_NFREM_IEEE = 0x006D;
1270 enum JIT_OP_NFNEG = 0x006E;
1271 enum JIT_OP_IAND = 0x006F;
1272 enum JIT_OP_IOR = 0x0070;
1273 enum JIT_OP_IXOR = 0x0071;
1274 enum JIT_OP_INOT = 0x0072;
1275 enum JIT_OP_ISHL = 0x0073;
1276 enum JIT_OP_ISHR = 0x0074;
1277 enum JIT_OP_ISHR_UN = 0x0075;
1278 enum JIT_OP_LAND = 0x0076;
1279 enum JIT_OP_LOR = 0x0077;
1280 enum JIT_OP_LXOR = 0x0078;
1281 enum JIT_OP_LNOT = 0x0079;
1282 enum JIT_OP_LSHL = 0x007A;
1283 enum JIT_OP_LSHR = 0x007B;
1284 enum JIT_OP_LSHR_UN = 0x007C;
1285 enum JIT_OP_BR = 0x007D;
1286 enum JIT_OP_BR_IFALSE = 0x007E;
1287 enum JIT_OP_BR_ITRUE = 0x007F;
1288 enum JIT_OP_BR_IEQ = 0x0080;
1289 enum JIT_OP_BR_INE = 0x0081;
1290 enum JIT_OP_BR_ILT = 0x0082;
1291 enum JIT_OP_BR_ILT_UN = 0x0083;
1292 enum JIT_OP_BR_ILE = 0x0084;
1293 enum JIT_OP_BR_ILE_UN = 0x0085;
1294 enum JIT_OP_BR_IGT = 0x0086;
1295 enum JIT_OP_BR_IGT_UN = 0x0087;
1296 enum JIT_OP_BR_IGE = 0x0088;
1297 enum JIT_OP_BR_IGE_UN = 0x0089;
1298 enum JIT_OP_BR_LFALSE = 0x008A;
1299 enum JIT_OP_BR_LTRUE = 0x008B;
1300 enum JIT_OP_BR_LEQ = 0x008C;
1301 enum JIT_OP_BR_LNE = 0x008D;
1302 enum JIT_OP_BR_LLT = 0x008E;
1303 enum JIT_OP_BR_LLT_UN = 0x008F;
1304 enum JIT_OP_BR_LLE = 0x0090;
1305 enum JIT_OP_BR_LLE_UN = 0x0091;
1306 enum JIT_OP_BR_LGT = 0x0092;
1307 enum JIT_OP_BR_LGT_UN = 0x0093;
1308 enum JIT_OP_BR_LGE = 0x0094;
1309 enum JIT_OP_BR_LGE_UN = 0x0095;
1310 enum JIT_OP_BR_FEQ = 0x0096;
1311 enum JIT_OP_BR_FNE = 0x0097;
1312 enum JIT_OP_BR_FLT = 0x0098;
1313 enum JIT_OP_BR_FLE = 0x0099;
1314 enum JIT_OP_BR_FGT = 0x009A;
1315 enum JIT_OP_BR_FGE = 0x009B;
1316 enum JIT_OP_BR_FLT_INV = 0x009C;
1317 enum JIT_OP_BR_FLE_INV = 0x009D;
1318 enum JIT_OP_BR_FGT_INV = 0x009E;
1319 enum JIT_OP_BR_FGE_INV = 0x009F;
1320 enum JIT_OP_BR_DEQ = 0x00A0;
1321 enum JIT_OP_BR_DNE = 0x00A1;
1322 enum JIT_OP_BR_DLT = 0x00A2;
1323 enum JIT_OP_BR_DLE = 0x00A3;
1324 enum JIT_OP_BR_DGT = 0x00A4;
1325 enum JIT_OP_BR_DGE = 0x00A5;
1326 enum JIT_OP_BR_DLT_INV = 0x00A6;
1327 enum JIT_OP_BR_DLE_INV = 0x00A7;
1328 enum JIT_OP_BR_DGT_INV = 0x00A8;
1329 enum JIT_OP_BR_DGE_INV = 0x00A9;
1330 enum JIT_OP_BR_NFEQ = 0x00AA;
1331 enum JIT_OP_BR_NFNE = 0x00AB;
1332 enum JIT_OP_BR_NFLT = 0x00AC;
1333 enum JIT_OP_BR_NFLE = 0x00AD;
1334 enum JIT_OP_BR_NFGT = 0x00AE;
1335 enum JIT_OP_BR_NFGE = 0x00AF;
1336 enum JIT_OP_BR_NFLT_INV = 0x00B0;
1337 enum JIT_OP_BR_NFLE_INV = 0x00B1;
1338 enum JIT_OP_BR_NFGT_INV = 0x00B2;
1339 enum JIT_OP_BR_NFGE_INV = 0x00B3;
1340 enum JIT_OP_ICMP = 0x00B4;
1341 enum JIT_OP_ICMP_UN = 0x00B5;
1342 enum JIT_OP_LCMP = 0x00B6;
1343 enum JIT_OP_LCMP_UN = 0x00B7;
1344 enum JIT_OP_FCMPL = 0x00B8;
1345 enum JIT_OP_FCMPG = 0x00B9;
1346 enum JIT_OP_DCMPL = 0x00BA;
1347 enum JIT_OP_DCMPG = 0x00BB;
1348 enum JIT_OP_NFCMPL = 0x00BC;
1349 enum JIT_OP_NFCMPG = 0x00BD;
1350 enum JIT_OP_IEQ = 0x00BE;
1351 enum JIT_OP_INE = 0x00BF;
1352 enum JIT_OP_ILT = 0x00C0;
1353 enum JIT_OP_ILT_UN = 0x00C1;
1354 enum JIT_OP_ILE = 0x00C2;
1355 enum JIT_OP_ILE_UN = 0x00C3;
1356 enum JIT_OP_IGT = 0x00C4;
1357 enum JIT_OP_IGT_UN = 0x00C5;
1358 enum JIT_OP_IGE = 0x00C6;
1359 enum JIT_OP_IGE_UN = 0x00C7;
1360 enum JIT_OP_LEQ = 0x00C8;
1361 enum JIT_OP_LNE = 0x00C9;
1362 enum JIT_OP_LLT = 0x00CA;
1363 enum JIT_OP_LLT_UN = 0x00CB;
1364 enum JIT_OP_LLE = 0x00CC;
1365 enum JIT_OP_LLE_UN = 0x00CD;
1366 enum JIT_OP_LGT = 0x00CE;
1367 enum JIT_OP_LGT_UN = 0x00CF;
1368 enum JIT_OP_LGE = 0x00D0;
1369 enum JIT_OP_LGE_UN = 0x00D1;
1370 enum JIT_OP_FEQ = 0x00D2;
1371 enum JIT_OP_FNE = 0x00D3;
1372 enum JIT_OP_FLT = 0x00D4;
1373 enum JIT_OP_FLE = 0x00D5;
1374 enum JIT_OP_FGT = 0x00D6;
1375 enum JIT_OP_FGE = 0x00D7;
1376 enum JIT_OP_FLT_INV = 0x00D8;
1377 enum JIT_OP_FLE_INV = 0x00D9;
1378 enum JIT_OP_FGT_INV = 0x00DA;
1379 enum JIT_OP_FGE_INV = 0x00DB;
1380 enum JIT_OP_DEQ = 0x00DC;
1381 enum JIT_OP_DNE = 0x00DD;
1382 enum JIT_OP_DLT = 0x00DE;
1383 enum JIT_OP_DLE = 0x00DF;
1384 enum JIT_OP_DGT = 0x00E0;
1385 enum JIT_OP_DGE = 0x00E1;
1386 enum JIT_OP_DLT_INV = 0x00E2;
1387 enum JIT_OP_DLE_INV = 0x00E3;
1388 enum JIT_OP_DGT_INV = 0x00E4;
1389 enum JIT_OP_DGE_INV = 0x00E5;
1390 enum JIT_OP_NFEQ = 0x00E6;
1391 enum JIT_OP_NFNE = 0x00E7;
1392 enum JIT_OP_NFLT = 0x00E8;
1393 enum JIT_OP_NFLE = 0x00E9;
1394 enum JIT_OP_NFGT = 0x00EA;
1395 enum JIT_OP_NFGE = 0x00EB;
1396 enum JIT_OP_NFLT_INV = 0x00EC;
1397 enum JIT_OP_NFLE_INV = 0x00ED;
1398 enum JIT_OP_NFGT_INV = 0x00EE;
1399 enum JIT_OP_NFGE_INV = 0x00EF;
1400 enum JIT_OP_IS_FNAN = 0x00F0;
1401 enum JIT_OP_IS_FINF = 0x00F1;
1402 enum JIT_OP_IS_FFINITE = 0x00F2;
1403 enum JIT_OP_IS_DNAN = 0x00F3;
1404 enum JIT_OP_IS_DINF = 0x00F4;
1405 enum JIT_OP_IS_DFINITE = 0x00F5;
1406 enum JIT_OP_IS_NFNAN = 0x00F6;
1407 enum JIT_OP_IS_NFINF = 0x00F7;
1408 enum JIT_OP_IS_NFFINITE = 0x00F8;
1409 enum JIT_OP_FACOS = 0x00F9;
1410 enum JIT_OP_FASIN = 0x00FA;
1411 enum JIT_OP_FATAN = 0x00FB;
1412 enum JIT_OP_FATAN2 = 0x00FC;
1413 enum JIT_OP_FCEIL = 0x00FD;
1414 enum JIT_OP_FCOS = 0x00FE;
1415 enum JIT_OP_FCOSH = 0x00FF;
1416 enum JIT_OP_FEXP = 0x0100;
1417 enum JIT_OP_FFLOOR = 0x0101;
1418 enum JIT_OP_FLOG = 0x0102;
1419 enum JIT_OP_FLOG10 = 0x0103;
1420 enum JIT_OP_FPOW = 0x0104;
1421 enum JIT_OP_FRINT = 0x0105;
1422 enum JIT_OP_FROUND = 0x0106;
1423 enum JIT_OP_FSIN = 0x0107;
1424 enum JIT_OP_FSINH = 0x0108;
1425 enum JIT_OP_FSQRT = 0x0109;
1426 enum JIT_OP_FTAN = 0x010A;
1427 enum JIT_OP_FTANH = 0x010B;
1428 enum JIT_OP_FTRUNC = 0x010C;
1429 enum JIT_OP_DACOS = 0x010D;
1430 enum JIT_OP_DASIN = 0x010E;
1431 enum JIT_OP_DATAN = 0x010F;
1432 enum JIT_OP_DATAN2 = 0x0110;
1433 enum JIT_OP_DCEIL = 0x0111;
1434 enum JIT_OP_DCOS = 0x0112;
1435 enum JIT_OP_DCOSH = 0x0113;
1436 enum JIT_OP_DEXP = 0x0114;
1437 enum JIT_OP_DFLOOR = 0x0115;
1438 enum JIT_OP_DLOG = 0x0116;
1439 enum JIT_OP_DLOG10 = 0x0117;
1440 enum JIT_OP_DPOW = 0x0118;
1441 enum JIT_OP_DRINT = 0x0119;
1442 enum JIT_OP_DROUND = 0x011A;
1443 enum JIT_OP_DSIN = 0x011B;
1444 enum JIT_OP_DSINH = 0x011C;
1445 enum JIT_OP_DSQRT = 0x011D;
1446 enum JIT_OP_DTAN = 0x011E;
1447 enum JIT_OP_DTANH = 0x011F;
1448 enum JIT_OP_DTRUNC = 0x0120;
1449 enum JIT_OP_NFACOS = 0x0121;
1450 enum JIT_OP_NFASIN = 0x0122;
1451 enum JIT_OP_NFATAN = 0x0123;
1452 enum JIT_OP_NFATAN2 = 0x0124;
1453 enum JIT_OP_NFCEIL = 0x0125;
1454 enum JIT_OP_NFCOS = 0x0126;
1455 enum JIT_OP_NFCOSH = 0x0127;
1456 enum JIT_OP_NFEXP = 0x0128;
1457 enum JIT_OP_NFFLOOR = 0x0129;
1458 enum JIT_OP_NFLOG = 0x012A;
1459 enum JIT_OP_NFLOG10 = 0x012B;
1460 enum JIT_OP_NFPOW = 0x012C;
1461 enum JIT_OP_NFRINT = 0x012D;
1462 enum JIT_OP_NFROUND = 0x012E;
1463 enum JIT_OP_NFSIN = 0x012F;
1464 enum JIT_OP_NFSINH = 0x0130;
1465 enum JIT_OP_NFSQRT = 0x0131;
1466 enum JIT_OP_NFTAN = 0x0132;
1467 enum JIT_OP_NFTANH = 0x0133;
1468 enum JIT_OP_NFTRUNC = 0x0134;
1469 enum JIT_OP_IABS = 0x0135;
1470 enum JIT_OP_LABS = 0x0136;
1471 enum JIT_OP_FABS = 0x0137;
1472 enum JIT_OP_DABS = 0x0138;
1473 enum JIT_OP_NFABS = 0x0139;
1474 enum JIT_OP_IMIN = 0x013A;
1475 enum JIT_OP_IMIN_UN = 0x013B;
1476 enum JIT_OP_LMIN = 0x013C;
1477 enum JIT_OP_LMIN_UN = 0x013D;
1478 enum JIT_OP_FMIN = 0x013E;
1479 enum JIT_OP_DMIN = 0x013F;
1480 enum JIT_OP_NFMIN = 0x0140;
1481 enum JIT_OP_IMAX = 0x0141;
1482 enum JIT_OP_IMAX_UN = 0x0142;
1483 enum JIT_OP_LMAX = 0x0143;
1484 enum JIT_OP_LMAX_UN = 0x0144;
1485 enum JIT_OP_FMAX = 0x0145;
1486 enum JIT_OP_DMAX = 0x0146;
1487 enum JIT_OP_NFMAX = 0x0147;
1488 enum JIT_OP_ISIGN = 0x0148;
1489 enum JIT_OP_LSIGN = 0x0149;
1490 enum JIT_OP_FSIGN = 0x014A;
1491 enum JIT_OP_DSIGN = 0x014B;
1492 enum JIT_OP_NFSIGN = 0x014C;
1493 enum JIT_OP_CHECK_NULL = 0x014D;
1494 enum JIT_OP_CALL = 0x014E;
1495 enum JIT_OP_CALL_TAIL = 0x014F;
1496 enum JIT_OP_CALL_INDIRECT = 0x0150;
1497 enum JIT_OP_CALL_INDIRECT_TAIL = 0x0151;
1498 enum JIT_OP_CALL_VTABLE_PTR = 0x0152;
1499 enum JIT_OP_CALL_VTABLE_PTR_TAIL = 0x0153;
1500 enum JIT_OP_CALL_EXTERNAL = 0x0154;
1501 enum JIT_OP_CALL_EXTERNAL_TAIL = 0x0155;
1502 enum JIT_OP_RETURN = 0x0156;
1503 enum JIT_OP_RETURN_INT = 0x0157;
1504 enum JIT_OP_RETURN_LONG = 0x0158;
1505 enum JIT_OP_RETURN_FLOAT32 = 0x0159;
1506 enum JIT_OP_RETURN_FLOAT64 = 0x015A;
1507 enum JIT_OP_RETURN_NFLOAT = 0x015B;
1508 enum JIT_OP_RETURN_SMALL_STRUCT = 0x015C;
1509 enum JIT_OP_SETUP_FOR_NESTED = 0x015D;
1510 enum JIT_OP_SETUP_FOR_SIBLING = 0x015E;
1511 enum JIT_OP_IMPORT = 0x015F;
1512 enum JIT_OP_THROW = 0x0160;
1513 enum JIT_OP_RETHROW = 0x0161;
1514 enum JIT_OP_LOAD_PC = 0x0162;
1515 enum JIT_OP_LOAD_EXCEPTION_PC = 0x0163;
1516 enum JIT_OP_ENTER_FINALLY = 0x0164;
1517 enum JIT_OP_LEAVE_FINALLY = 0x0165;
1518 enum JIT_OP_CALL_FINALLY = 0x0166;
1519 enum JIT_OP_ENTER_FILTER = 0x0167;
1520 enum JIT_OP_LEAVE_FILTER = 0x0168;
1521 enum JIT_OP_CALL_FILTER = 0x0169;
1522 enum JIT_OP_CALL_FILTER_RETURN = 0x016A;
1523 enum JIT_OP_ADDRESS_OF_LABEL = 0x016B;
1524 enum JIT_OP_COPY_LOAD_SBYTE = 0x016C;
1525 enum JIT_OP_COPY_LOAD_UBYTE = 0x016D;
1526 enum JIT_OP_COPY_LOAD_SHORT = 0x016E;
1527 enum JIT_OP_COPY_LOAD_USHORT = 0x016F;
1528 enum JIT_OP_COPY_INT = 0x0170;
1529 enum JIT_OP_COPY_LONG = 0x0171;
1530 enum JIT_OP_COPY_FLOAT32 = 0x0172;
1531 enum JIT_OP_COPY_FLOAT64 = 0x0173;
1532 enum JIT_OP_COPY_NFLOAT = 0x0174;
1533 enum JIT_OP_COPY_STRUCT = 0x0175;
1534 enum JIT_OP_COPY_STORE_BYTE = 0x0176;
1535 enum JIT_OP_COPY_STORE_SHORT = 0x0177;
1536 enum JIT_OP_ADDRESS_OF = 0x0178;
1537 enum JIT_OP_INCOMING_REG = 0x0179;
1538 enum JIT_OP_INCOMING_FRAME_POSN = 0x017A;
1539 enum JIT_OP_OUTGOING_REG = 0x017B;
1540 enum JIT_OP_OUTGOING_FRAME_POSN = 0x017C;
1541 enum JIT_OP_RETURN_REG = 0x017D;
1542 enum JIT_OP_PUSH_INT = 0x017E;
1543 enum JIT_OP_PUSH_LONG = 0x017F;
1544 enum JIT_OP_PUSH_FLOAT32 = 0x0180;
1545 enum JIT_OP_PUSH_FLOAT64 = 0x0181;
1546 enum JIT_OP_PUSH_NFLOAT = 0x0182;
1547 enum JIT_OP_PUSH_STRUCT = 0x0183;
1548 enum JIT_OP_POP_STACK = 0x0184;
1549 enum JIT_OP_FLUSH_SMALL_STRUCT = 0x0185;
1550 enum JIT_OP_SET_PARAM_INT = 0x0186;
1551 enum JIT_OP_SET_PARAM_LONG = 0x0187;
1552 enum JIT_OP_SET_PARAM_FLOAT32 = 0x0188;
1553 enum JIT_OP_SET_PARAM_FLOAT64 = 0x0189;
1554 enum JIT_OP_SET_PARAM_NFLOAT = 0x018A;
1555 enum JIT_OP_SET_PARAM_STRUCT = 0x018B;
1556 enum JIT_OP_PUSH_RETURN_AREA_PTR = 0x018C;
1557 enum JIT_OP_LOAD_RELATIVE_SBYTE = 0x018D;
1558 enum JIT_OP_LOAD_RELATIVE_UBYTE = 0x018E;
1559 enum JIT_OP_LOAD_RELATIVE_SHORT = 0x018F;
1560 enum JIT_OP_LOAD_RELATIVE_USHORT = 0x0190;
1561 enum JIT_OP_LOAD_RELATIVE_INT = 0x0191;
1562 enum JIT_OP_LOAD_RELATIVE_LONG = 0x0192;
1563 enum JIT_OP_LOAD_RELATIVE_FLOAT32 = 0x0193;
1564 enum JIT_OP_LOAD_RELATIVE_FLOAT64 = 0x0194;
1565 enum JIT_OP_LOAD_RELATIVE_NFLOAT = 0x0195;
1566 enum JIT_OP_LOAD_RELATIVE_STRUCT = 0x0196;
1567 enum JIT_OP_STORE_RELATIVE_BYTE = 0x0197;
1568 enum JIT_OP_STORE_RELATIVE_SHORT = 0x0198;
1569 enum JIT_OP_STORE_RELATIVE_INT = 0x0199;
1570 enum JIT_OP_STORE_RELATIVE_LONG = 0x019A;
1571 enum JIT_OP_STORE_RELATIVE_FLOAT32 = 0x019B;
1572 enum JIT_OP_STORE_RELATIVE_FLOAT64 = 0x019C;
1573 enum JIT_OP_STORE_RELATIVE_NFLOAT = 0x019D;
1574 enum JIT_OP_STORE_RELATIVE_STRUCT = 0x019E;
1575 enum JIT_OP_ADD_RELATIVE = 0x019F;
1576 enum JIT_OP_LOAD_ELEMENT_SBYTE = 0x01A0;
1577 enum JIT_OP_LOAD_ELEMENT_UBYTE = 0x01A1;
1578 enum JIT_OP_LOAD_ELEMENT_SHORT = 0x01A2;
1579 enum JIT_OP_LOAD_ELEMENT_USHORT = 0x01A3;
1580 enum JIT_OP_LOAD_ELEMENT_INT = 0x01A4;
1581 enum JIT_OP_LOAD_ELEMENT_LONG = 0x01A5;
1582 enum JIT_OP_LOAD_ELEMENT_FLOAT32 = 0x01A6;
1583 enum JIT_OP_LOAD_ELEMENT_FLOAT64 = 0x01A7;
1584 enum JIT_OP_LOAD_ELEMENT_NFLOAT = 0x01A8;
1585 enum JIT_OP_STORE_ELEMENT_BYTE = 0x01A9;
1586 enum JIT_OP_STORE_ELEMENT_SHORT = 0x01AA;
1587 enum JIT_OP_STORE_ELEMENT_INT = 0x01AB;
1588 enum JIT_OP_STORE_ELEMENT_LONG = 0x01AC;
1589 enum JIT_OP_STORE_ELEMENT_FLOAT32 = 0x01AD;
1590 enum JIT_OP_STORE_ELEMENT_FLOAT64 = 0x01AE;
1591 enum JIT_OP_STORE_ELEMENT_NFLOAT = 0x01AF;
1592 enum JIT_OP_MEMCPY = 0x01B0;
1593 enum JIT_OP_MEMMOVE = 0x01B1;
1594 enum JIT_OP_MEMSET = 0x01B2;
1595 enum JIT_OP_ALLOCA = 0x01B3;
1596 enum JIT_OP_MARK_OFFSET = 0x01B4;
1597 enum JIT_OP_MARK_BREAKPOINT = 0x01B5;
1598 enum JIT_OP_JUMP_TABLE = 0x01B6;
1599 enum JIT_OP_NUM_OPCODES = 0x01B7;
1602 * Opcode information.
1604 alias jit_opcode_info_t = jit_opcode_info;
1605 struct jit_opcode_info {
1606 const(char)* name;
1607 int flags;
1609 enum JIT_OPCODE_DEST_MASK = 0x0000000F;
1610 enum JIT_OPCODE_DEST_EMPTY = 0x00000000;
1611 enum JIT_OPCODE_DEST_INT = 0x00000001;
1612 enum JIT_OPCODE_DEST_LONG = 0x00000002;
1613 enum JIT_OPCODE_DEST_FLOAT32 = 0x00000003;
1614 enum JIT_OPCODE_DEST_FLOAT64 = 0x00000004;
1615 enum JIT_OPCODE_DEST_NFLOAT = 0x00000005;
1616 enum JIT_OPCODE_DEST_ANY = 0x00000006;
1617 enum JIT_OPCODE_SRC1_MASK = 0x000000F0;
1618 enum JIT_OPCODE_SRC1_EMPTY = 0x00000000;
1619 enum JIT_OPCODE_SRC1_INT = 0x00000010;
1620 enum JIT_OPCODE_SRC1_LONG = 0x00000020;
1621 enum JIT_OPCODE_SRC1_FLOAT32 = 0x00000030;
1622 enum JIT_OPCODE_SRC1_FLOAT64 = 0x00000040;
1623 enum JIT_OPCODE_SRC1_NFLOAT = 0x00000050;
1624 enum JIT_OPCODE_SRC1_ANY = 0x00000060;
1625 enum JIT_OPCODE_SRC2_MASK = 0x00000F00;
1626 enum JIT_OPCODE_SRC2_EMPTY = 0x00000000;
1627 enum JIT_OPCODE_SRC2_INT = 0x00000100;
1628 enum JIT_OPCODE_SRC2_LONG = 0x00000200;
1629 enum JIT_OPCODE_SRC2_FLOAT32 = 0x00000300;
1630 enum JIT_OPCODE_SRC2_FLOAT64 = 0x00000400;
1631 enum JIT_OPCODE_SRC2_NFLOAT = 0x00000500;
1632 enum JIT_OPCODE_SRC2_ANY = 0x00000600;
1633 enum JIT_OPCODE_IS_BRANCH = 0x00001000;
1634 enum JIT_OPCODE_IS_CALL = 0x00002000;
1635 enum JIT_OPCODE_IS_CALL_EXTERNAL = 0x00004000;
1636 enum JIT_OPCODE_IS_REG = 0x00008000;
1637 enum JIT_OPCODE_IS_ADDROF_LABEL = 0x00010000;
1638 enum JIT_OPCODE_IS_JUMP_TABLE = 0x00020000;
1639 enum JIT_OPCODE_OPER_MASK = 0x01F00000;
1640 enum JIT_OPCODE_OPER_NONE = 0x00000000;
1641 enum JIT_OPCODE_OPER_ADD = 0x00100000;
1642 enum JIT_OPCODE_OPER_SUB = 0x00200000;
1643 enum JIT_OPCODE_OPER_MUL = 0x00300000;
1644 enum JIT_OPCODE_OPER_DIV = 0x00400000;
1645 enum JIT_OPCODE_OPER_REM = 0x00500000;
1646 enum JIT_OPCODE_OPER_NEG = 0x00600000;
1647 enum JIT_OPCODE_OPER_AND = 0x00700000;
1648 enum JIT_OPCODE_OPER_OR = 0x00800000;
1649 enum JIT_OPCODE_OPER_XOR = 0x00900000;
1650 enum JIT_OPCODE_OPER_NOT = 0x00A00000;
1651 enum JIT_OPCODE_OPER_EQ = 0x00B00000;
1652 enum JIT_OPCODE_OPER_NE = 0x00C00000;
1653 enum JIT_OPCODE_OPER_LT = 0x00D00000;
1654 enum JIT_OPCODE_OPER_LE = 0x00E00000;
1655 enum JIT_OPCODE_OPER_GT = 0x00F00000;
1656 enum JIT_OPCODE_OPER_GE = 0x01000000;
1657 enum JIT_OPCODE_OPER_SHL = 0x01100000;
1658 enum JIT_OPCODE_OPER_SHR = 0x01200000;
1659 enum JIT_OPCODE_OPER_SHR_UN = 0x01300000;
1660 enum JIT_OPCODE_OPER_COPY = 0x01400000;
1661 enum JIT_OPCODE_OPER_ADDRESS_OF = 0x01500000;
1662 static if (JIT_NATIVE_INT32) {
1663 enum JIT_OPCODE_DEST_PTR = JIT_OPCODE_DEST_INT;
1664 enum JIT_OPCODE_SRC1_PTR = JIT_OPCODE_SRC1_INT;
1665 enum JIT_OPCODE_SRC2_PTR = JIT_OPCODE_SRC2_INT;
1666 } else {
1667 enum JIT_OPCODE_DEST_PTR = JIT_OPCODE_DEST_LONG;
1668 enum JIT_OPCODE_SRC1_PTR = JIT_OPCODE_SRC1_LONG;
1669 enum JIT_OPCODE_SRC2_PTR = JIT_OPCODE_SRC2_LONG;
1671 extern __gshared const jit_opcode_info_t[JIT_OP_NUM_OPCODES] jit_opcodes;
1675 * Some obsolete opcodes that have been removed because they are duplicates
1676 * of other opcodes.
1678 enum JIT_OP_FEQ_INV = JIT_OP_FEQ;
1679 enum JIT_OP_FNE_INV = JIT_OP_FNE;
1680 enum JIT_OP_DEQ_INV = JIT_OP_DEQ;
1681 enum JIT_OP_DNE_INV = JIT_OP_DNE;
1682 enum JIT_OP_NFEQ_INV = JIT_OP_NFEQ;
1683 enum JIT_OP_NFNE_INV = JIT_OP_NFNE;
1684 enum JIT_OP_BR_FEQ_INV = JIT_OP_BR_FEQ;
1685 enum JIT_OP_BR_FNE_INV = JIT_OP_BR_FNE;
1686 enum JIT_OP_BR_DEQ_INV = JIT_OP_BR_DEQ;
1687 enum JIT_OP_BR_DNE_INV = JIT_OP_BR_DNE;
1688 enum JIT_OP_BR_NFEQ_INV = JIT_OP_BR_NFEQ;
1689 enum JIT_OP_BR_NFNE_INV = JIT_OP_BR_NFNE;
1693 * Pre-defined type descriptors.
1695 extern __gshared /*const*/ jit_type_t jit_type_void;
1696 extern __gshared /*const*/ jit_type_t jit_type_sbyte;
1697 extern __gshared /*const*/ jit_type_t jit_type_ubyte;
1698 extern __gshared /*const*/ jit_type_t jit_type_short;
1699 extern __gshared /*const*/ jit_type_t jit_type_ushort;
1700 extern __gshared /*const*/ jit_type_t jit_type_int;
1701 extern __gshared /*const*/ jit_type_t jit_type_uint;
1702 extern __gshared /*const*/ jit_type_t jit_type_nint;
1703 extern __gshared /*const*/ jit_type_t jit_type_nuint;
1704 extern __gshared /*const*/ jit_type_t jit_type_long;
1705 extern __gshared /*const*/ jit_type_t jit_type_ulong;
1706 extern __gshared /*const*/ jit_type_t jit_type_float32;
1707 extern __gshared /*const*/ jit_type_t jit_type_float64;
1708 extern __gshared /*const*/ jit_type_t jit_type_nfloat;
1709 extern __gshared /*const*/ jit_type_t jit_type_void_ptr;
1712 * Type descriptors for the system "char", "int", "long", etc types.
1713 * These are defined to one of the above values.
1715 extern __gshared /*const*/ jit_type_t jit_type_sys_bool;
1716 extern __gshared /*const*/ jit_type_t jit_type_sys_char;
1717 extern __gshared /*const*/ jit_type_t jit_type_sys_schar;
1718 extern __gshared /*const*/ jit_type_t jit_type_sys_uchar;
1719 extern __gshared /*const*/ jit_type_t jit_type_sys_short;
1720 extern __gshared /*const*/ jit_type_t jit_type_sys_ushort;
1721 extern __gshared /*const*/ jit_type_t jit_type_sys_int;
1722 extern __gshared /*const*/ jit_type_t jit_type_sys_uint;
1723 extern __gshared /*const*/ jit_type_t jit_type_sys_long;
1724 extern __gshared /*const*/ jit_type_t jit_type_sys_ulong;
1725 extern __gshared /*const*/ jit_type_t jit_type_sys_longlong;
1726 extern __gshared /*const*/ jit_type_t jit_type_sys_ulonglong;
1727 extern __gshared /*const*/ jit_type_t jit_type_sys_float;
1728 extern __gshared /*const*/ jit_type_t jit_type_sys_double;
1729 extern __gshared /*const*/ jit_type_t jit_type_sys_long_double;
1732 * Type kinds that may be returned by "jit_type_get_kind".
1734 enum JIT_TYPE_INVALID = -1;
1735 enum JIT_TYPE_VOID = 0;
1736 enum JIT_TYPE_SBYTE = 1;
1737 enum JIT_TYPE_UBYTE = 2;
1738 enum JIT_TYPE_SHORT = 3;
1739 enum JIT_TYPE_USHORT = 4;
1740 enum JIT_TYPE_INT = 5;
1741 enum JIT_TYPE_UINT = 6;
1742 enum JIT_TYPE_NINT = 7;
1743 enum JIT_TYPE_NUINT = 8;
1744 enum JIT_TYPE_LONG = 9;
1745 enum JIT_TYPE_ULONG = 10;
1746 enum JIT_TYPE_FLOAT32 = 11;
1747 enum JIT_TYPE_FLOAT64 = 12;
1748 enum JIT_TYPE_NFLOAT = 13;
1749 enum JIT_TYPE_MAX_PRIMITIVE = JIT_TYPE_NFLOAT;
1750 enum JIT_TYPE_STRUCT = 14;
1751 enum JIT_TYPE_UNION = 15;
1752 enum JIT_TYPE_SIGNATURE = 16;
1753 enum JIT_TYPE_PTR = 17;
1754 enum JIT_TYPE_FIRST_TAGGED = 32;
1757 * Special tag types.
1759 enum JIT_TYPETAG_NAME = 10000;
1760 enum JIT_TYPETAG_STRUCT_NAME = 10001;
1761 enum JIT_TYPETAG_UNION_NAME = 10002;
1762 enum JIT_TYPETAG_ENUM_NAME = 10003;
1763 enum JIT_TYPETAG_CONST = 10004;
1764 enum JIT_TYPETAG_VOLATILE = 10005;
1765 enum JIT_TYPETAG_REFERENCE = 10006;
1766 enum JIT_TYPETAG_OUTPUT = 10007;
1767 enum JIT_TYPETAG_RESTRICT = 10008;
1768 enum JIT_TYPETAG_SYS_BOOL = 10009;
1769 enum JIT_TYPETAG_SYS_CHAR = 10010;
1770 enum JIT_TYPETAG_SYS_SCHAR = 10011;
1771 enum JIT_TYPETAG_SYS_UCHAR = 10012;
1772 enum JIT_TYPETAG_SYS_SHORT = 10013;
1773 enum JIT_TYPETAG_SYS_USHORT = 10014;
1774 enum JIT_TYPETAG_SYS_INT = 10015;
1775 enum JIT_TYPETAG_SYS_UINT = 10016;
1776 enum JIT_TYPETAG_SYS_LONG = 10017;
1777 enum JIT_TYPETAG_SYS_ULONG = 10018;
1778 enum JIT_TYPETAG_SYS_LONGLONG = 10019;
1779 enum JIT_TYPETAG_SYS_ULONGLONG = 10020;
1780 enum JIT_TYPETAG_SYS_FLOAT = 10021;
1781 enum JIT_TYPETAG_SYS_DOUBLE = 10022;
1782 enum JIT_TYPETAG_SYS_LONGDOUBLE = 10023;
1785 * ABI types for function signatures.
1787 alias jit_abi_t = uint;
1788 enum : uint /*jit_abi_t*/ {
1789 jit_abi_cdecl, /* Native C calling conventions */
1790 jit_abi_vararg, /* Native C with optional variable arguments */
1791 jit_abi_stdcall, /* Win32 STDCALL (same as cdecl if not Win32) */
1792 jit_abi_fastcall, /* Win32 FASTCALL (same as cdecl if not Win32) */
1796 * External function declarations.
1798 jit_type_t jit_type_copy (jit_type_t type) nothrow @nogc;
1799 void jit_type_free (jit_type_t type) nothrow @nogc;
1800 jit_type_t jit_type_create_struct (jit_type_t* fields, uint num_fields, int incref) nothrow @nogc;
1801 jit_type_t jit_type_create_union (jit_type_t* fields, uint num_fields, int incref) nothrow @nogc;
1802 jit_type_t jit_type_create_signature (jit_abi_t abi, jit_type_t return_type, jit_type_t* params, uint num_params, int incref) nothrow @nogc;
1803 jit_type_t jit_type_create_pointer (jit_type_t type, int incref) nothrow @nogc;
1804 jit_type_t jit_type_create_tagged (jit_type_t type, int kind, void* data, jit_meta_free_func free_func, int incref) nothrow @nogc;
1805 int jit_type_set_names (jit_type_t type, char** names, uint num_names) nothrow @nogc;
1806 void jit_type_set_size_and_alignment (jit_type_t type, jit_nint size, jit_nint alignment) nothrow @nogc;
1807 void jit_type_set_offset (jit_type_t type, uint field_index, jit_nuint offset) nothrow @nogc;
1808 int jit_type_get_kind (jit_type_t type) nothrow @nogc;
1809 jit_nuint jit_type_get_size (jit_type_t type) nothrow @nogc;
1810 jit_nuint jit_type_get_alignment (jit_type_t type) nothrow @nogc;
1811 uint jit_type_num_fields (jit_type_t type) nothrow @nogc;
1812 jit_type_t jit_type_get_field (jit_type_t type, uint field_index) nothrow @nogc;
1813 jit_nuint jit_type_get_offset (jit_type_t type, uint field_index) nothrow @nogc;
1814 const(char)* jit_type_get_name (jit_type_t type, uint index) nothrow @nogc;
1815 enum JIT_INVALID_NAME = (~(cast(uint)0));
1816 uint jit_type_find_name (jit_type_t type, const(char)* name) nothrow @nogc;
1817 uint jit_type_num_params (jit_type_t type) nothrow @nogc;
1818 jit_type_t jit_type_get_return (jit_type_t type) nothrow @nogc;
1819 jit_type_t jit_type_get_param (jit_type_t type, uint param_index) nothrow @nogc;
1820 jit_abi_t jit_type_get_abi (jit_type_t type) nothrow @nogc;
1821 jit_type_t jit_type_get_ref (jit_type_t type) nothrow @nogc;
1822 jit_type_t jit_type_get_tagged_type (jit_type_t type) nothrow @nogc;
1823 void jit_type_set_tagged_type (jit_type_t type, jit_type_t underlying, int incref) nothrow @nogc;
1824 int jit_type_get_tagged_kind (jit_type_t type) nothrow @nogc;
1825 void* jit_type_get_tagged_data (jit_type_t type) nothrow @nogc;
1826 void jit_type_set_tagged_data (jit_type_t type, void* data, jit_meta_free_func free_func) nothrow @nogc;
1827 int jit_type_is_primitive (jit_type_t type) nothrow @nogc;
1828 int jit_type_is_struct (jit_type_t type) nothrow @nogc;
1829 int jit_type_is_union (jit_type_t type) nothrow @nogc;
1830 int jit_type_is_signature (jit_type_t type) nothrow @nogc;
1831 int jit_type_is_pointer (jit_type_t type) nothrow @nogc;
1832 int jit_type_is_tagged (jit_type_t type) nothrow @nogc;
1833 jit_nuint jit_type_best_alignment () nothrow @nogc;
1834 jit_type_t jit_type_normalize (jit_type_t type) nothrow @nogc;
1835 jit_type_t jit_type_remove_tags (jit_type_t type) nothrow @nogc;
1836 jit_type_t jit_type_promote_int (jit_type_t type) nothrow @nogc;
1837 int jit_type_return_via_pointer (jit_type_t type) nothrow @nogc;
1838 int jit_type_has_tag (jit_type_t type, int kind) nothrow @nogc;
1841 struct jit_unwind_context_t {
1842 void* frame;
1843 void* cache;
1844 jit_context_t context;
1845 /+k8: it doesn't included in x86/x86_65/arm/generic
1846 #ifdef _JIT_ARCH_UNWIND_DATA
1847 _JIT_ARCH_UNWIND_DATA
1848 #endif
1852 //k8: does the following really `nothrow`?
1853 int jit_unwind_init (jit_unwind_context_t* unwind, jit_context_t context) nothrow @nogc;
1854 void jit_unwind_free (jit_unwind_context_t* unwind) nothrow @nogc;
1856 int jit_unwind_next (jit_unwind_context_t* unwind) nothrow @nogc;
1857 int jit_unwind_next_pc (jit_unwind_context_t* unwind) nothrow @nogc;
1858 void* jit_unwind_get_pc (jit_unwind_context_t* unwind) nothrow @nogc;
1860 int jit_unwind_jump (jit_unwind_context_t* unwind, void* pc) nothrow @nogc;
1862 jit_function_t jit_unwind_get_function (jit_unwind_context_t* unwind) nothrow @nogc;
1863 uint jit_unwind_get_offset (jit_unwind_context_t* unwind) nothrow @nogc;
1867 * Memory allocation routines.
1869 void* jit_malloc (uint size) nothrow @nogc;
1870 void* jit_calloc (uint num, uint size) nothrow @nogc;
1871 void* jit_realloc (void* ptr, uint size) nothrow @nogc;
1872 void jit_free (void* ptr) nothrow @nogc;
1875 #define jit_new(type) ((type *)jit_malloc(sizeof(type)))
1876 #define jit_cnew(type) ((type *)jit_calloc(1, sizeof(type)))
1878 auto jit_new(T) () { return cast(T*)jit_malloc(T.sizeof); }
1879 auto jit_cnew(T) () { return cast(T*)jit_cmalloc(1, T.sizeof); }
1882 * Memory set/copy/compare routines.
1884 void* jit_memset (void* dest, int ch, uint len) nothrow @nogc;
1885 void* jit_memcpy (void* dest, const(void)* src, uint len) nothrow @nogc;
1886 void* jit_memmove (void* dest, const(void)* src, uint len) nothrow @nogc;
1887 int jit_memcmp (const(void)* s1, const(void)* s2, uint len) nothrow @nogc;
1888 void* jit_memchr (const(void)* str, int ch, uint len) nothrow @nogc;
1891 * String routines.
1893 uint jit_strlen (const(char)* str) nothrow @nogc;
1894 char* jit_strcpy (char* dest, const(char)* src) nothrow @nogc;
1895 char* jit_strcat (char* dest, const(char)* src) nothrow @nogc;
1896 char* jit_strncpy (char* dest, const(char)* src, uint len) nothrow @nogc;
1897 char* jit_strdup (const(char)* str) nothrow @nogc;
1898 char* jit_strndup (const(char)* str, uint len) nothrow @nogc;
1899 int jit_strcmp (const(char)* str1, const(char)* str2) nothrow @nogc;
1900 int jit_strncmp (const(char)* str1, const(char)* str2, uint len) nothrow @nogc;
1901 int jit_stricmp (const(char)* str1, const(char)* str2) nothrow @nogc;
1902 int jit_strnicmp (const(char)* str1, const(char)* str2, uint len) nothrow @nogc;
1903 char* jit_strchr (const(char)* str, int ch) nothrow @nogc;
1904 char* jit_strrchr (const(char)* str, int ch) nothrow @nogc;
1905 int jit_sprintf (char* str, const(char)* format, ...) nothrow @nogc;
1906 int jit_snprintf (char* str, uint len, const(char)* format, ...) nothrow @nogc;
1910 * Full struction that can hold a constant of any type.
1912 struct jit_constant_t {
1913 jit_type_t type;
1914 union {
1915 void* ptr_value;
1916 jit_int int_value;
1917 jit_uint uint_value;
1918 jit_nint nint_value;
1919 jit_nuint nuint_value;
1920 jit_long long_value;
1921 jit_ulong ulong_value;
1922 jit_float32 float32_value;
1923 jit_float64 float64_value;
1924 jit_nfloat nfloat_value;
1925 } /*un;*/ //k8
1929 * External function declarations.
1931 jit_value_t jit_value_create (jit_function_t func, jit_type_t type) nothrow @nogc;
1932 jit_value_t jit_value_create_nint_constant (jit_function_t func, jit_type_t type, jit_nint const_value) nothrow @nogc;
1933 jit_value_t jit_value_create_long_constant (jit_function_t func, jit_type_t type, jit_long const_value) nothrow @nogc;
1934 jit_value_t jit_value_create_float32_constant (jit_function_t func, jit_type_t type, jit_float32 const_value) nothrow @nogc;
1935 jit_value_t jit_value_create_float64_constant (jit_function_t func, jit_type_t type, jit_float64 const_value) nothrow @nogc;
1936 jit_value_t jit_value_create_nfloat_constant (jit_function_t func, jit_type_t type, jit_nfloat const_value) nothrow @nogc;
1937 jit_value_t jit_value_create_constant (jit_function_t func, const jit_constant_t* const_value) nothrow @nogc;
1938 jit_value_t jit_value_get_param (jit_function_t func, uint param) nothrow @nogc;
1939 jit_value_t jit_value_get_struct_pointer (jit_function_t func) nothrow @nogc;
1940 int jit_value_is_temporary (jit_value_t value) nothrow @nogc;
1941 int jit_value_is_local (jit_value_t value) nothrow @nogc;
1942 int jit_value_is_constant (jit_value_t value) nothrow @nogc;
1943 int jit_value_is_parameter (jit_value_t value) nothrow @nogc;
1944 void jit_value_ref (jit_function_t func, jit_value_t value) nothrow @nogc;
1945 void jit_value_set_volatile (jit_value_t value) nothrow @nogc;
1946 int jit_value_is_volatile (jit_value_t value) nothrow @nogc;
1947 void jit_value_set_addressable (jit_value_t value) nothrow @nogc;
1948 int jit_value_is_addressable (jit_value_t value) nothrow @nogc;
1949 jit_type_t jit_value_get_type (jit_value_t value) nothrow @nogc;
1950 jit_function_t jit_value_get_function (jit_value_t value) nothrow @nogc;
1951 jit_block_t jit_value_get_block (jit_value_t value) nothrow @nogc;
1952 jit_context_t jit_value_get_context (jit_value_t value) nothrow @nogc;
1953 jit_constant_t jit_value_get_constant (jit_value_t value) nothrow @nogc;
1954 jit_nint jit_value_get_nint_constant (jit_value_t value) nothrow @nogc;
1955 jit_long jit_value_get_long_constant (jit_value_t value) nothrow @nogc;
1956 jit_float32 jit_value_get_float32_constant (jit_value_t value) nothrow @nogc;
1957 jit_float64 jit_value_get_float64_constant (jit_value_t value) nothrow @nogc;
1958 jit_nfloat jit_value_get_nfloat_constant (jit_value_t value) nothrow @nogc;
1959 int jit_value_is_true (jit_value_t value) nothrow @nogc;
1960 int jit_constant_convert (jit_constant_t* result, const jit_constant_t* value, jit_type_t type, int overflow_check) nothrow @nogc;
1963 enum jit_prot_t {
1964 JIT_PROT_NONE,
1965 JIT_PROT_READ,
1966 JIT_PROT_READ_WRITE,
1967 JIT_PROT_EXEC_READ,
1968 JIT_PROT_EXEC_READ_WRITE,
1972 void jit_vmem_init () nothrow @nogc;
1974 jit_uint jit_vmem_page_size () nothrow @nogc;
1975 jit_nuint jit_vmem_round_up (jit_nuint value) nothrow @nogc;
1976 jit_nuint jit_vmem_round_down (jit_nuint value) nothrow @nogc;
1978 void* jit_vmem_reserve (jit_uint size) nothrow @nogc;
1979 void* jit_vmem_reserve_committed (jit_uint size, jit_prot_t prot) nothrow @nogc;
1980 int jit_vmem_release (void* addr, jit_uint size) nothrow @nogc;
1982 int jit_vmem_commit (void* addr, jit_uint size, jit_prot_t prot) nothrow @nogc;
1983 int jit_vmem_decommit (void* addr, jit_uint size) nothrow @nogc;
1985 int jit_vmem_protect (void* addr, jit_uint size, jit_prot_t prot) nothrow @nogc;
1989 * Result values for "_jit_cache_start_function" and "_jit_cache_end_function".
1991 enum JIT_MEMORY_OK = 0; /* Function is OK */
1992 enum JIT_MEMORY_RESTART = 1; /* Restart is required */
1993 enum JIT_MEMORY_TOO_BIG = 2; /* Function is too big for the cache */
1994 enum JIT_MEMORY_ERROR = 3; /* Other error */
1997 /* TODO: the proper place for this is jit-def.h and it's going to depend on the platform. */
1998 alias jit_size_t = uint;
2000 alias jit_memory_context_t = void*;
2001 alias jit_function_info_t = void*;
2003 alias jit_memory_manager_t = const(jit_memory_manager)*; //k8: const?!
2005 struct jit_memory_manager {
2006 jit_memory_context_t function (jit_context_t context) nothrow create;
2007 void function (jit_memory_context_t memctx) nothrow destroy;
2009 jit_function_info_t function (jit_memory_context_t memctx, void *pc) nothrow find_function_info;
2010 jit_function_t function (jit_memory_context_t memctx, jit_function_info_t info) nothrow get_function;
2011 void* function (jit_memory_context_t memctx, jit_function_info_t info) nothrow get_function_start;
2012 void* function (jit_memory_context_t memctx, jit_function_info_t info) nothrow get_function_end;
2014 jit_function_t function (jit_memory_context_t memctx) nothrow alloc_function;
2015 void function (jit_memory_context_t memctx, jit_function_t func) nothrow free_function;
2017 int function (jit_memory_context_t memctx, jit_function_t func) nothrow start_function;
2018 int function (jit_memory_context_t memctx, int result) nothrow end_function;
2019 int function (jit_memory_context_t memctx, int count) nothrow extend_limit;
2021 void* function (jit_memory_context_t memctx) nothrow get_limit;
2022 void* function (jit_memory_context_t memctx) nothrow get_break;
2023 void function (jit_memory_context_t memctx, void *brk) nothrow set_break;
2025 void* function (jit_memory_context_t memctx) nothrow alloc_trampoline;
2026 void function (jit_memory_context_t memctx, void *ptr) nothrow free_trampoline;
2028 void* function (jit_memory_context_t memctx) nothrow alloc_closure;
2029 void function (jit_memory_context_t memctx, void *ptr) nothrow free_closure;
2031 void* function (jit_memory_context_t memctx, jit_size_t size, jit_size_t align_) nothrow alloc_data;
2034 jit_memory_manager_t jit_default_memory_manager () nothrow @nogc;
2037 import core.stdc.stdio : FILE;
2039 void jit_dump_type (FILE* stream, jit_type_t type) nothrow @nogc;
2040 void jit_dump_value (FILE* stream, jit_function_t func, jit_value_t value, const(char)* prefix) nothrow @nogc;
2041 void jit_dump_insn (FILE* stream, jit_function_t func, jit_insn_t insn) nothrow @nogc;
2042 void jit_dump_function (FILE* stream, jit_function_t func, const(char)* name) nothrow @nogc;
2046 * Get the frame address for a frame which is "n" levels up the stack.
2047 * A level value of zero indicates the current frame.
2049 //k8 void* _jit_get_frame_address (void* start, uint n) nothrow @nogc;
2050 /+k8: not complete
2051 #if defined(__GNUC__)
2052 # define jit_get_frame_address(n) \
2053 (_jit_get_frame_address(jit_get_current_frame(), (n)))
2054 #else
2055 # define jit_get_frame_address(n) (_jit_get_frame_address(0, (n)))
2056 #endif
2060 * Get the frame address for the current frame. May be more efficient
2061 * than using "jit_get_frame_address(0)".
2063 * Note: some gcc vestions have broken __builtin_frame_address() so use
2064 * _JIT_ARCH_GET_CURRENT_FRAME() if available.
2066 /+k8:???
2067 #if defined(__GNUC__)
2068 # define JIT_FAST_GET_CURRENT_FRAME 1
2069 # if defined(_JIT_ARCH_GET_CURRENT_FRAME)
2070 # define jit_get_current_frame() \
2071 ({ \
2072 void* address; \
2073 _JIT_ARCH_GET_CURRENT_FRAME(address); \
2074 address; \
2076 # else
2077 # define jit_get_current_frame() (__builtin_frame_address(0))
2078 # endif
2079 #else
2080 # define JIT_FAST_GET_CURRENT_FRAME 0
2081 # define jit_get_current_frame() (jit_get_frame_address(0))
2082 #endif
2085 * Get the next frame up the stack from a specified frame.
2086 * Returns NULL if it isn't possible to retrieve the next frame.
2088 void* _jit_get_next_frame_address(void* frame);
2089 #if defined(__GNUC__) && defined(_JIT_ARCH_GET_NEXT_FRAME)
2090 # define jit_get_next_frame_address(frame) \
2091 ({ \
2092 void* address; \
2093 _JIT_ARCH_GET_NEXT_FRAME(address, (frame)); \
2094 address; \
2096 #else
2097 # define jit_get_next_frame_address(frame) \
2098 (_jit_get_next_frame_address(frame))
2099 #endif
2102 * Get the return address for a specific frame.
2104 void* _jit_get_return_address(void* frame, void* frame0, void* return0);
2105 #if defined(__GNUC__)
2106 # if defined(_JIT_ARCH_GET_RETURN_ADDRESS)
2107 # define jit_get_return_address(frame) \
2108 ({ \
2109 void* address; \
2110 _JIT_ARCH_GET_RETURN_ADDRESS(address, (frame)); \
2111 address; \
2113 # else
2114 # define jit_get_return_address(frame) \
2115 (_jit_get_return_address \
2116 ((frame), \
2117 __builtin_frame_address(0), \
2118 __builtin_return_address(0)))
2119 # endif
2120 #else
2121 # define jit_get_return_address(frame) \
2122 (_jit_get_return_address((frame), 0, 0))
2123 #endif
2126 * Get the return address for the current frame. May be more efficient
2127 * than using "jit_get_return_address(0)".
2129 #if defined(__GNUC__)
2130 # if defined(_JIT_ARCH_GET_CURRENT_RETURN)
2131 # define jit_get_current_return() \
2132 ({ \
2133 void* address; \
2134 _JIT_ARCH_GET_CURRENT_RETURN(address); \
2135 address; \
2137 # else
2138 # define jit_get_current_return() (__builtin_return_address(0))
2139 # endif
2140 #else
2141 # define jit_get_current_return() \
2142 (jit_get_return_address(jit_get_current_frame()))
2143 #endif
2147 * Declare a stack crawl mark variable. The address of this variable
2148 * can be passed to "jit_frame_contains_crawl_mark" to determine
2149 * if a frame contains the mark.
2151 //k8:??? struct jit_crawl_mark_t { void* volatile mark; }
2152 //k8:??? #define jit_declare_crawl_mark(name) jit_crawl_mark_t name = {0}
2155 * Determine if the stack frame just above "frame" contains a
2156 * particular crawl mark.
2158 //k8:??? int jit_frame_contains_crawl_mark(void* frame, jit_crawl_mark_t* mark);