github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/include/jit/jit-common.h (about)

     1  /*
     2   * jit-common.h - Common type definitions that are used by the JIT.
     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_COMMON_H
    22  #define	_JIT_COMMON_H
    23  
    24  #include <jit/jit-defs.h>
    25  
    26  #ifdef	__cplusplus
    27  extern	"C" {
    28  #endif
    29  
    30  /*
    31   * Opaque structure that represents a context.
    32   */
    33  typedef struct _jit_context *jit_context_t;
    34  
    35  /*
    36   * Opaque structure that represents a function.
    37   */
    38  typedef struct _jit_function *jit_function_t;
    39  
    40  /*
    41   * Opaque structure that represents a block.
    42   */
    43  typedef struct _jit_block *jit_block_t;
    44  
    45  /*
    46   * Opaque structure that represents an instruction.
    47   */
    48  typedef struct _jit_insn *jit_insn_t;
    49  
    50  /*
    51   * Opaque structure that represents a value.
    52   */
    53  typedef struct _jit_value *jit_value_t;
    54  
    55  /*
    56   * Opaque structure that represents a type descriptor.
    57   */
    58  typedef struct _jit_type *jit_type_t;
    59  
    60  /*
    61   * Opaque type that represents an exception stack trace.
    62   */
    63  typedef struct jit_stack_trace *jit_stack_trace_t;
    64  
    65  /*
    66   * Block label identifier.
    67   */
    68  typedef jit_nuint jit_label_t;
    69  
    70  /*
    71   * Value that represents an undefined label.
    72   */
    73  #define	jit_label_undefined	((jit_label_t)~((jit_uint)0))
    74  
    75  /*
    76   * Value that represents an undefined offset.
    77   */
    78  #define	JIT_NO_OFFSET		(~((unsigned int)0))
    79  
    80  /*
    81   * Function that is used to free user-supplied metadata.
    82   */
    83  typedef void (*jit_meta_free_func)(void *data);
    84  
    85  /*
    86   * Function that is used to compile a function on demand.
    87   * Returns zero if the compilation process failed for some reason.
    88   */
    89  typedef int (*jit_on_demand_func)(jit_function_t func);
    90  
    91  /*
    92   * Function that is used to control on demand compilation.
    93   * Typically, it should take care of the context locking and unlocking,
    94   * calling function's on demand compiler, and final compilation.
    95   */
    96  typedef void *(*jit_on_demand_driver_func)(jit_function_t func);
    97  
    98  #ifdef	__cplusplus
    99  };
   100  #endif
   101  
   102  #endif /* _JIT_COMMON_H */