Simple Virtual Machine
A simple but flexible virtual machine
SVM processor return stack

This module contains API functions to handle SVM processor function return stack. More...

Functions

SVM_FUNCTION SVM_Size svm_processor_returnstack_get_size (const void *svm, const SVM_Kernel kernel)
 This function retrieves the return stack size of a processor. More...
 
SVM_FUNCTION void svm_processor_returnstack_swap_level (const void *svm, const SVM_Kernel kernel, const SVM_Index level)
 This function swaps a state in the return stack of a processor with the current state of this processor. More...
 
SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag (const void *svm, const SVM_Kernel kernel, const SVM_Value_String flag, const SVM_Index start)
 This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level. More...
 
SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag__string (const void *svm, const SVM_Kernel kernel, const SVM_String flag, const SVM_Index start)
 This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level. More...
 
SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag__raw (const void *svm, const SVM_Kernel kernel, const char *flag, const SVM_Index start)
 This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level. More...
 
SVM_FUNCTION void svm_processor_returnstack_move_level (const void *svm, const SVM_Kernel kernel, const SVM_Index start, const SVM_Index end, const SVM_Index target)
 This function moves a portion of the return stack to another level. More...
 

Detailed Description

This module contains API functions to handle SVM processor function return stack.

Function Documentation

◆ svm_processor_returnstack_find_flag()

SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Value_String  flag,
const SVM_Index  start 
)

This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted processor is.
[in]flagThe flag name to find.
[in]startThe level of the state to be swaped in the return stack.

The start has to be set between 0 and the return stack size. When the return stack size is provided, no search is done and the return stack size is immediately returned.

Returns
Returns the first level when the flag is found. Returns the return stack size when not found.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
PROCESSORinterruption when the return stack does not contain enough levels.
See also
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_processor_returnstack_find_flag__raw()

SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag__raw ( const void *  svm,
const SVM_Kernel  kernel,
const char *  flag,
const SVM_Index  start 
)

This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted processor is.
[in]flagThe flag name to find.
[in]startThe level of the state to be swaped in the return stack.

The start has to be set between 0 and the return stack size. When the return stack size is provided, no search is done and the return stack size is immediately returned.

Returns
Returns the first level when the flag is found. Returns the return stack size when not found.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
PROCESSORinterruption when the return stack does not contain enough levels.
See also
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_processor_returnstack_find_flag__string()

SVM_FUNCTION SVM_Index svm_processor_returnstack_find_flag__string ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_String  flag,
const SVM_Index  start 
)

This function returns the level of the nearest frame having the flag raised within the return stack of a processor from a given level.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted processor is.
[in]flagThe flag name to find.
[in]startThe level of the state to be swaped in the return stack.

The start has to be set between 0 and the return stack size. When the return stack size is provided, no search is done and the return stack size is immediately returned.

Returns
Returns the first level when the flag is found. Returns the return stack size when not found.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
PROCESSORinterruption when the return stack does not contain enough levels.
See also
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_processor_returnstack_get_size()

SVM_FUNCTION SVM_Size svm_processor_returnstack_get_size ( const void *  svm,
const SVM_Kernel  kernel 
)

This function retrieves the return stack size of a processor.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted processor is.
Returns
The number of function returns the processor can do.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
See also
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_processor_returnstack_move_level()

SVM_FUNCTION void svm_processor_returnstack_move_level ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Index  start,
const SVM_Index  end,
const SVM_Index  target 
)

This function moves a portion of the return stack to another level.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted processor is.
[in]startThe first return stack level to move.
[in]endThe first return stack level after the portion to move.
[in]targetThe level where to move the portion of the return stack.

After the move, the first level of the moved is placed at the target.

Note
The start and end levels can be between 0 and the return stack size included, and the start shall be inferior to the end.
The target can be between 0 and the size of the stack minus the portion size, included.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
FAILUREinterruption when the start and end levels are inconsistent.
PROCESSORinterruption when the return stack does not contain enough levels.
PROCESSORinterruption when the move targets a level outside the return stack.
See also
svm_process_ownership_lock
svm_kernel_get_current

◆ svm_processor_returnstack_swap_level()

SVM_FUNCTION void svm_processor_returnstack_swap_level ( const void *  svm,
const SVM_Kernel  kernel,
const SVM_Index  level 
)

This function swaps a state in the return stack of a processor with the current state of this processor.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]kernelThe kernel in which the targeted processor is.
[in]levelThe level of the state to be swaped in the return stack.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the kernel is not owned by our process or is not in a process locked by ours.
PROCESSORinterruption when the return stack does not contain enough levels.
See also
svm_process_ownership_lock
svm_kernel_get_current