diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-30 14:49:18 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-30 14:49:18 -0300 |
| commit | 36de01d9885562444ae2e2a3e0b7e01b3fb8743b (patch) | |
| tree | 7aed386cc8d13e3b2a960404d2cf605d8090d571 /testes | |
| parent | 7fbe2158089898f09d741e991737f282e514ffaa (diff) | |
| download | lua-36de01d9885562444ae2e2a3e0b7e01b3fb8743b.tar.gz lua-36de01d9885562444ae2e2a3e0b7e01b3fb8743b.tar.bz2 lua-36de01d9885562444ae2e2a3e0b7e01b3fb8743b.zip | |
Changes in cache for function constants
In 'lcode.c', when adding constants to the list of constants of a
function, integers represent themselves in the cache and floats
with integral values get a small delta to avoid collision with
integers. (This change avoids creating artificial addresses; the old
implementation converted integers to pointers to index the cache.)
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/code.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testes/code.lua b/testes/code.lua index 4e00309f..543743fc 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
| @@ -69,6 +69,20 @@ foo = function (f, a) | |||
| 69 | checkKlist(foo, {100000, 100000.0, -100000, -100000.0}) | 69 | checkKlist(foo, {100000, 100000.0, -100000, -100000.0}) |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | -- floats x integers | ||
| 73 | foo = function (t, a) | ||
| 74 | t[a] = 1; t[a] = 1.0 | ||
| 75 | t[a] = 1; t[a] = 1.0 | ||
| 76 | t[a] = 2; t[a] = 2.0 | ||
| 77 | t[a] = 0; t[a] = 0.0 | ||
| 78 | t[a] = 1; t[a] = 1.0 | ||
| 79 | t[a] = 2; t[a] = 2.0 | ||
| 80 | t[a] = 0; t[a] = 0.0 | ||
| 81 | end | ||
| 82 | |||
| 83 | checkKlist(foo, {1, 1.0, 2, 2.0, 0, 0.0}) | ||
| 84 | |||
| 85 | |||
| 72 | -- testing opcodes | 86 | -- testing opcodes |
| 73 | 87 | ||
| 74 | -- check that 'f' opcodes match '...' | 88 | -- check that 'f' opcodes match '...' |
