github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/include/jit/jit-function.h (about) 1 /* 2 * jit-function.h - Functions for manipulating functions blocks. 3 * 4 * Copyright (C) 2004 Southern Storm Software, Pty Ltd. 5 * 6 * The libjit library is free software: you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public License 8 * as published by the Free Software Foundation, either version 2.1 of 9 * the License, or (at your option) any later version. 10 * 11 * The libjit library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with the libjit library. If not, see 18 * <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef _JIT_FUNCTION_H 22 #define _JIT_FUNCTION_H 23 24 #include <jit/jit-common.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /* Optimization levels */ 31 #define JIT_OPTLEVEL_NONE 0 32 #define JIT_OPTLEVEL_NORMAL 1 33 34 jit_function_t jit_function_create 35 (jit_context_t context, jit_type_t signature) JIT_NOTHROW; 36 jit_function_t jit_function_create_nested 37 (jit_context_t context, jit_type_t signature, 38 jit_function_t parent) JIT_NOTHROW; 39 void jit_function_abandon(jit_function_t func) JIT_NOTHROW; 40 jit_context_t jit_function_get_context(jit_function_t func) JIT_NOTHROW; 41 jit_type_t jit_function_get_signature(jit_function_t func) JIT_NOTHROW; 42 int jit_function_set_meta 43 (jit_function_t func, int type, void *data, 44 jit_meta_free_func free_data, int build_only) JIT_NOTHROW; 45 void *jit_function_get_meta(jit_function_t func, int type) JIT_NOTHROW; 46 void jit_function_free_meta(jit_function_t func, int type) JIT_NOTHROW; 47 jit_function_t jit_function_next 48 (jit_context_t context, jit_function_t prev) JIT_NOTHROW; 49 jit_function_t jit_function_previous 50 (jit_context_t context, jit_function_t prev) JIT_NOTHROW; 51 jit_block_t jit_function_get_entry(jit_function_t func) JIT_NOTHROW; 52 jit_block_t jit_function_get_current(jit_function_t func) JIT_NOTHROW; 53 jit_function_t jit_function_get_nested_parent(jit_function_t func) JIT_NOTHROW; 54 void jit_function_set_parent_frame(jit_function_t func, 55 jit_value_t parent_frame) JIT_NOTHROW; 56 int jit_function_compile(jit_function_t func) JIT_NOTHROW; 57 int jit_function_is_compiled(jit_function_t func) JIT_NOTHROW; 58 void jit_function_set_recompilable(jit_function_t func) JIT_NOTHROW; 59 void jit_function_clear_recompilable(jit_function_t func) JIT_NOTHROW; 60 int jit_function_is_recompilable(jit_function_t func) JIT_NOTHROW; 61 int jit_function_compile_entry(jit_function_t func, void **entry_point) JIT_NOTHROW; 62 void jit_function_setup_entry(jit_function_t func, void *entry_point) JIT_NOTHROW; 63 void *jit_function_to_closure(jit_function_t func) JIT_NOTHROW; 64 jit_function_t jit_function_from_closure 65 (jit_context_t context, void *closure) JIT_NOTHROW; 66 jit_function_t jit_function_from_pc 67 (jit_context_t context, void *pc, void **handler) JIT_NOTHROW; 68 void *jit_function_to_vtable_pointer(jit_function_t func) JIT_NOTHROW; 69 jit_function_t jit_function_from_vtable_pointer 70 (jit_context_t context, void *vtable_pointer) JIT_NOTHROW; 71 void jit_function_set_on_demand_compiler 72 (jit_function_t func, jit_on_demand_func on_demand) JIT_NOTHROW; 73 jit_on_demand_func jit_function_get_on_demand_compiler(jit_function_t func) JIT_NOTHROW; 74 int jit_function_apply 75 (jit_function_t func, void **args, void *return_area); 76 int jit_function_apply_vararg 77 (jit_function_t func, jit_type_t signature, void **args, void *return_area); 78 void jit_function_set_optimization_level 79 (jit_function_t func, unsigned int level) JIT_NOTHROW; 80 unsigned int jit_function_get_optimization_level 81 (jit_function_t func) JIT_NOTHROW; 82 unsigned int jit_function_get_max_optimization_level(void) JIT_NOTHROW; 83 jit_label_t jit_function_reserve_label(jit_function_t func) JIT_NOTHROW; 84 int jit_function_labels_equal(jit_function_t func, jit_label_t label, jit_label_t label2); 85 int jit_optimize(jit_function_t func); 86 int jit_compile(jit_function_t func); 87 int jit_compile_entry(jit_function_t func, void **entry_point); 88 89 #ifdef __cplusplus 90 }; 91 #endif 92 93 #endif /* _JIT_FUNCTION_H */