فهرست منبع

rename config macro

lyon1998 4 سال پیش
والد
کامیت
bd0742388b
9فایلهای تغییر یافته به همراه37 افزوده شده و 33 حذف شده
  1. 3 3
      port/linux/benchmark/pika_config.h
  2. 7 7
      src/PikaObj.c
  3. 2 2
      src/PikaParser.c
  4. 2 2
      src/PikaParser.h
  5. 1 1
      src/PikaPlatform.c
  6. 2 2
      src/PikaVM.h
  7. 2 2
      src/dataMemory.c
  8. 3 3
      src/dataStack.c
  9. 15 11
      src/pikaConfigValid.h

+ 3 - 3
port/linux/benchmark/pika_config.h

@@ -1,4 +1,4 @@
-#ifndef __PIKA__CONFIG__H
-    #define __PIKA__CONFIG__H
-    #define PIKA_CONFIG_DEFAULT_SPEED
+#ifndef __PIKA_CONFIG__H
+    #define __PIKA_CONFIG__H
+    #define PIKA_OPTIMIZE_SPEED
 #endif

+ 7 - 7
src/PikaObj.c

@@ -329,7 +329,7 @@ int32_t __foreach_removeMethodInfo(Arg* argNow, Args* argList) {
 }
 
 PikaObj* removeMethodInfo(PikaObj* thisClass) {
-#ifdef PIKA_CONFIG_METHOD_CACHE_ENABLE
+#if PIKA_METHOD_CACHE_ENABLE
 #else
     args_foreach(thisClass->list, __foreach_removeMethodInfo, thisClass->list);
 #endif
@@ -384,9 +384,9 @@ PikaObj* obj_getObjDirect(PikaObj* self, char* name) {
 }
 
 PikaObj* obj_getObj(PikaObj* self, char* objPath, int32_t keepDeepth) {
-    char objPath_buff[PIKA_CONFIG_PATH_BUFF_SIZE];
+    char objPath_buff[PIKA_PATH_BUFF_SIZE];
     __platform_memcpy(objPath_buff, objPath, strGetSize(objPath) + 1);
-    char token_buff[PIKA_CONFIG_NAME_BUFF_SIZE] = {0};
+    char token_buff[PIKA_NAME_BUFF_SIZE] = {0};
     int32_t token_num = strGetTokenNum(objPath, '.');
     PikaObj* obj = self;
     for (int32_t i = 0; i < token_num - keepDeepth; i++) {
@@ -590,7 +590,7 @@ void obj_shellLineProcess(PikaObj* self,
                           __obj_shellLineHandler_t __lineHandler_fun,
                           struct shell_config* cfg) {
     Args buffs = {0};
-    char* rxBuff = args_getBuff(&buffs, PIKA_CONFIG_LINE_BUFF_SIZE);
+    char* rxBuff = args_getBuff(&buffs, PIKA_LINE_BUFF_SIZE);
     char* input_line = NULL;
     uint8_t is_in_block = 0;
     __platform_printf(cfg->prefix);
@@ -639,7 +639,7 @@ void obj_shellLineProcess(PikaObj* self,
                 } else {
                     __platform_printf("... ");
                 }
-                __clearBuff(rxBuff, PIKA_CONFIG_LINE_BUFF_SIZE);
+                __clearBuff(rxBuff, PIKA_LINE_BUFF_SIZE);
                 continue;
             }
             if (0 != strGetSize(rxBuff)) {
@@ -649,7 +649,7 @@ void obj_shellLineProcess(PikaObj* self,
                     char _n = '\n';
                     strAppendWithSize(rxBuff, &_n, 1);
                     obj_setStr(self, "shell_buff", rxBuff);
-                    __clearBuff(rxBuff, PIKA_CONFIG_LINE_BUFF_SIZE);
+                    __clearBuff(rxBuff, PIKA_LINE_BUFF_SIZE);
                     __platform_printf("... ");
                     continue;
                 }
@@ -660,7 +660,7 @@ void obj_shellLineProcess(PikaObj* self,
             }
             __platform_printf(cfg->prefix);
 
-            __clearBuff(rxBuff, PIKA_CONFIG_LINE_BUFF_SIZE);
+            __clearBuff(rxBuff, PIKA_LINE_BUFF_SIZE);
             continue;
         }
     }

+ 2 - 2
src/PikaParser.c

@@ -1272,7 +1272,7 @@ char* AST_appandPikaASM(AST* ast, AST* subAst, Args* outBuffs, char* pikaAsm) {
     char* left = obj_getStr(subAst, "left");
     char* str = obj_getStr(subAst, "string");
     char* num = obj_getStr(subAst, "num");
-    char* buff = args_getBuff(&buffs, PIKA_CONFIG_SPRINTF_BUFF_SIZE);
+    char* buff = args_getBuff(&buffs, PIKA_SPRINTF_BUFF_SIZE);
     if (NULL != ref) {
         __platform_sprintf(buff, "%d REF %s\n", deepth, ref);
         pikaAsm = strsAppend(&buffs, pikaAsm, buff);
@@ -1566,7 +1566,7 @@ ByteCodeFrame* byteCodeFrame_appendFromAsm(ByteCodeFrame* self, char* pikaAsm) {
     char* data;
     uint16_t exist_offset;
 
-    char line_buff[PIKA_CONFIG_PATH_BUFF_SIZE] = {0};
+    char line_buff[PIKA_PATH_BUFF_SIZE] = {0};
     for (int i = 0; i < strCountSign(pikaAsm, '\n'); i++) {
         char* line = strGetLine(line_buff, asmer.line_pointer);
         InstructUnit ins_unit = {0};

+ 2 - 2
src/PikaParser.h

@@ -25,8 +25,8 @@
  * SOFTWARE.
  */
 
-#ifndef __PIKA__PARSER__H
-#define __PIKA__PARSER__H
+#ifndef __PIKA_PARSER__H
+#define __PIKA_PARSER__H
 #include "PikaVM.h"
 #include "dataQueueObj.h"
 #include "dataStack.h"

+ 1 - 1
src/PikaPlatform.c

@@ -83,7 +83,7 @@ PIKA_WEAK int __platform_vsnprintf(char* buff,
 PIKA_WEAK int __platform_sprintf(char* buff, char* fmt, ...) {
     va_list args;
     va_start(args, fmt);
-    int res = vsnprintf(buff, PIKA_CONFIG_SPRINTF_BUFF_SIZE, fmt, args);
+    int res = vsnprintf(buff, PIKA_SPRINTF_BUFF_SIZE, fmt, args);
     va_end(args);
     return res;
 }

+ 2 - 2
src/PikaVM.h

@@ -25,8 +25,8 @@
  * SOFTWARE.
  */
 
-#ifndef __PIKA__VM__H
-#define __PIKA__VM__H
+#ifndef __PIKA_VM__H
+#define __PIKA_VM__H
 #include "PikaObj.h"
 #include "dataQueue.h"
 #include "dataStack.h"

+ 2 - 2
src/dataMemory.c

@@ -37,7 +37,7 @@ void* pikaMalloc(uint32_t size) {
     }
 
 //! if you unsure about the __impl_pikaMalloc, uncomment this to force alignment
-#if PIKA_CONFIG_ENABLE_ARG_ALIGN
+#if PIKA_ARG_ALIGN_ENABLE
     /* force alignment to avoid unaligned access */
     size = (size + 4 - 1) & ~(4 - 1);
 #endif
@@ -64,7 +64,7 @@ void pikaFree(void* mem, uint32_t size) {
     }
 
 //! if you unsure about the __impl_pikaMalloc, uncomment this to force alignment
-#if PIKA_CONFIG_ENABLE_ARG_ALIGN
+#if PIKA_ARG_ALIGN_ENABLE
     /* force alignment to avoid unaligned access */
     size = (size + 4 - 1) & ~(4 - 1);
 #endif

+ 3 - 3
src/dataStack.c

@@ -36,9 +36,9 @@ void stack_reset(Stack* stack) {
 
 int32_t stack_init(Stack* stack) {
     stack->stack_pyload =
-        arg_setContent(NULL, NULL, PIKA_CONFIG_STACK_BUFF_SIZE);
+        arg_setContent(NULL, NULL, PIKA_STACK_BUFF_SIZE);
     stack->stack_size_array =
-        arg_setContent(NULL, NULL, PIKA_CONFIG_STACK_BUFF_SIZE / 4);
+        arg_setContent(NULL, NULL, PIKA_STACK_BUFF_SIZE / 4);
     stack_reset(stack);
     return 0;
 };
@@ -74,7 +74,7 @@ int32_t stack_pushArg(Stack* stack, Arg* arg) {
     size_t size = arg_getTotleSize(arg);
 
 //! if you unsure about the __impl_pikaMalloc, uncomment this to force alignment
-#if PIKA_CONFIG_ENABLE_ARG_ALIGN
+#if PIKA_ARG_ALIGN_ENABLE
     /* force alignment to avoid unaligned access */
     size = (size + 4 - 1) & ~(4 - 1);
 #endif

+ 15 - 11
src/pikaConfigValid.h

@@ -28,25 +28,29 @@
 #define __PIKA_CFG_VALID_H__
 
     /* default configuration  */
-    #define PIKA_CONFIG_LINE_BUFF_SIZE 128
-    #define PIKA_CONFIG_SPRINTF_BUFF_SIZE 128
-    #define PIKA_CONFIG_STACK_BUFF_SIZE 256
-    #define PIKA_CONFIG_NAME_BUFF_SIZE 32
-    #define PIKA_CONFIG_PATH_BUFF_SIZE 64
-    #define PIKA_CONFIG_ENABLE_ARG_ALIGN 1
-    #undef PIKA_CONFIG_METHOD_CACHE_ENABLE
+    #define PIKA_LINE_BUFF_SIZE 128
+    #define PIKA_SPRINTF_BUFF_SIZE 128
+    #define PIKA_STACK_BUFF_SIZE 256
+    #define PIKA_NAME_BUFF_SIZE 32
+    #define PIKA_PATH_BUFF_SIZE 64
+    #define PIKA_ARG_ALIGN_ENABLE 1
+    #define PIKA_METHOD_CACHE_ENABLE 0
 
     #ifdef PIKA_CONFIG_ENABLE
         #include "pika_config.h"
     #else
-        #define PIKA_CONFIG_DEFAULT_SPACE
+        /* use size optimize as default */
+        #define PIKA_OPTIMIZE_SIZE
     #endif
 
-    #ifdef PIKA_CONFIG_DEFAULT_SPACE
+    #ifdef PIKA_OPTIMIZE_SIZE
+        #undef PIKA_METHOD_CACHE_ENABLE
+        #define PIKA_METHOD_CACHE_ENABLE 0
     #endif
 
-    #ifdef PIKA_CONFIG_DEFAULT_SPEED
-        #define PIKA_CONFIG_METHOD_CACHE_ENABLE
+    #ifdef PIKA_OPTIMIZE_SPEED
+        #undef PIKA_METHOD_CACHE_ENABLE
+        #define PIKA_METHOD_CACHE_ENABLE 1
     #endif
     /* configuration validation */