diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-01-06 11:38:31 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-01-06 11:38:31 -0300 |
commit | 5ff408d2189c6c24fdf8908db4a31432bbdd6f15 (patch) | |
tree | bcd83d7547dab0d5418116eb10f9c601f2f2d3b9 /testes | |
parent | e3c83835e7b396ab7db538fb3b052f02d7807dee (diff) | |
download | lua-5ff408d2189c6c24fdf8908db4a31432bbdd6f15.tar.gz lua-5ff408d2189c6c24fdf8908db4a31432bbdd6f15.tar.bz2 lua-5ff408d2189c6c24fdf8908db4a31432bbdd6f15.zip |
Changed internal representation of booleans
Instead of an explicit value (field 'b'), true and false use different
tag variants. This avoids reading an extra field and results in more
direct code. (Most code that uses booleans needs to distinguish between
true and false anyway.)
Diffstat (limited to 'testes')
-rw-r--r-- | testes/code.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/testes/code.lua b/testes/code.lua index e12f3f91..34b04668 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
@@ -144,10 +144,10 @@ check(function (a,b,c,d) return a..b..c..d end, | |||
144 | 'MOVE', 'MOVE', 'MOVE', 'MOVE', 'CONCAT', 'RETURN1') | 144 | 'MOVE', 'MOVE', 'MOVE', 'MOVE', 'CONCAT', 'RETURN1') |
145 | 145 | ||
146 | -- not | 146 | -- not |
147 | check(function () return not not nil end, 'LOADBOOL', 'RETURN1') | 147 | check(function () return not not nil end, 'LOADFALSE', 'RETURN1') |
148 | check(function () return not not kFalse end, 'LOADBOOL', 'RETURN1') | 148 | check(function () return not not kFalse end, 'LOADFALSE', 'RETURN1') |
149 | check(function () return not not true end, 'LOADBOOL', 'RETURN1') | 149 | check(function () return not not true end, 'LOADTRUE', 'RETURN1') |
150 | check(function () return not not k3 end, 'LOADBOOL', 'RETURN1') | 150 | check(function () return not not k3 end, 'LOADTRUE', 'RETURN1') |
151 | 151 | ||
152 | -- direct access to locals | 152 | -- direct access to locals |
153 | check(function () | 153 | check(function () |
@@ -194,7 +194,7 @@ check(function () | |||
194 | local a,b | 194 | local a,b |
195 | a[kTrue] = false | 195 | a[kTrue] = false |
196 | end, | 196 | end, |
197 | 'LOADNIL', 'LOADBOOL', 'SETTABLE', 'RETURN0') | 197 | 'LOADNIL', 'LOADTRUE', 'SETTABLE', 'RETURN0') |
198 | 198 | ||
199 | 199 | ||
200 | -- equalities | 200 | -- equalities |