aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lgc.c7
-rw-r--r--lstrlib.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/lgc.c b/lgc.c
index cada07d9..c0d68377 100644
--- a/lgc.c
+++ b/lgc.c
@@ -465,6 +465,8 @@ static void restartcollection (global_State *g) {
465** TOUCHED1 objects need to be in the list. TOUCHED2 doesn't need to go 465** TOUCHED1 objects need to be in the list. TOUCHED2 doesn't need to go
466** back to a gray list, but then it must become OLD. (That is what 466** back to a gray list, but then it must become OLD. (That is what
467** 'correctgraylist' does when it finds a TOUCHED2 object.) 467** 'correctgraylist' does when it finds a TOUCHED2 object.)
468** This function is a no-op in incremental mode, as objects cannot be
469** marked as touched in that mode.
468*/ 470*/
469static void genlink (global_State *g, GCObject *o) { 471static void genlink (global_State *g, GCObject *o) {
470 lua_assert(isblack(o)); 472 lua_assert(isblack(o));
@@ -480,7 +482,8 @@ static void genlink (global_State *g, GCObject *o) {
480** Traverse a table with weak values and link it to proper list. During 482** Traverse a table with weak values and link it to proper list. During
481** propagate phase, keep it in 'grayagain' list, to be revisited in the 483** propagate phase, keep it in 'grayagain' list, to be revisited in the
482** atomic phase. In the atomic phase, if table has any white value, 484** atomic phase. In the atomic phase, if table has any white value,
483** put it in 'weak' list, to be cleared. 485** put it in 'weak' list, to be cleared; otherwise, call 'genlink'
486** to check table age in generational mode.
484*/ 487*/
485static void traverseweakvalue (global_State *g, Table *h) { 488static void traverseweakvalue (global_State *g, Table *h) {
486 Node *n, *limit = gnodelast(h); 489 Node *n, *limit = gnodelast(h);
@@ -501,6 +504,8 @@ static void traverseweakvalue (global_State *g, Table *h) {
501 linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ 504 linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */
502 else if (hasclears) 505 else if (hasclears)
503 linkgclist(h, g->weak); /* has to be cleared later */ 506 linkgclist(h, g->weak); /* has to be cleared later */
507 else
508 genlink(g, obj2gco(h));
504} 509}
505 510
506 511
diff --git a/lstrlib.c b/lstrlib.c
index 321d6a0b..306cd0bf 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1544,8 +1544,10 @@ static KOption getdetails (Header *h, size_t totalsize, const char **fmt,
1544 else { 1544 else {
1545 if (align > h->maxalign) /* enforce maximum alignment */ 1545 if (align > h->maxalign) /* enforce maximum alignment */
1546 align = h->maxalign; 1546 align = h->maxalign;
1547 if (l_unlikely(!ispow2(align))) /* not a power of 2? */ 1547 if (l_unlikely(!ispow2(align))) { /* not a power of 2? */
1548 *ntoalign = 0; /* to avoid warnings */
1548 luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); 1549 luaL_argerror(h->L, 1, "format asks for alignment not power of 2");
1550 }
1549 else { 1551 else {
1550 /* 'szmoda' = totalsize % align */ 1552 /* 'szmoda' = totalsize % align */
1551 unsigned szmoda = cast_uint(totalsize & (align - 1)); 1553 unsigned szmoda = cast_uint(totalsize & (align - 1));