| 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_allocator.h" |
|
9
|
|
|
|
|
|
|
#include "spvm_api_allocator.h" |
|
10
|
|
|
|
|
|
|
|
|
11
|
119269
|
|
|
|
|
|
SPVM_API_ALLOCATOR* SPVM_API_ALLOCATOR_new_api() { |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
// Env Allocator |
|
14
|
119269
|
|
|
|
|
|
void* env_allocator_init[] = { |
|
15
|
|
|
|
|
|
|
SPVM_API_ALLOCATOR_new_instance, |
|
16
|
|
|
|
|
|
|
SPVM_API_ALLOCATOR_free_instance, |
|
17
|
|
|
|
|
|
|
}; |
|
18
|
119269
|
|
|
|
|
|
SPVM_API_ALLOCATOR* env_allocator = calloc(1, sizeof(env_allocator_init)); |
|
19
|
119269
|
|
|
|
|
|
memcpy(env_allocator, env_allocator_init, sizeof(env_allocator_init)); |
|
20
|
|
|
|
|
|
|
|
|
21
|
119269
|
|
|
|
|
|
return env_allocator; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
522
|
|
|
|
|
|
SPVM_ALLOCATOR* SPVM_API_ALLOCATOR_new_instance() { |
|
25
|
522
|
|
|
|
|
|
SPVM_ALLOCATOR* allocator = SPVM_ALLOCATOR_new(); |
|
26
|
|
|
|
|
|
|
|
|
27
|
522
|
|
|
|
|
|
return allocator; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
522
|
|
|
|
|
|
void SPVM_API_ALLOCATOR_free_instance(SPVM_ALLOCATOR* allocator) { |
|
31
|
522
|
|
|
|
|
|
SPVM_ALLOCATOR_free(allocator); |
|
32
|
522
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
119269
|
|
|
|
|
|
void SPVM_API_ALLOCATOR_free_api(SPVM_API_ALLOCATOR* api) { |
|
35
|
119269
|
|
|
|
|
|
free(api); |
|
36
|
119269
|
|
|
|
|
|
} |