mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
remove pool platform
This commit is contained in:
parent
29f125dcd9
commit
2c9bd607ef
@ -5,7 +5,6 @@ extern "C" {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
__platform_pool_init();
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
@ -44,22 +44,9 @@ PIKA_WEAK void __platform_error_handle(){
|
||||
PIKA_WEAK void __platform_free(void* ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
PIKA_WEAK void* __impl_pikaMalloc(size_t size) {
|
||||
return __platform_malloc(size);
|
||||
}
|
||||
PIKA_WEAK void __impl_pikaFree(void* ptrm, size_t size) {
|
||||
__platform_free(ptrm);
|
||||
}
|
||||
PIKA_WEAK void __platform_pool_init(void) {}
|
||||
PIKA_WEAK uint8_t __is_quick_malloc(void) {
|
||||
return 0;
|
||||
}
|
||||
PIKA_WEAK void __quick_malloc_enable(void) {}
|
||||
PIKA_WEAK void __quick_malloc_disable(void) {}
|
||||
PIKA_WEAK uint8_t __is_locked_pikaMemory(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef __platform_printf
|
||||
PIKA_WEAK void __platform_printf(char* fmt, ...) {
|
||||
va_list args;
|
||||
|
@ -87,15 +87,8 @@ void* __platform_memset(void* mem, int ch, size_t size);
|
||||
void* __platform_memcpy(void* dir, const void* src, size_t size);
|
||||
|
||||
/* pika memory pool config */
|
||||
void __platform_pool_init(void);
|
||||
void __platform_wait(void);
|
||||
void* __impl_pikaMalloc(size_t size);
|
||||
void __impl_pikaFree(void* ptrm, size_t size);
|
||||
uint8_t __is_locked_pikaMemory(void);
|
||||
uint8_t __is_quick_malloc(void);
|
||||
void __quick_malloc_enable(void);
|
||||
void __quick_malloc_disable(void);
|
||||
#endif
|
||||
|
||||
/* support shell */
|
||||
char __platform_getchar(void);
|
||||
@ -107,3 +100,5 @@ size_t __platform_fwrite(const void* ptr, size_t size, size_t n, FILE* stream);
|
||||
|
||||
/* error */
|
||||
void __platform_error_handle(void);
|
||||
|
||||
#endif
|
@ -47,7 +47,7 @@ void* pikaMalloc(uint32_t size) {
|
||||
pikaMemInfo.heapUsedMax = pikaMemInfo.heapUsed;
|
||||
}
|
||||
__platform_disable_irq_handle();
|
||||
void* mem = __impl_pikaMalloc(size);
|
||||
void* mem = __platform_malloc(size);
|
||||
__platform_enable_irq_handle();
|
||||
if (NULL == mem) {
|
||||
__platform_printf(
|
||||
@ -70,7 +70,7 @@ void pikaFree(void* mem, uint32_t size) {
|
||||
#endif
|
||||
|
||||
__platform_disable_irq_handle();
|
||||
__impl_pikaFree(mem, size);
|
||||
__platform_free(mem);
|
||||
__platform_enable_irq_handle();
|
||||
pikaMemInfo.heapUsed -= size;
|
||||
}
|
||||
@ -159,13 +159,13 @@ void* pool_malloc(Pool* pool, uint32_t size) {
|
||||
uint32_t block_num_found = 0;
|
||||
uint8_t found_first_free = 0;
|
||||
uint32_t block_index;
|
||||
if (__is_quick_malloc()) {
|
||||
/* high speed malloc */
|
||||
block_index = pool->purl_free_block_start + block_num_need - 1;
|
||||
if (block_index < block_index_max) {
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
// if (__is_quick_malloc()) {
|
||||
// /* high speed malloc */
|
||||
// block_index = pool->purl_free_block_start + block_num_need - 1;
|
||||
// if (block_index < block_index_max) {
|
||||
// goto found;
|
||||
// }
|
||||
// }
|
||||
|
||||
/* low speed malloc */
|
||||
for (block_index = pool->first_free_block;
|
||||
|
Loading…
x
Reference in New Issue
Block a user