本文整理汇总了C++中UPCALL_SWITCH_STACK函数的典型用法代码示例。如果您正苦于以下问题:C++ UPCALL_SWITCH_STACK函数的具体用法?C++ UPCALL_SWITCH_STACK怎么用?C++ UPCALL_SWITCH_STACK使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UPCALL_SWITCH_STACK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: upcall_malloc
extern "C" CDECL uintptr_t
upcall_malloc(type_desc *td, uintptr_t size) {
rust_task *task = rust_get_current_task();
s_malloc_args args = {task, 0, td, size};
UPCALL_SWITCH_STACK(task, &args, upcall_s_malloc);
return args.retval;
}
示例2: upcall_rust_personality
/**
The exception handling personality function. It figures
out what to do with each landing pad. Just a stack-switching
wrapper around the C++ personality function.
*/
extern "C" _Unwind_Reason_Code
upcall_rust_personality(int version,
_Unwind_Action actions,
uint64_t exception_class,
_Unwind_Exception *ue_header,
_Unwind_Context *context) {
s_rust_personality_args args = {(_Unwind_Reason_Code)0,
version, actions, exception_class,
ue_header, context};
rust_task *task = rust_try_get_current_task();
if (task == NULL) {
// Assuming we're running with the new scheduler
upcall_s_rust_personality(&args);
return args.retval;
}
// The personality function is run on the stack of the
// last function that threw or landed, which is going
// to sometimes be the C stack. If we're on the Rust stack
// then switch to the C stack.
if (task->on_rust_stack()) {
UPCALL_SWITCH_STACK(task, &args, upcall_s_rust_personality);
} else {
upcall_s_rust_personality(&args);
}
return args.retval;
}
示例3: upcall_cmp_type
extern "C" void
upcall_cmp_type(int8_t *result, const type_desc *tydesc,
const type_desc **subtydescs, uint8_t *data_0,
uint8_t *data_1, uint8_t cmp_type) {
s_cmp_type_args args = {result, tydesc, subtydescs, data_0, data_1, cmp_type};
UPCALL_SWITCH_STACK(&args, upcall_s_cmp_type);
}
示例4: upcall_str_new_shared
extern "C" CDECL rust_opaque_box*
upcall_str_new_shared(const char *cstr, size_t len) {
rust_task *task = rust_get_current_task();
s_str_new_shared_args args = { task, cstr, len, 0 };
UPCALL_SWITCH_STACK(task, &args, upcall_s_str_new_shared);
return args.retval;
}
示例5: upcall_fail
extern "C" CDECL void
upcall_fail(char const *expr,
char const *file,
size_t line) {
s_fail_args args = {expr,file,line};
UPCALL_SWITCH_STACK(&args, upcall_s_fail);
}
示例6: upcall_cmp_type
extern "C" void
upcall_cmp_type(int8_t *result, const type_desc *tydesc,
uint8_t *data_0, uint8_t *data_1, uint8_t cmp_type) {
rust_task *task = rust_get_current_task();
s_cmp_type_args args = {result, tydesc,
data_0, data_1, cmp_type};
UPCALL_SWITCH_STACK(task, &args, upcall_s_cmp_type);
}
示例7: upcall_fail
extern "C" CDECL void
upcall_fail(char const *expr,
char const *file,
size_t line) {
rust_task *task = rust_get_current_task();
s_fail_args args = {task,expr,file,line};
UPCALL_SWITCH_STACK(task, &args, upcall_s_fail);
}
示例8: upcall_trace
extern "C" CDECL void
upcall_trace(char const *msg,
char const *file,
size_t line) {
rust_task *task = rust_get_current_task();
s_trace_args args = {task,msg,file,line};
UPCALL_SWITCH_STACK(task, &args, upcall_s_trace);
}
示例9: upcall_get_type_desc
extern "C" CDECL type_desc *
upcall_get_type_desc(void *curr_crate, // ignored, legacy compat.
size_t size,
size_t align,
size_t n_descs,
type_desc const **descs,
uintptr_t n_obj_params) {
s_get_type_desc_args args = {0,size,align,n_descs,descs,n_obj_params};
UPCALL_SWITCH_STACK(&args, upcall_s_get_type_desc);
return args.retval;
}
示例10: upcall_fail
extern "C" CDECL void
upcall_fail(char const *expr,
char const *file,
size_t line) {
rust_task *task = rust_try_get_current_task();
if (task == NULL) {
// FIXME #5161: Need to think about what to do here
printf("failure outside of a task");
abort();
}
s_fail_args args = {task,expr,file,line};
UPCALL_SWITCH_STACK(task, &args, upcall_s_fail);
}
示例11: upcall_free
extern "C" CDECL void
upcall_free(void* ptr) {
rust_task *task = rust_get_current_task();
s_free_args args = {task,ptr};
UPCALL_SWITCH_STACK(task, &args, upcall_s_free);
}
示例12: upcall_dynastack_alloc
extern "C" CDECL void *
upcall_dynastack_alloc(size_t sz) {
s_dynastack_alloc_args args = {0, sz};
UPCALL_SWITCH_STACK(&args, upcall_s_dynastack_alloc);
return args.retval;
}
示例13: upcall_log_type
extern "C" void
upcall_log_type(const type_desc *tydesc, uint8_t *data, uint32_t level) {
rust_task *task = rust_get_current_task();
s_log_type_args args = {tydesc, data, level};
UPCALL_SWITCH_STACK(task, &args, upcall_s_log_type);
}
示例14: upcall_dynastack_alloc_2
extern "C" CDECL void *
upcall_dynastack_alloc_2(size_t sz, type_desc *ty) {
s_dynastack_alloc_2_args args = {0, sz, ty};
UPCALL_SWITCH_STACK(&args, upcall_s_dynastack_alloc_2);
return args.retval;
}
示例15: upcall_new_stack
extern "C" CDECL void *
upcall_new_stack(size_t stk_sz, void *args_addr, size_t args_sz) {
s_new_stack_args args = {NULL, stk_sz, args_addr, args_sz};
UPCALL_SWITCH_STACK(&args, upcall_s_new_stack);
return args.result;
}