diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-05-23 12:43:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-05-23 12:43:14 -0300 |
commit | e29f3a57511565caf117cf3c2e5e4ed8f22869cb (patch) | |
tree | c8a978355fba7ae68b5b9b8e2c8dfeb4afec641e | |
parent | 21ed264a38862a25964fc02365e1deea5ffcb6c9 (diff) | |
download | lua-e29f3a57511565caf117cf3c2e5e4ed8f22869cb.tar.gz lua-e29f3a57511565caf117cf3c2e5e4ed8f22869cb.tar.bz2 lua-e29f3a57511565caf117cf3c2e5e4ed8f22869cb.zip |
definition of 'GCSTEPSIZE' moved to header file + small changes
-rw-r--r-- | lgc.c | 7 | ||||
-rw-r--r-- | lgc.h | 16 |
2 files changed, 13 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.126 2012/05/22 17:50:39 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.127 2012/05/22 18:38:56 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -24,11 +24,8 @@ | |||
24 | 24 | ||
25 | 25 | ||
26 | 26 | ||
27 | /* how much to allocate before next GC step */ | ||
28 | #define GCSTEPSIZE (cast_int(256 * sizeof(void*))) | ||
29 | |||
30 | /* cost of sweeping one element (half the size of a small object) */ | 27 | /* cost of sweeping one element (half the size of a small object) */ |
31 | #define GCSWEEPCOST ((sizeof(TString) + 2) / 2) | 28 | #define GCSWEEPCOST ((sizeof(TString) + 4) / 2) |
32 | 29 | ||
33 | /* maximum number of elements to sweep in each single step */ | 30 | /* maximum number of elements to sweep in each single step */ |
34 | #define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) | 31 | #define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.h,v 2.54 2012/05/11 19:22:33 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.55 2012/05/21 13:18:10 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -20,13 +20,19 @@ | |||
20 | ** is that a black object can never point to a white one. Moreover, | 20 | ** is that a black object can never point to a white one. Moreover, |
21 | ** any gray object must be in a "gray list" (gray, grayagain, weak, | 21 | ** any gray object must be in a "gray list" (gray, grayagain, weak, |
22 | ** allweak, ephemeron) so that it can be visited again before finishing | 22 | ** allweak, ephemeron) so that it can be visited again before finishing |
23 | ** the collection cycle. (These rule does not apply to strings, | 23 | ** the collection cycle. These lists have no meaning when the invariant |
24 | ** which are never black but do not need to be visited again.) | 24 | ** is not being enforced (e.g., sweep phase). |
25 | ** These lists have no meaning when the invariant is not being enforced | ||
26 | ** (e.g., sweep phase). | ||
27 | */ | 25 | */ |
28 | 26 | ||
29 | 27 | ||
28 | |||
29 | /* how much to allocate before next GC step */ | ||
30 | #if !defined(GCSTEPSIZE) | ||
31 | /* ~100 small strings */ | ||
32 | #define GCSTEPSIZE (cast_int(100 * sizeof(TString))) | ||
33 | #endif | ||
34 | |||
35 | |||
30 | /* | 36 | /* |
31 | ** Possible states of the Garbage Collector | 37 | ** Possible states of the Garbage Collector |
32 | */ | 38 | */ |