Name
SPVM::Document::NativeAPI::Runtime - Runtime Native APIs
Description
The runtime native APIs of SPVM are the APIs to manipulate information of runtime.
Usage
SPVM_API_RUNTIME* runtime_api = env->api->runtime;
void* runtime = runtime_api->new_instance();
env->api->runtime->free_instance(runtime);
Runtime Native APIs
new_instance
void* (*new_instance)(void);
Creates a new runtime object and returns it.
free_instance
void (*free_instance)(void* runtime);
Frees a runtime object.
get_object_data_offset
int32_t (*get_object_data_offset)(void* runtime);
Returns the offset of the data of the SPVM_OBJECT
type.
The runtime
argument is a runtime object.
get_object_ref_count_offset
int32_t (*get_object_ref_count_offset)(void* runtime);
Returns the offset of the ref_count
member variable of the SPVM_OBJECT
type.
The runtime
argument is a runtime object.
get_object_length_offset
int32_t (*get_object_length_offset)(void* runtime);
Returns the offset of the length
member variable of the SPVM_OBJECT
type.
The runtime
argument is a runtime object.
get_basic_type_by_id
void* (*get_basic_type_by_id)(void* runtime, int32_t basic_type_id);
Gets a basic type object by a basic type ID and returns it.
The runtime
argument is a runtime object.
get_basic_type_by_name
void* (*get_basic_type_by_name)(void* runtime, const char* basic_type_name);
Gets a basic type object by a basic type name and returns it.
The runtime
argument is a runtime object.
get_basic_types_length
int32_t (*get_basic_types_length)(void* runtime);
Gets the length of the basic types.
The runtime
argument is a runtime object.
is_object_type
int32_t (*is_object_type)(void* runtime, void* basic_type, int32_t type_dimension, int32_t flag);
If the type is object type, returns 1. Otherwise returns 0.
The runtime
argument is a runtime object.
The basic_type
argument is a basic type object.
can_assign
int32_t (*can_assign)(void* runtime, void* dist_basic_type, int32_t dist_type_dimension, int32_t dist_type_flag, void* src_basic_type, int32_t src_type_dimension, int32_t src_type_flag);
If a source type can be assigned to a dist type, returns 1. Otherwise returns 0.
The runtime
argument is a runtime object.
The dist_basic_type
argument is a basic type object.
The src_basic_type
argument is a basic type object.
build_precompile_module_source
void (*build_precompile_module_source)(void* runtime, void* string_buffer, void* module_basic_type);
Builds the C source code of a precompiled module, and saves it to the string buffer.
The runtime
argument is a runtime object.
The string_buffer
argument is a string buffer object.
The module_basic_type
argument is a basic type object.
build_precompile_method_source
void (*build_precompile_method_source)(void* runtime, void* string_buffer, void* method);
Builds the C source code of a precompiled method, and saves it to the string buffer.
The runtime
argument is a runtime object.
The string_buffer
argument is a string buffer object.
The method
argument is a method object.
Native API IDs
0 new_instance
1 free_instance
2 get_object_data_offset
3 get_object_ref_count_offset
4 get_object_length_offset
5 get_basic_type_by_id
6 get_basic_type_by_name
7 get_basic_types_length
8 is_object_type
9 can_assign
10 build_precompile_module_source
11 build_precompile_method_source
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License