uptimize for big arg, not ok

This commit is contained in:
pikastech 2022-09-29 14:50:43 +08:00
parent ba6751fc89
commit 04ae205e74
4 changed files with 23 additions and 1 deletions

View File

@ -66,6 +66,7 @@
"_modbus__modbusrtu.h": "c",
"_modbus__modbustcp.h": "c",
"pikastddata_string.h": "c",
"gtesttask_proxytest.h": "c"
"gtesttask_proxytest.h": "c",
"datastack.h": "c"
}
}

View File

@ -41,6 +41,7 @@ int32_t stack_init(Stack* stack) {
arg_setContent(NULL, NULL, PIKA_STACK_BUFF_SIZE / 4);
stack_reset(stack);
stack->stack_totle_size = PIKA_STACK_BUFF_SIZE;
stack->big_arg_buffer = New_args(NULL);
return 0;
};
@ -57,10 +58,18 @@ int32_t stack_popSize(Stack* stack) {
int32_t stack_deinit(Stack* stack) {
arg_deinit(stack->stack_pyload);
arg_deinit(stack->stack_size_array);
args_deinit(stack->big_arg_buffer);
return 0;
}
void stack_pushPyload(Stack* stack, Arg* in, size_t size) {
#if 0
if (size > PIKA_STACK_BIG_ARG_SIZE) {
in->name_hash = (uintptr_t)stack->sp;
args_setArg(stack->big_arg_buffer, arg_copy(in));
return;
}
#endif
size_t stack_size_after_push =
size + (stack->sp - arg_getContent(stack->stack_pyload));
if (stack_size_after_push > stack->stack_totle_size) {
@ -87,6 +96,13 @@ void stack_pushPyload(Stack* stack, Arg* in, size_t size) {
}
uint8_t* stack_popPyload(Stack* stack, size_t size) {
#if 0
if (size > PIKA_STACK_BIG_ARG_SIZE) {
Arg* arg =
args_getArg_hash(stack->big_arg_buffer, (uintptr_t)stack->sp);
return (uint8_t*)arg;
};
#endif
stack->sp -= size;
return stack->sp;
}

View File

@ -36,6 +36,7 @@ typedef struct Stack_t {
int32_t* sp_size;
int32_t top;
size_t stack_totle_size;
Args* big_arg_buffer;
} Stack;
int32_t stack_deinit(Stack* stack);

View File

@ -309,6 +309,10 @@
#define PIKA_FLOAT_TYPE_DOUBLE 1
#endif
#ifndef PIKA_STACK_BIG_ARG_SIZE
#define PIKA_STACK_BIG_ARG_SIZE 8
#endif
/* configuration validation */
#endif