gc.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef VIRTUALMATH_GC_H
  2. #define VIRTUALMATH_GC_H
  3. #define START_GC true
  4. struct GCStatus{
  5. long int tmp_link; // tmp link的次数
  6. long int statement_link; // statement link的次数
  7. long int link; // 被直接link的次数
  8. bool continue_; // 是否迭代过
  9. };
  10. typedef struct GCStatus GCStatus;
  11. struct Inter;
  12. struct Value;
  13. struct LinkValue;
  14. struct HashTable;
  15. struct Var;
  16. struct VarList;
  17. void resetGC(GCStatus *gcs);
  18. void setGC(GCStatus *gcs);
  19. void gc_addTmpLink(GCStatus *gcs);
  20. void gc_addLink(GCStatus *gcs);
  21. void gc_addStatementLink(GCStatus *gcs);
  22. void gc_freeStatementLink(GCStatus *gcs);
  23. void gc_freeTmpLink(GCStatus *gcs);
  24. bool gc_IterAlready(GCStatus *gcs);
  25. bool gc_needFree(GCStatus *gcs);
  26. void gc_freeBase(struct Inter *inter);
  27. void gc_checkBase(struct Inter *inter);
  28. void gc_resetBase(struct Inter *inter);
  29. void gc_iterValue(struct Value *value);
  30. void gc_iterLinkValue(struct LinkValue *value);
  31. void gc_iterHashTable(struct HashTable *ht);
  32. void gc_iterVar(struct Var *var);
  33. void gc_varList(struct VarList *vl);
  34. void iterFreezeVarList(struct VarList *freeze, struct VarList *base, bool is_lock);
  35. void runFREEZE(struct Inter *inter, struct VarList *freeze, struct VarList *base, bool is_lock);
  36. void runGC(struct Inter *inter, int var_list, int link_value, int value, ...);
  37. #endif //VIRTUALMATH_GC_H