|
@@ -10,7 +10,7 @@ Inter *makeInter(char *out, char *error_, char *in, LinkValue *belong) {
|
|
tmp->package = NULL;
|
|
tmp->package = NULL;
|
|
|
|
|
|
setBaseInterData(tmp);
|
|
setBaseInterData(tmp);
|
|
- tmp->var_list = makeVarList(tmp, true);
|
|
|
|
|
|
+ tmp->var_list = makeVarList(tmp, true, NULL);
|
|
|
|
|
|
if (out != NULL) {
|
|
if (out != NULL) {
|
|
tmp->data.inter_stdout = fopen(out, "w");
|
|
tmp->data.inter_stdout = fopen(out, "w");
|
|
@@ -149,21 +149,30 @@ void freeInter(Inter *inter, bool show_gc) {
|
|
gc_runDelAll(inter);
|
|
gc_runDelAll(inter);
|
|
freeBaseInterData(inter);
|
|
freeBaseInterData(inter);
|
|
freePackage(inter->package);
|
|
freePackage(inter->package);
|
|
|
|
+ freeVarList(inter->var_list);
|
|
|
|
+
|
|
#if DEBUG
|
|
#if DEBUG
|
|
wint_t ch;
|
|
wint_t ch;
|
|
if (show_gc && (printf("\nEnter '1' to show gc: "), (fgetwc(stdin)) == L'1')) {
|
|
if (show_gc && (printf("\nEnter '1' to show gc: "), (fgetwc(stdin)) == L'1')) {
|
|
printGC(inter);
|
|
printGC(inter);
|
|
while ((ch = fgetwc(stdin)) != '\n' || ch == WEOF)
|
|
while ((ch = fgetwc(stdin)) != '\n' || ch == WEOF)
|
|
PASS;
|
|
PASS;
|
|
- }
|
|
|
|
|
|
+ } else
|
|
|
|
+ show_gc = false;
|
|
#endif
|
|
#endif
|
|
- freeVarList(inter->var_list);
|
|
|
|
|
|
+
|
|
while (inter->base != NULL)
|
|
while (inter->base != NULL)
|
|
freeValue(&inter->base);
|
|
freeValue(&inter->base);
|
|
while (inter->base_var != NULL)
|
|
while (inter->base_var != NULL)
|
|
freeVar(&inter->base_var);
|
|
freeVar(&inter->base_var);
|
|
while (inter->link_base != NULL)
|
|
while (inter->link_base != NULL)
|
|
freeLinkValue(&inter->link_base);
|
|
freeLinkValue(&inter->link_base);
|
|
|
|
+
|
|
|
|
+#if DEBUG
|
|
|
|
+ if (show_gc)
|
|
|
|
+ printGCHS(inter);
|
|
|
|
+#endif
|
|
|
|
+
|
|
while (inter->hash_base != NULL)
|
|
while (inter->hash_base != NULL)
|
|
freeHashTable(&inter->hash_base);
|
|
freeHashTable(&inter->hash_base);
|
|
memFree(inter);
|
|
memFree(inter);
|
|
@@ -219,24 +228,30 @@ void printGC(Inter *inter){
|
|
long int lv_tmp = 0;
|
|
long int lv_tmp = 0;
|
|
long int v_st = 0;
|
|
long int v_st = 0;
|
|
long int v_tmp = 0;
|
|
long int v_tmp = 0;
|
|
- long int h_tmp = 0;
|
|
|
|
printLinkValueGC("\n\nprintLinkValueGC TAG : freeInter", inter, &lv_tmp, &lv_st);
|
|
printLinkValueGC("\n\nprintLinkValueGC TAG : freeInter", inter, &lv_tmp, &lv_st);
|
|
printValueGC("\nprintValueGC TAG : freeInter", inter, &v_tmp, &v_st);
|
|
printValueGC("\nprintValueGC TAG : freeInter", inter, &v_tmp, &v_st);
|
|
printVarGC("\nprintVarGC TAG : freeInter", inter);
|
|
printVarGC("\nprintVarGC TAG : freeInter", inter);
|
|
- printHashTableGC("\nprintHashTableGC TAG : freeInter", inter, &h_tmp);
|
|
|
|
printf("\n");
|
|
printf("\n");
|
|
|
|
|
|
printf("linkvalue tmp link = %ld\n", lv_tmp);
|
|
printf("linkvalue tmp link = %ld\n", lv_tmp);
|
|
printf("linkvalue statement link = %ld\n", lv_st);
|
|
printf("linkvalue statement link = %ld\n", lv_st);
|
|
printf(" value tmp link = %ld\n", v_tmp);
|
|
printf(" value tmp link = %ld\n", v_tmp);
|
|
printf(" value statement link = %ld\n", v_st);
|
|
printf(" value statement link = %ld\n", v_st);
|
|
- printf("hashtable tmp link = %ld\n", h_tmp);
|
|
|
|
- printf(" tmp link count = %ld\n", lv_tmp + v_tmp + h_tmp);
|
|
|
|
|
|
+ printf(" tmp link count = %ld\n", lv_tmp + v_tmp);
|
|
printf("statement link count = %ld\n", lv_st + v_st);
|
|
printf("statement link count = %ld\n", lv_st + v_st);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void printGCHS(Inter *inter){ // 只输出hashtable
|
|
|
|
+#if START_GC
|
|
|
|
+ long int h_tmp = 0;
|
|
|
|
+ printHashTableGC("\nprintHashTableGC TAG : freeInter", inter, &h_tmp);
|
|
|
|
+ printf("\nhashtable tmp link = %ld\n", h_tmp);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
#if START_GC
|
|
#if START_GC
|
|
void printLinkValueGC(char *tag, Inter *inter, long *tmp_link, long *st_link) {
|
|
void printLinkValueGC(char *tag, Inter *inter, long *tmp_link, long *st_link) {
|
|
LinkValue *base = inter->link_base;
|
|
LinkValue *base = inter->link_base;
|
|
@@ -300,14 +315,13 @@ void printVarGC(char *tag, Inter *inter){
|
|
printf("inter->link_base.tmp_link = %ld :: %p\n", base->gc_status.tmp_link, base);
|
|
printf("inter->link_base.tmp_link = %ld :: %p\n", base->gc_status.tmp_link, base);
|
|
printf("inter->link_base.statement_link = %ld :: %p\n", base->gc_status.statement_link, base);
|
|
printf("inter->link_base.statement_link = %ld :: %p\n", base->gc_status.statement_link, base);
|
|
printf("inter->link_base.link = %ld :: %p\n", base->gc_status.link, base);
|
|
printf("inter->link_base.link = %ld :: %p\n", base->gc_status.link, base);
|
|
|
|
+ printf("str_name = %ls\n", base->name);
|
|
|
|
+ printf("name = ");
|
|
|
|
+ printValue(base->name_->value, stdout, false, true);
|
|
|
|
+ printf("\nvalue = ");
|
|
|
|
+ printValue(base->value->value, stdout, false, true);
|
|
|
|
+ printf("\n-------------------------------------------\n");
|
|
}
|
|
}
|
|
-
|
|
|
|
- printf("str_name = %ls\n", base->name);
|
|
|
|
- printf("name = ");
|
|
|
|
- printValue(base->name_->value, stdout, false, true);
|
|
|
|
- printf("\nvalue = ");
|
|
|
|
- printValue(base->value->value, stdout, false, true);
|
|
|
|
- printf("\n-------------------------------------------\n");
|
|
|
|
base = base->gc_next;
|
|
base = base->gc_next;
|
|
}
|
|
}
|
|
printf("printVarGC TAG : END\n");
|
|
printf("printVarGC TAG : END\n");
|