Commit Graph

2254 Commits

Author SHA1 Message Date
niravthakkar
7aae451d93 Reverting the changes, as its breaking the build
The above expression works on CLI, but its failing here, not sure whats going wrong , Please let me know your comments on it
2017-01-04 18:15:57 +05:30
ketank-new
b92584b497 Added test for OS based functions 2017-01-04 17:45:19 +05:30
niravthakkar
1fe2176241 Updated memory parsing
The values of base and index registers have been passed as 0, if only displacement is passed
the displacement is assumed to be alphanumeric (since label might be used)
2017-01-04 17:43:53 +05:30
ketank-new
8b20a0eae2 Added some math function tests 2017-01-04 17:25:13 +05:30
niravthakkar
6bbfa48b93 Updated the memory parsing
It accepts 2 registers, without the displacement
2017-01-04 16:20:56 +05:30
Michael Munday
86e5e57f4c Add emptystr implementation and stub out co-routine functions. 2017-01-03 16:44:36 -05:00
Michael Munday
e739ffedce Implement string.byte and string.char. 2017-01-03 16:36:34 -05:00
Michael Munday
65af21e2ed Implement more math functions.
Everything apart from min/max should now be working.
2017-01-03 16:12:22 -05:00
Michael Munday
8e747c5406 Implement metamethod support.
Allows metamethod tables to be get and set.
2017-01-03 12:17:34 -05:00
ketank-new
47012cea2f Added example for RX-f based instruction mode 2017-01-03 17:08:30 +05:30
niravthakkar
b84dd8e65d Added couple of instructions required by test-case
maeb(RXF) and cegbra(RRF-e)  have been added
2017-01-03 16:16:29 +05:30
niravthakkar
d02e076507 Minor fix, for arguments in shift operations 2017-01-03 15:55:25 +05:30
niravthakkar
dd6ecfa73d Added SIY addressing mode support
Added SIY add mode, and Updated the number of parameters for few of the instructions of RS-a mode
2017-01-03 15:51:23 +05:30
ketank-new
a13e120fd5 Added definition to function 'twice()' 2017-01-02 17:13:05 +05:30
ketank-new
bc065ce2bf Added switch case and while loop test 2017-01-02 17:05:47 +05:30
ketank-new
5dd0c245b7 Updated with ipairs & table based example 2017-01-02 14:29:43 +05:30
ketank-new
700f0e75c1 Updated test.lua withe more tests 2017-01-02 13:56:40 +05:30
ketank-new
703398877b Added test.lua file
file consist of code snippets which execute successfully on luajit v2.1
2017-01-02 11:19:52 +05:30
Michael Munday
39c37a1a1a Remove debug code from tostring. 2016-12-30 16:33:35 -05:00
Michael Munday
4f1c4dc514 Implement pairs (including ISNEXT and ITERN).
Allows use of the pairs iterator, for example:

t = { alpha = 1, beta = 2 }
for k,v in pairs(t)
  print(k, v)
end

-- prints:
-- alpha	1
-- beta	2
2016-12-30 14:51:30 -05:00
Michael Munday
6fbe356507 Implement USETN, USETP and USETS.
Allows constant numbers, primitives (nil, true, false) and strings
to be assigned to upvalues in closures.
2016-12-30 13:33:31 -05:00
Michael Munday
a5d9604419 Implement USETV.
Allows upvalues to be set in closures, for example:

function f(x)
  local y = x
  local j = function(z)
    y = y + z
  end
  for i=1,3 do
    j(i)
    print(y)
  end
end

f(2) -- prints: 3 5 8
2016-12-30 13:00:38 -05:00
Michael Munday
21073df0dc Add FORL implementation (just fallthrough). 2016-12-30 12:27:08 -05:00
Michael Munday
5e7121c625 Implement ipairs.
Allows the use of the ipairs iterator, for example:

t = { "i", "robot" }
for i,v in ipairs(t) do
  print(i, v)
end
-- prints:
-- 1	i
-- 2	robot
2016-12-30 11:40:39 -05:00
Michael Munday
21f2fdfab2 Partially implement ipairs.
Still need to handle ipairs_aux.
2016-12-29 17:37:11 -05:00
Michael Munday
12602d2a1f Fix for DynASM buffer overflow.
Need to include all actions with arguments against MAXSECPOS.
2016-12-29 16:50:58 -05:00
Michael Munday
e6eb12b268 Implement bit operations.
See http://bitop.luajit.org/api.html for more information.

Bytecode listing is now supported, for example:

$ ./luajit -bl -e 'a=1'
-- BYTECODE -- "a=1":0-1
0001    KSHORT   0   1
0002    GSET     0   0      ; "a"
0003    RET0     0   1
2016-12-29 15:07:51 -05:00
Michael Munday
e8ca7b8799 Implement CAT.
Allows the use of the '..' operator, for example:

x = "hello"
y = " "
z = "world!"
print(x..y..z) -- prints 'hello world!'
2016-12-29 11:23:45 -05:00
Michael Munday
29223bb979 Implement POW.
Allows use of the '^' operator, for example:

x = 2
y = 3
print(x ^ y) -- prints 8
2016-12-29 11:10:18 -05:00
Michael Munday
230a4aa424 Implement KNIL and CALLMT. 2016-12-28 17:55:10 -05:00
Michael Munday
2584c6d5a8 Implement ISNUM, ISTYPE, TGETR and TSETR. 2016-12-28 17:01:09 -05:00
Michael Munday
5dc644ad89 Implement LOOP.
Allows for while and repeat loops, for example:

x = 0
while x < 5 do
  print(x)
  x = x + 1
end

-- prints:
-- 0
-- 1
-- 2
-- 3
-- 4
2016-12-28 14:13:08 -05:00
Michael Munday
6673652fd9 Implement TSETM and VARG.
Allows varargs to be used, for example:

function sel(n, ...)
  local arg = {...}
  return arg[n]
end

print(sel(2, 3, 4, 5)) -- prints 4
2016-12-28 13:21:06 -05:00
Michael Munday
aba9cfb2a8 Implement UGET.
Allows simple closures, for example:

function f(x)
  return function() return x end
end

y = f(1)
print(y()) -- prints 1
2016-12-28 10:58:45 -05:00
Michael Munday
354b5c748b Implement a UCLO, ff_assert and a couple of other bits.
Needed to get -bl working, still more to do though.
2016-12-22 15:40:25 -05:00
Michael Munday
077ccc8658 Implement LEN.
Enables length of tables and strings to be taken, for example:

t = "hello"
print(#t) -- prints 5
t = {1,2}
print(#t) -- prints 2
2016-12-22 14:59:37 -05:00
Michael Munday
c0c155e45e Implement/fix TGETS and TSETS.
Allows string keys in tables, for example:

t = {}
t["hello"] = 1
print(t["hello"]) -- prints 1
2016-12-22 14:40:31 -05:00
Michael Munday
cab03375f1 Implement TGETV and TSETV.
Allows table entries to be get and set using variables, for example:

t = {4,5}
i = 1
print(t[i]) -- prints 4
t[i] = 3
print(t[i]) -- prints 3
2016-12-22 14:20:47 -05:00
Michael Munday
20f05a4e20 Implement more tset and tget metamethods.
This allows table entries to be get and set even if they don't
already exist, for example:

t = {}
print(t[1]) -- prints nil
t[1] = 3
print(t[1]) -- prints 3
2016-12-22 13:50:59 -05:00
Michael Munday
01dbd6dfa2 Implement TDUP, TGETB and TSETB.
Allows some simple table operations, for example:

t = {1, 2}
print(t[1]) -- prints 1
t[1] = 3
print(t[1]) -- prints 3
2016-12-22 13:16:02 -05:00
Michael Munday
6fc4c0c1a8 Fix BC_MCALL
RC and RD are the same register on x64, so sometimes it uses them
interchangeably. Probably we should make them the same register
on s390x, but that would involve changing the instruction decode
code which I would rather leave until we have a test suite passing.
2016-12-22 12:41:00 -05:00
Michael Munday
1825037538 Implement table creation and printing. 2016-12-21 18:02:43 -05:00
Michael Munday
e19544ae9a Implement unary minus. 2016-12-21 14:03:58 -05:00
Michael Munday
9da6ff7ea3 Implement more equality checks. 2016-12-21 13:21:12 -05:00
Michael Munday
8518df8e56 Implement some boolean operations. 2016-12-21 12:49:53 -05:00
Michael Munday
ae38a6913e Add support for numeric equality checks. 2016-12-21 11:02:53 -05:00
ketank-new
4853da820a Added test example for RXE mode 2016-12-21 18:43:25 +05:30
Michael Munday
b5aa0d077c Fix bug in division. 2016-12-20 17:26:33 -05:00
Michael Munday
eda56c9a44 Add support for if statements. 2016-12-20 17:10:38 -05:00
Michael Munday
90334d3be9 Add support for function definitions. 2016-12-20 15:49:21 -05:00