The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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* api_runtime = env->api->runtime;

int32_t basic_types_length = api_runtime->get_basic_types_length(env->runtime);

Runtime Native APIs

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.

build_precompile_class_source

void (*build_precompile_class_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.

get_compiler

void* (*get_compiler)(void* runtime);

set_compiler

void (*set_compiler)(void* runtime, void* compiler);

get_spvm_stdin

FILE* (*get_spvm_stdin)(void* runtime);

get_spvm_stdout

FILE* (*get_spvm_stdout)(void* runtime);

get_spvm_stderr

FILE* (*get_spvm_stderr)(void* runtime);

Native API IDs

0 get_object_data_offset
1 get_object_ref_count_offset
2 get_object_length_offset
3 get_basic_type_by_id
4 get_basic_type_by_name
5 get_basic_types_length
6 build_precompile_class_source
7 build_precompile_method_source
8 get_compiler
9 set_compiler
10 get_spvm_stdin
11 get_spvm_stdout
12 get_spvm_stderr

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License