try catch 不处理动态内存,拆分riscv_rest

This commit is contained in:
2025-06-24 17:59:23 +08:00
parent d9baa7f7a3
commit b64401d556
14 changed files with 115 additions and 83 deletions

View File

@@ -8,6 +8,7 @@
#include "debug.h"
#include "string.h"
#include "ctype.h"
#include "mystdlib.h"
// c语言词法分析

View File

@@ -4,7 +4,8 @@
#define exception_h__
#include "setjmp.h"
#include "mystdlib.h"
#include "stdlib.h"
// #include "mystdlib.h"
#define THROW_LOG__MAX_SIZE 1024
@@ -12,7 +13,7 @@
typedef struct _jmp_fram{
struct _jmp_fram *next;
struct _jmp_fram *last;
map_def *mem;
// map_def *mem;
jmp_buf fram;
}jmp_fram;
@@ -41,9 +42,9 @@ typedef struct{
#define jmp_last(j) {\
if((*j)){\
jmp_fram *l=(*j)->last;\
if(l){\
/*if(l){\
__mem_mov(&(l)->mem,&(*j)->mem);\
}\
}*/\
free(*j);\
(*j)=l;\
if(*j){\
@@ -56,7 +57,7 @@ typedef struct{
#define jmp_clear(j) {\
if((*j)){\
jmp_fram *l=(*j)->last;\
__mem_clear(&(*j)->mem);\
/*__mem_clear(&(*j)->mem);*/\
free(*j);\
(*j)=l;\
if(*j){\

View File

@@ -88,3 +88,6 @@ mythread_t *sigthread_init() {
}
__attribute__((weak)) void* signal_find_slot_func(const char* name) {
return 0;
}

View File

@@ -11,18 +11,22 @@
typedef struct _map_def{
size_t map_size;
size_t mam_used;
size_t mem_map[0];
}map_def;
// typedef struct _map_def{
// size_t map_size;
// size_t mam_used;
// size_t mem_map[0];
// }map_def;
void __mem_clear(map_def **m);
void __mem_mov(map_def **d,map_def **s);
// void __mem_clear(map_def **m);
// void __mem_mov(map_def **d,map_def **s);
void *mem_calloc(size_t memb_num, size_t memb_size);
void *mem_malloc(size_t size);
void mem_free(void *p);
// void *mem_calloc(size_t memb_num, size_t memb_size);
// void *mem_malloc(size_t size);
// void mem_free(void *p);
#define mem_calloc calloc
#define mem_malloc malloc
#define mem_free free
#endif