aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lopcodes.h5
-rw-r--r--manual/manual.of16
-rw-r--r--testes/heavy.lua18
3 files changed, 23 insertions, 16 deletions
diff --git a/lopcodes.h b/lopcodes.h
index f7bded2c..f5c95151 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -340,7 +340,7 @@ OP_VARARG,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */
340 340
341OP_GETVARG, /* A B C R[A] := R[B][R[C]], R[B] is vararg parameter */ 341OP_GETVARG, /* A B C R[A] := R[B][R[C]], R[B] is vararg parameter */
342 342
343OP_ERRNNIL,/* A Bx raise error if R[A] ~= nil (K[Bx] is global name)*/ 343OP_ERRNNIL,/* A Bx raise error if R[A] ~= nil (K[Bx - 1] is global name)*/
344 344
345OP_VARARGPREP,/* (adjust vararg parameters) */ 345OP_VARARGPREP,/* (adjust vararg parameters) */
346 346
@@ -386,6 +386,9 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
386 power of 2) plus 1, or zero for size zero. If not k, the array size 386 power of 2) plus 1, or zero for size zero. If not k, the array size
387 is vC. Otherwise, the array size is EXTRAARG _ vC. 387 is vC. Otherwise, the array size is EXTRAARG _ vC.
388 388
389 (*) In OP_ERRNNIL, (Bx == 0) means index of global name doesn't
390 fit in Bx. (So, that name is not available for the instruction.)
391
389 (*) For comparisons, k specifies what condition the test should accept 392 (*) For comparisons, k specifies what condition the test should accept
390 (true or false). 393 (true or false).
391 394
diff --git a/manual/manual.of b/manual/manual.of
index 9b6976ca..96203d7f 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -2402,7 +2402,7 @@ g(3, 4, 5, 8) a=3, b=4, ... -> 5 8
2402g(5, r()) a=5, b=1, ... -> 2 3 2402g(5, r()) a=5, b=1, ... -> 2 3
2403} 2403}
2404 2404
2405The presence of a varag table in a variadic function is indicated 2405The presence of a vararg table in a variadic function is indicated
2406by a name after the three dots. 2406by a name after the three dots.
2407When present, 2407When present,
2408a vararg table behaves like a read-only local variable 2408a vararg table behaves like a read-only local variable
@@ -2418,8 +2418,9 @@ local <const> name = table.pack(...)
2418} 2418}
2419 2419
2420As an optimization, 2420As an optimization,
2421if the vararg table is used only as a base in indexing expressions 2421if the vararg table is used only as the base table
2422(the @T{t} in @T{t[exp]} or @T{t.id}) and it is not an upvalue, 2422in the syntactic constructions @T{t[exp]} or @T{t.id})
2423and it is not an upvalue,
2423the code does not create an actual table and instead translates 2424the code does not create an actual table and instead translates
2424the indexing expressions into accesses to the internal vararg data. 2425the indexing expressions into accesses to the internal vararg data.
2425 2426
@@ -2427,8 +2428,7 @@ the indexing expressions into accesses to the internal vararg data.
2427 2428
2428} 2429}
2429 2430
2430@sect3{multires| @title{Lists of expressions, multiple results, 2431@sect3{multires| @title{Lists of Expressions, Multiple Results, and Adjustment}
2431and adjustment}
2432 2432
2433Both function calls and vararg expressions can result in multiple values. 2433Both function calls and vararg expressions can result in multiple values.
2434These expressions are called @def{multires expressions}. 2434These expressions are called @def{multires expressions}.
@@ -2686,7 +2686,7 @@ which behaves like a nil value.
2686 2686
2687} 2687}
2688 2688
2689@sect3{constchar|@title{Pointers to strings} 2689@sect3{constchar|@title{Pointers to Strings}
2690 2690
2691Several functions in the API return pointers (@T{const char*}) 2691Several functions in the API return pointers (@T{const char*})
2692to Lua strings in the stack. 2692to Lua strings in the stack.
@@ -4126,6 +4126,8 @@ Lua still has to allocate a header for the string.
4126In case of a memory-allocation error, 4126In case of a memory-allocation error,
4127Lua will call @id{falloc} before raising the error. 4127Lua will call @id{falloc} before raising the error.
4128 4128
4129The function returns a pointer to the string (that is, @id{s}).
4130
4129} 4131}
4130 4132
4131 4133
@@ -8413,7 +8415,7 @@ a value greater than any other numeric value.
8413 8415
8414} 8416}
8415 8417
8416@LibEntry{math.ldexp(m, e)| 8418@LibEntry{math.ldexp (m, e)|
8417 8419
8418Returns @M{m2@sp{e}}, where @id{e} is an integer. 8420Returns @M{m2@sp{e}}, where @id{e} is an integer.
8419 8421
diff --git a/testes/heavy.lua b/testes/heavy.lua
index 3b4e4ce3..e7219a91 100644
--- a/testes/heavy.lua
+++ b/testes/heavy.lua
@@ -1,6 +1,8 @@
1-- $Id: testes/heavy.lua,v $ 1-- $Id: testes/heavy.lua,v $
2-- See Copyright Notice in file lua.h 2-- See Copyright Notice in file lua.h
3 3
4global <const> *
5
4local function teststring () 6local function teststring ()
5 print("creating a string too long") 7 print("creating a string too long")
6 do 8 do
@@ -47,9 +49,9 @@ local function loadrep (x, what)
47end 49end
48 50
49 51
50function controlstruct () 52local function controlstruct ()
51 print("control structure too long") 53 print("control structure too long")
52 local lim = ((1 << 24) - 2) // 3 54 local lim = ((1 << 24) - 2) // 4
53 local s = string.rep("a = a + 1\n", lim) 55 local s = string.rep("a = a + 1\n", lim)
54 s = "while true do " .. s .. "end" 56 s = "while true do " .. s .. "end"
55 assert(load(s)) 57 assert(load(s))
@@ -63,7 +65,7 @@ function controlstruct ()
63end 65end
64 66
65 67
66function manylines () 68local function manylines ()
67 print("loading chunk with too many lines") 69 print("loading chunk with too many lines")
68 local st, msg = loadrep("\n", "lines") 70 local st, msg = loadrep("\n", "lines")
69 assert(not st and string.find(msg, "too many lines")) 71 assert(not st and string.find(msg, "too many lines"))
@@ -71,7 +73,7 @@ function manylines ()
71end 73end
72 74
73 75
74function hugeid () 76local function hugeid ()
75 print("loading chunk with huge identifier") 77 print("loading chunk with huge identifier")
76 local st, msg = loadrep("a", "chars") 78 local st, msg = loadrep("a", "chars")
77 assert(not st and 79 assert(not st and
@@ -80,7 +82,7 @@ function hugeid ()
80 print('+') 82 print('+')
81end 83end
82 84
83function toomanyinst () 85local function toomanyinst ()
84 print("loading chunk with too many instructions") 86 print("loading chunk with too many instructions")
85 local st, msg = loadrep("a = 10; ", "instructions") 87 local st, msg = loadrep("a = 10; ", "instructions")
86 print('+') 88 print('+')
@@ -107,7 +109,7 @@ local function loadrepfunc (prefix, f)
107end 109end
108 110
109 111
110function toomanyconst () 112local function toomanyconst ()
111 print("loading function with too many constants") 113 print("loading function with too many constants")
112 loadrepfunc("function foo () return {0,", 114 loadrepfunc("function foo () return {0,",
113 function (n) 115 function (n)
@@ -126,7 +128,7 @@ function toomanyconst ()
126end 128end
127 129
128 130
129function toomanystr () 131local function toomanystr ()
130 local a = {} 132 local a = {}
131 local st, msg = pcall(function () 133 local st, msg = pcall(function ()
132 for i = 1, math.huge do 134 for i = 1, math.huge do
@@ -144,7 +146,7 @@ function toomanystr ()
144end 146end
145 147
146 148
147function toomanyidx () 149local function toomanyidx ()
148 local a = {} 150 local a = {}
149 local st, msg = pcall(function () 151 local st, msg = pcall(function ()
150 for i = 1, math.huge do 152 for i = 1, math.huge do