Browse Source

refactor: 去除了makeObject中的addTmpLink

SongZihuan 4 years ago
parent
commit
0c6f21ed6d
5 changed files with 1 additions and 5 deletions
  1. 0 1
      vmcore/ofunc/src/function.c
  2. 0 1
      vmcore/ofunc/src/object.c
  3. 0 1
      vmcore/src/__run.c
  4. 0 1
      vmcore/src/runfile.c
  5. 1 1
      vmcore/src/value.c

+ 0 - 1
vmcore/ofunc/src/function.c

@@ -23,7 +23,6 @@ static ResultType function_new(O_FUNC){
         Inherit *object_father = getInheritFromValueCore(inter->data.base_obj[B_FUNCTION]);
         Value *new_object = makeObject(inter, NULL, NULL, false, object_father);  // 不加入out_var
         value = makeLinkValue(new_object, belong, auto_aut, inter);
-        gc_freeTmpLink(&new_object->gc_status);
     }
 
     value->value->type = V_func;

+ 0 - 1
vmcore/ofunc/src/object.c

@@ -186,7 +186,6 @@ void makeBaseObject(Inter *inter, LinkValue *belong) {
     {
         Value *global_belong = makeObject(inter, copyVarList(inter->var_list, false, inter), NULL, true, NULL);
         g_belong = makeLinkValue(global_belong, belong, auto_aut, inter);
-        gc_freeTmpLink(&global_belong->gc_status);
         inter->base_belong = g_belong;
         gc_addStatementLink(&inter->base_belong->gc_status);
     }

+ 0 - 1
vmcore/src/__run.c

@@ -645,7 +645,6 @@ LinkValue *make_new(Inter *inter, LinkValue *belong, LinkValue *class){
     VarList *new_var = copyVarList(class->value->object.out_var, false, inter);
     Value *new_object = makeObject(inter, NULL, new_var, true, object_father);
     LinkValue *re = makeLinkValue(new_object, belong, auto_aut, inter);
-    gc_freeTmpLink(&new_object->gc_status);
     return re;
 }
 

+ 0 - 1
vmcore/src/runfile.c

@@ -218,7 +218,6 @@ static bool getPackage(LinkValue **imp_value, char *md5_str, char *split, int st
     } else
         *is_new = false;
     *imp_value = makeLinkValue(pg, belong, auto_aut, inter);
-    gc_freeTmpLink(&pg->gc_status);
     gc_addTmpLink(&(*imp_value)->gc_status);
     return true;
 }

+ 1 - 1
vmcore/src/value.c

@@ -4,7 +4,6 @@ Value *makeObject(Inter *inter, VarList *object, VarList *out_var, bool set_out_
     Value *tmp;
     MACRO_CALLOC(tmp, 1, sizeof(Value));
     setGC(&tmp->gc_status);
-    gc_addTmpLink(&tmp->gc_status);
     tmp->type = V_obj;
     tmp->gc_next = NULL;
 
@@ -209,6 +208,7 @@ Value *makeClassValue(VarList *var_list, Inter *inter, Inherit *father) {
     VarList *new_var = copyVarList(var_list, false, inter);
     tmp = makeObject(inter, NULL, new_var, true, father);
     tmp->type = V_class;
+    gc_addTmpLink(&tmp->gc_status);
     return tmp;
 }