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

     1  /*
     2   * jit-objmodel-private.h - Private object model definitions.
     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_OBJMODEL_PRIVATE_H
    22  #define	_JIT_OBJMODEL_PRIVATE_H
    23  
    24  #include <jit/jit-objmodel.h>
    25  
    26  #ifdef	__cplusplus
    27  extern	"C" {
    28  #endif
    29  
    30  /*
    31   * Internal structure of an object model handler.
    32   */
    33  struct jit_objmodel
    34  {
    35  	/*
    36  	 * Size of this structure, for versioning.
    37  	 */
    38  	unsigned int size;
    39  
    40  	/*
    41  	 * Reserved fields that can be used by the handler to store its state.
    42  	 */
    43  	void *reserved0;
    44  	void *reserved1;
    45  	void *reserved2;
    46  	void *reserved3;
    47  
    48  	/*
    49  	 * Operations on object models.
    50  	 */
    51  	void (*destroy_model)(jit_objmodel_t model);
    52  	jitom_class_t (*get_class_by_name)(jit_objmodel_t model, const char *name);
    53  
    54  	/*
    55  	 * Operations on object model classes.
    56   	 */
    57  	char *(*class_get_name)(jit_objmodel_t model, jitom_class_t klass);
    58  	int (*class_get_modifiers)(jit_objmodel_t model, jitom_class_t klass);
    59  	jit_type_t (*class_get_type)(jit_objmodel_t model, jitom_class_t klass);
    60  	jit_type_t (*class_get_value_type)
    61  		(jit_objmodel_t model, jitom_class_t klass);
    62  	jitom_class_t (*class_get_primary_super)
    63  		(jit_objmodel_t model, jitom_class_t klass);
    64  	jitom_class_t *(*class_get_all_supers)
    65  		(jit_objmodel_t model, jitom_class_t klass, unsigned int *num);
    66  	jitom_class_t *(*class_get_interfaces)
    67  		(jit_objmodel_t model, jitom_class_t klass, unsigned int *num);
    68  	jitom_field_t *(*class_get_fields)
    69  		(jit_objmodel_t model, jitom_class_t klass, unsigned int *num);
    70  	jitom_method_t *(*class_get_methods)
    71  		(jit_objmodel_t model, jitom_class_t klass, unsigned int *num);
    72  	jit_value_t (*class_new)
    73  		(jit_objmodel_t model, jitom_class_t klass,
    74  		 jitom_method_t ctor, jit_function_t func,
    75  		 jit_value_t *args, unsigned int num_args, int flags);
    76  	jit_value_t (*class_new_value)
    77  		(jit_objmodel_t model, jitom_class_t klass,
    78  		 jitom_method_t ctor, jit_function_t func,
    79  		 jit_value_t *args, unsigned int num_args, int flags);
    80  	int (*class_delete)
    81  		(jit_objmodel_t model, jitom_class_t klass, jit_value_t obj_value);
    82  	int (*class_add_ref)
    83  		(jit_objmodel_t model, jitom_class_t klass, jit_value_t obj_value);
    84  
    85  	/*
    86  	 * Operations on object model fields.
    87  	 */
    88  	char *(*field_get_name)
    89  		(jit_objmodel_t model, jitom_class_t klass, jitom_field_t field);
    90  	jit_type_t (*field_get_type)
    91  		(jit_objmodel_t model, jitom_class_t klass, jitom_field_t field);
    92  	int (*field_get_modifiers)
    93  		(jit_objmodel_t model, jitom_class_t klass, jitom_field_t field);
    94  	jit_value_t (*field_load)
    95  		(jit_objmodel_t model, jitom_class_t klass, jitom_field_t field,
    96  		 jit_function_t func, jit_value_t obj_value);
    97  	jit_value_t (*field_load_address)
    98  		(jit_objmodel_t model, jitom_class_t klass, jitom_field_t field,
    99  		 jit_function_t func, jit_value_t obj_value);
   100  	int (*field_store)
   101  		(jit_objmodel_t model, jitom_class_t klass, jitom_field_t field,
   102  		 jit_function_t func, jit_value_t obj_value, jit_value_t value);
   103  
   104  	/*
   105  	 * Operations on object model methods.
   106  	 */
   107  	char *(*method_get_name)
   108  		(jit_objmodel_t model, jitom_class_t klass, jitom_method_t method);
   109  	jit_type_t (*method_get_type)
   110  		(jit_objmodel_t model, jitom_class_t klass, jitom_method_t method);
   111  	int (*method_get_modifiers)
   112  		(jit_objmodel_t model, jitom_class_t klass, jitom_method_t method);
   113  	jit_value_t (*method_invoke)
   114  		(jit_objmodel_t model, jitom_class_t klass, jitom_method_t method,
   115  		 jit_function_t func, jit_value_t *args,
   116  		 unsigned int num_args, int flags);
   117  	jit_value_t (*method_invoke_virtual)
   118  		(jit_objmodel_t model, jitom_class_t klass, jitom_method_t method,
   119  		 jit_function_t func, jit_value_t *args,
   120  		 unsigned int num_args, int flags);
   121  
   122  };
   123  
   124  #ifdef	__cplusplus
   125  };
   126  #endif
   127  
   128  #endif /* _JIT_OBJMODEL_PRIVATE_H */