| 1 | =head1 Name | ||
| 2 | |||
| 3 | SPVM::Document::NativeAPI::Internal - Internal Native APIs | ||
| 4 | |||
| 5 | =head1 Description | ||
| 6 | |||
| 7 | The internal native APIs in L<SPVM> are the APIs for internal operations. | ||
| 8 | |||
| 9 | These APIs are used for the implementation of the SPVM language, so they should not be used. | ||
| 10 | |||
| 11 | =head1 Usage | ||
| 12 | |||
| 13 | SPVM_API_INTERNAL* api_internal = env->api->internal; | ||
| 14 | |||
| 15 | =head1 Native APIs | ||
| 16 | |||
| 17 | =head2 get_ref_count | ||
| 18 | |||
| 19 | C<int32_t (*get_ref_count)(L<SPVM_ENV* env|SPVM::Document::NativeClass/"Runtime Environment">, L<SPVM_VALUE* stack|SPVM::Document::NativeClass/"Runtime Stack">, L<SPVM_OBJ* object|SPVM::Document::NativeAPI/"SPVM_OBJ">);> | ||
| 20 | |||
| 21 | Returns the reference count of the object I<object>. | ||
| 22 | |||
| 23 | =head2 inc_ref_count | ||
| 24 | |||
| 25 | C<void (*inc_ref_count)(L<SPVM_ENV* env|SPVM::Document::NativeClass/"Runtime Environment">, L<SPVM_VALUE* stack|SPVM::Document::NativeClass/"Runtime Stack">, L<SPVM_OBJ* object|SPVM::Document::NativeAPI/"SPVM_OBJ">);> | ||
| 26 | |||
| 27 | Increments the reference count of the object I<object>. | ||
| 28 | |||
| 29 | =head2 dec_ref_count | ||
| 30 | |||
| 31 | C<void (*dec_ref_count)(L<SPVM_ENV* env|SPVM::Document::NativeClass/"Runtime Environment">, L<SPVM_VALUE* stack|SPVM::Document::NativeClass/"Runtime Stack">, L<SPVM_OBJ* object|SPVM::Document::NativeAPI/"SPVM_OBJ">);> | ||
| 32 | |||
| 33 | Decrements the reference count of the object I<object>. | ||
| 34 | |||
| 35 | =head2 get_stack_tmp_buffer | ||
| 36 | |||
| 37 | C<char* (*get_stack_tmp_buffer)(SPVM_ENV* env, SPVM_VALUE* stack);> | ||
| 38 | |||
| 39 | Returns the temporary buffer on the runtime stack I<stack>. | ||
| 40 | |||
| 41 | The byte size of the temporary buffer is L<SPVM_NATIVE_C_STACK_TMP_BUFFER_SIZE|SPVM::Document::NativeAPI/"SPVM_NATIVE_C_STACK_TMP_BUFFER_SIZE">. | ||
| 42 | |||
| 43 | Currently, this internal native API is the same as L<get_stack_tmp_buffer|SPVM::Document::NativeAPI/"get_stack_tmp_buffer"> native API. | ||
| 44 | |||
| 45 | =head2 leave_scope_local | ||
| 46 | |||
| 47 | C<void (*leave_scope_local)(SPVM_ENV* env, SPVM_VALUE* stack, L<SPVM_OBJ** object_vars|SPVM::Document::NativeAPI/"SPVM_OBJ">, int32_t* mortal_stack_typed_var_index, int32_t* mortal_stack_top_ptr, int32_t* mortal_stack_tops, int32_t mortal_stack_tops_index);> | ||
| 48 | |||
| 49 | Performs a leaving scope operation for local variables given object variables I<object_vars>, the mortal stack I<mortal_stack>, the address of the top of the mortal stack I<mortal_stack_top_ptr>, and the mortal stack tops I<mortal_stack_tops>, and the index of the top of the mortal stack I<mortal_stack_tops_index>. | ||
| 50 | |||
| 51 | The value referenced by I<mortal_stack_top_ptr> is updated. | ||
| 52 | |||
| 53 | =head2 lookup_switch_table | ||
| 54 | |||
| 55 | C<int32_t (*lookup_switch_table)(SPVM_ENV* env, SPVM_VALUE* stack, SPVM_NATIVE_METHOD* method, int32_t switch_info_index, int32_t value);> | ||
| 56 | |||
| 57 | Looks up the switch table with I<switch_info_index> for the specified I<value> using binary search and returns the corresponding index. | ||
| 58 | |||
| 59 | =head1 Native Internal API IDs | ||
| 60 | |||
| 61 | 0 get_ref_count | ||
| 62 | 1 inc_ref_count | ||
| 63 | 2 dec_ref_count | ||
| 64 | 3 get_stack_tmp_buffer | ||
| 65 | 4 leave_scope_local | ||
| 66 | 5 lookup_switch_table | ||
| 67 | |||
| 68 | =head1 See Also | ||
| 69 | |||
| 70 | =over 2 | ||
| 71 | |||
| 72 | =item * L<SPVM::Document::NativeAPI> | ||
| 73 | |||
| 74 | =item * L<SPVM::Document::NativeClass> | ||
| 75 | |||
| 76 | =item * L<SPVM::Document> | ||
| 77 | |||
| 78 | =back | ||
| 79 | |||
| 80 | =head1 Copyright & License | ||
| 81 | |||
| 82 | Copyright (c) 2023 Yuki Kimoto | ||
| 83 | |||
| 84 | MIT License |