=head1 NAME

SPVM::Document::NativeAPI - SPVM Native API

=head1 What is Native API

Native API is C level functions to manipulate data of SPVM in L<Extension|SPVM::Document::Extension>.

If you need more performance or bind C/C++ functions, you can use L<Extension|SPVM::Document::Extension> and Native API.

=head1 NATIVE API

  void* exception_object;
  void* native_mortal_stack;
  void* native_mortal_stack_top;
  void* native_mortal_stack_capacity;
  void* runtime;
  void* runtime_package_vars_heap_offset;
  void* object_header_byte_size;
  void* object_ref_count_offset;
  void* object_basic_type_id_offset;
  void* object_type_dimension_offset;
  void* object_array_length_offset;
  void* byte_object_basic_type_id;
  void* short_object_basic_type_id;
  void* int_object_basic_type_id;
  void* long_object_basic_type_id;
  void* float_object_basic_type_id;
  void* double_object_basic_type_id;
  int32_t (*memory_blocks_count)(SPVM_ENV* env);
  void* (*new_env)(SPVM_ENV*);
  void (*free_env)(SPVM_ENV*);
  int32_t (*len)(SPVM_ENV*, void*);
  int8_t* (*belems)(SPVM_ENV*, void*);
  int16_t* (*selems)(SPVM_ENV*, void*);
  int32_t* (*ielems)(SPVM_ENV*, void*);
  int64_t* (*lelems)(SPVM_ENV*, void*);
  float* (*felems)(SPVM_ENV*, void*);
  double* (*delems)(SPVM_ENV*, void*);
  void* (*oelem)(SPVM_ENV*, void*, int32_t index);
  void (*set_oelem)(SPVM_ENV*, void*, int32_t index, void* value);
  int32_t (*field_id)(SPVM_ENV*, const char*, const char*, const char*);
  int8_t (*bfield)(SPVM_ENV*, void*, int32_t);
  int16_t (*sfield)(SPVM_ENV*, void*, int32_t);
  int32_t (*ifield)(SPVM_ENV*, void*, int32_t);
  int64_t (*lfield)(SPVM_ENV*, void*, int32_t);
  float (*ffield)(SPVM_ENV*, void*, int32_t);
  double (*dfield)(SPVM_ENV*, void*, int32_t);
  void* (*ofield)(SPVM_ENV*, void*, int32_t);
  void* (*pointer)(SPVM_ENV*, void*);
  void (*set_bfield)(SPVM_ENV*, void*, int32_t, int8_t);
  void (*set_sfield)(SPVM_ENV*, void*, int32_t, int16_t);
  void (*set_ifield)(SPVM_ENV*, void*, int32_t, int32_t);
  void (*set_lfield)(SPVM_ENV*, void*, int32_t, int64_t);
  void (*set_ffield)(SPVM_ENV*, void*, int32_t, float);
  void (*set_dfield)(SPVM_ENV*, void*, int32_t, double);
  void (*set_ofield)(SPVM_ENV*, void*, int32_t, void*);
  int32_t (*sub_id)(SPVM_ENV*, const char*, const char*, const char*);
  int32_t (*method_sub_id)(SPVM_ENV*, void* object, const char*, const char*);
  int32_t (*basic_type_id)(SPVM_ENV*, const char*);
  int32_t (*pkgvar_id)(SPVM_ENV* env, const char* package_name, const char* pkgvar_name, const char* signature);
  int32_t (*field_offset)(SPVM_ENV*, int32_t);
  void* (*new_obj_raw)(SPVM_ENV*, int32_t);
  void* (*new_barray_raw)(SPVM_ENV*, int32_t);
  void* (*new_sarray_raw)(SPVM_ENV*, int32_t);
  void* (*new_iarray_raw)(SPVM_ENV*, int32_t);
  void* (*new_larray_raw)(SPVM_ENV*, int32_t);
  void* (*new_farray_raw)(SPVM_ENV*, int32_t);
  void* (*new_darray_raw)(SPVM_ENV*, int32_t);
  void* (*new_oarray_raw)(SPVM_ENV*, int32_t, int32_t);
  void* (*new_marray_raw)(SPVM_ENV*, int32_t, int32_t, int32_t);
  void* (*new_varray_raw)(SPVM_ENV*, int32_t, int32_t);
  void* (*new_str_raw)(SPVM_ENV* env, const char* bytes, int32_t length);
  void* (*new_pointer_raw)(SPVM_ENV*, int32_t basic_type_id, void* ptr);
  void* (*new_obj)(SPVM_ENV*, int32_t);
  void* (*new_barray)(SPVM_ENV*, int32_t);
  void* (*new_sarray)(SPVM_ENV*, int32_t);
  void* (*new_iarray)(SPVM_ENV*, int32_t);
  void* (*new_larray)(SPVM_ENV*, int32_t);
  void* (*new_farray)(SPVM_ENV*, int32_t);
  void* (*new_darray)(SPVM_ENV*, int32_t);
  void* (*new_oarray)(SPVM_ENV*, int32_t, int32_t);
  void* (*new_marray)(SPVM_ENV*, int32_t, int32_t, int32_t);
  void* (*new_varray)(SPVM_ENV*, int32_t, int32_t);
  void* (*new_str)(SPVM_ENV* env, const char* bytes, int32_t length);
  void* (*new_pointer)(SPVM_ENV* env, int32_t basic_type_id, void* ptr);
  void* (*exception)(SPVM_ENV* env);
  void (*set_exception)(SPVM_ENV* env, void* exception);
  int32_t (*ref_count)(SPVM_ENV* env, void* object);
  void (*inc_ref_count)(SPVM_ENV* env, void* object);
  void (*dec_ref_count)(SPVM_ENV* env, void* object);
  void (*weaken)(SPVM_ENV* env, void** object_address);
  int32_t (*isweak)(SPVM_ENV* env, void** object);
  void (*unweaken)(SPVM_ENV* env, void** object_address);
  void* (*concat)(SPVM_ENV* env, void* string1, void* string2);
  void* (*create_stack_trace)(SPVM_ENV* env, void* excetpion, const char* package_name, const char* sub_name, const char* file, int32_t line);
  int32_t (*call_sub)(SPVM_ENV* env, int32_t sub_id, SPVM_VALUE* args);
  int32_t (*enter_scope)(SPVM_ENV* env);
  void (*push_mortal)(SPVM_ENV* env, void* object);
  void (*leave_scope)(SPVM_ENV* env, int32_t original_mortal_stack_top);
  int32_t (*has_interface)(SPVM_ENV*, void* object, int32_t interface_basic_type_id);
