aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lobject.h10
-rw-r--r--testes/gc.lua22
-rw-r--r--testes/libs/makefile10
3 files changed, 17 insertions, 25 deletions
diff --git a/lobject.h b/lobject.h
index 95f8e188..f21e8a91 100644
--- a/lobject.h
+++ b/lobject.h
@@ -89,8 +89,8 @@ typedef struct TValue {
89#define righttt(obj) (ttypetag(obj) == gcvalue(obj)->tt) 89#define righttt(obj) (ttypetag(obj) == gcvalue(obj)->tt)
90 90
91#define checkliveness(L,obj) \ 91#define checkliveness(L,obj) \
92 lua_longassert(!iscollectable(obj) || \ 92 ((void)L, lua_longassert(!iscollectable(obj) || \
93 (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))) 93 (righttt(obj) && (L == NULL || !isdead(G(L),gcvalue(obj))))))
94 94
95 95
96/* Macros to set values */ 96/* Macros to set values */
@@ -100,7 +100,7 @@ typedef struct TValue {
100#define setobj(L,obj1,obj2) \ 100#define setobj(L,obj1,obj2) \
101 { TValue *io1=(obj1); const TValue *io2=(obj2); \ 101 { TValue *io1=(obj1); const TValue *io2=(obj2); \
102 io1->value_ = io2->value_; io1->tt_ = io2->tt_; \ 102 io1->value_ = io2->value_; io1->tt_ = io2->tt_; \
103 (void)L; checkliveness(L,io1); lua_assert(!isreallyempty(io1)); } 103 checkliveness(L,io1); lua_assert(!isreallyempty(io1)); }
104 104
105/* 105/*
106** different types of assignments, according to destination 106** different types of assignments, according to destination
@@ -651,14 +651,14 @@ typedef union Node {
651#define setnodekey(L,node,obj) \ 651#define setnodekey(L,node,obj) \
652 { Node *n_=(node); const TValue *io_=(obj); \ 652 { Node *n_=(node); const TValue *io_=(obj); \
653 n_->u.key_val = io_->value_; n_->u.key_tt = io_->tt_; \ 653 n_->u.key_val = io_->value_; n_->u.key_tt = io_->tt_; \
654 (void)L; checkliveness(L,io_); } 654 checkliveness(L,io_); }
655 655
656 656
657/* copy a value from a key */ 657/* copy a value from a key */
658#define getnodekey(L,obj,node) \ 658#define getnodekey(L,obj,node) \
659 { TValue *io_=(obj); const Node *n_=(node); \ 659 { TValue *io_=(obj); const Node *n_=(node); \
660 io_->value_ = n_->u.key_val; io_->tt_ = n_->u.key_tt; \ 660 io_->value_ = n_->u.key_val; io_->tt_ = n_->u.key_tt; \
661 (void)L; checkliveness(L,io_); } 661 checkliveness(L,io_); }
662 662
663 663
664/* 664/*
diff --git a/testes/gc.lua b/testes/gc.lua
index 6d24e0d8..9ea054c1 100644
--- a/testes/gc.lua
+++ b/testes/gc.lua
@@ -99,35 +99,28 @@ local function GC() GC1(); GC2() end
99do 99do
100 print("creating many objects") 100 print("creating many objects")
101 101
102 local contCreate = 0
103
104 local limit = 5000 102 local limit = 5000
105 103
106 while contCreate <= limit do 104 for i = 1, limit do
107 local a = {}; a = nil 105 local a = {}; a = nil
108 contCreate = contCreate+1
109 end 106 end
110 107
111 local a = "a" 108 local a = "a"
112 109
113 contCreate = 0 110 for i = 1, limit do
114 while contCreate <= limit do 111 a = i .. "b";
115 a = contCreate .. "b";
116 a = string.gsub(a, '(%d%d*)', "%1 %1") 112 a = string.gsub(a, '(%d%d*)', "%1 %1")
117 a = "a" 113 a = "a"
118 contCreate = contCreate+1
119 end 114 end
120 115
121 116
122 contCreate = 0
123 117
124 a = {} 118 a = {}
125 119
126 function a:test () 120 function a:test ()
127 while contCreate <= limit do 121 for i = 1, limit do
128 load(string.format("function temp(a) return 'a%d' end", contCreate), "")() 122 load(string.format("function temp(a) return 'a%d' end", i), "")()
129 assert(temp() == string.format('a%d', contCreate)) 123 assert(temp() == string.format('a%d', i))
130 contCreate = contCreate+1
131 end 124 end
132 end 125 end
133 126
@@ -166,9 +159,8 @@ print('long strings')
166x = "01234567890123456789012345678901234567890123456789012345678901234567890123456789" 159x = "01234567890123456789012345678901234567890123456789012345678901234567890123456789"
167assert(string.len(x)==80) 160assert(string.len(x)==80)
168s = '' 161s = ''
169n = 0
170k = math.min(300, (math.maxinteger // 80) // 2) 162k = math.min(300, (math.maxinteger // 80) // 2)
171while n < k do s = s..x; n=n+1; j=tostring(n) end 163for n = 1, k do s = s..x; j=tostring(n) end
172assert(string.len(s) == k*80) 164assert(string.len(s) == k*80)
173s = string.sub(s, 1, 10000) 165s = string.sub(s, 1, 10000)
174s, i = string.gsub(s, '(%d%d%d%d)', '') 166s, i = string.gsub(s, '(%d%d%d%d)', '')
diff --git a/testes/libs/makefile b/testes/libs/makefile
index 698f8984..a1330920 100644
--- a/testes/libs/makefile
+++ b/testes/libs/makefile
@@ -11,17 +11,17 @@ CFLAGS = -Wall -std=gnu99 -O2 -I$(LUA_DIR) -fPIC -shared
11all: lib1.so lib11.so lib2.so lib21.so lib2-v2.so 11all: lib1.so lib11.so lib2.so lib21.so lib2-v2.so
12 touch all 12 touch all
13 13
14lib1.so: lib1.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/ltests.h 14lib1.so: lib1.c $(LUA_DIR)/luaconf.h
15 $(CC) $(CFLAGS) -o lib1.so lib1.c 15 $(CC) $(CFLAGS) -o lib1.so lib1.c
16 16
17lib11.so: lib11.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/ltests.h 17lib11.so: lib11.c $(LUA_DIR)/luaconf.h
18 $(CC) $(CFLAGS) -o lib11.so lib11.c 18 $(CC) $(CFLAGS) -o lib11.so lib11.c
19 19
20lib2.so: lib2.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/ltests.h 20lib2.so: lib2.c $(LUA_DIR)/luaconf.h
21 $(CC) $(CFLAGS) -o lib2.so lib2.c 21 $(CC) $(CFLAGS) -o lib2.so lib2.c
22 22
23lib21.so: lib21.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/ltests.h 23lib21.so: lib21.c $(LUA_DIR)/luaconf.h
24 $(CC) $(CFLAGS) -o lib21.so lib21.c 24 $(CC) $(CFLAGS) -o lib21.so lib21.c
25 25
26lib2-v2.so: lib21.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/ltests.h 26lib2-v2.so: lib21.c $(LUA_DIR)/luaconf.h
27 $(CC) $(CFLAGS) -o lib2-v2.so lib22.c 27 $(CC) $(CFLAGS) -o lib2-v2.so lib22.c