File Coverage

lib/SPVM/Builder/src/spvm_api_internal.c
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 25 25 100.0


line stmt bran cond sub pod time code
1             // Copyright (c) 2023 Yuki Kimoto
2             // MIT License
3              
4             #include
5              
6             #include "spvm_native.h"
7              
8             #include "spvm_api_internal.h"
9             #include "spvm_api.h"
10              
11 119195           SPVM_API_INTERNAL* SPVM_API_INTERNAL_new_api() {
12            
13             // Env Allocator
14 119195           void* env_internal_init[] = {
15             SPVM_API_INTERNAL_get_ref_count,
16             SPVM_API_INTERNAL_inc_ref_count,
17             SPVM_API_INTERNAL_dec_ref_count,
18             SPVM_API_INTERNAL_leave_scope_local,
19             SPVM_API_INTERNAL_lock_object,
20             SPVM_API_INTERNAL_unlock_object,
21             };
22 119195           SPVM_API_INTERNAL* env_internal = calloc(1, sizeof(env_internal_init));
23 119195           memcpy(env_internal, env_internal_init, sizeof(env_internal_init));
24            
25 119195           return env_internal;
26             }
27              
28 119195           void SPVM_API_INTERNAL_free_api(SPVM_API_INTERNAL* api) {
29 119195           free(api);
30 119195           }
31              
32 26           int32_t SPVM_API_INTERNAL_get_ref_count(SPVM_ENV* env, SPVM_VALUE* stack, SPVM_OBJECT* object) {
33            
34 26           return SPVM_API_get_ref_count(env, stack, object);
35             }
36              
37 89383           void SPVM_API_INTERNAL_inc_ref_count(SPVM_ENV* env, SPVM_VALUE* stack, SPVM_OBJECT* object) {
38            
39 89383           SPVM_API_inc_ref_count(env, stack, object);
40 89383           }
41              
42 89383           void SPVM_API_INTERNAL_dec_ref_count(SPVM_ENV* env, SPVM_VALUE* stack, SPVM_OBJECT* object) {
43            
44 89383           SPVM_API_dec_ref_count(env, stack, object);
45 89383           }
46              
47 1300771           void SPVM_API_INTERNAL_leave_scope_local(SPVM_ENV* env, SPVM_VALUE* stack, SPVM_OBJECT** object_vars, int32_t* mortal_stack, int32_t* mortal_stack_top_ptr, int32_t original_mortal_stack_top) {
48            
49 1300771           SPVM_API_leave_scope_local(env, stack, object_vars, mortal_stack, mortal_stack_top_ptr, original_mortal_stack_top);
50 1300771           }
51              
52 178766           void SPVM_API_INTERNAL_lock_object(SPVM_ENV* env, SPVM_VALUE* stack, SPVM_OBJECT* object) {
53            
54 178766           SPVM_API_lock_object(env, stack, object);
55 178766           }
56              
57 178766           void SPVM_API_INTERNAL_unlock_object(SPVM_ENV* env, SPVM_VALUE* stack, SPVM_OBJECT* object) {
58            
59 178766           SPVM_API_unlock_object(env, stack, object);
60 178766           }