-
Notifications
You must be signed in to change notification settings - Fork 64
Changes
Removed some arithmetic operators as they were redundant. Added ADDFIRN and ADDIIRN for when the constant is small and can be set to operand C. More such cleanup needed for SUB & MUL operators.
More changes to support array types. Also better support for inferring types in fornum statements.
Added new op codes for creating int and double arrays. Made changes to the parser to recognize array declarations. Made changes to VM to handle array types. TODO - need to initialize array variables. Need to allow set a typed variable to a value of array element if types are same. Need to ensure that user cannot subvert the array type. Need to set extra elements to nil to ensure compatibility.
Started work on supporting array type. Right now working on enhancing the table type to support specialized array operations.
More fixes for how we identify the types for variable in local declaration statements. int and double variables initialized to 0 using new opcodes LOADIZ and LOADFZ. Also changed the type identification referred to below to use the 'nactvar' instead of relying on 'startpc'.
Fixed an issue with type identification of registers - as Lua code can have declarations mixed with executable code, a reference to a local variable needs to be checked against the code range where the variable is 'visible'. The code that checks for the type of a register was missing this check and hence incorrectly identifying the type. Also added ability to control and generate debug messages at run time - focus is on parser and code generation.
Added opcodes for coercing values to expected types after a function call. Expanded the arithmetic opcodes to include MUL, DIV and SUB operations.
Working on figuring out a way to coerce types after a function call. This is necessary due to dynamic nature of Lua - the return type of a function is not known at compilation time.
Added the ability to generate code for local variables with type decorations (only int and double) for now, and support for type specific instructions to perform arithmetic operations; also added code to validate types to ensure that variables that are typed do not get assigned values of wrong type.
Went back to 32-bit instructions due to complexity of the 2-instruction approach.
Added RAVI opcodes for eq, lt, le operators Enhanced parser to recognise local name:type syntax. But constants are not typed yet.
Added RAVI opcode implementation in lvm.c for add, sub, mul and div operations.
Added various opcodes in opcodes.h. OP_RAVI opcode introduces a 64-bit instruction where the real opcode is stored in 10 bits - and a,b & c take up 16 bits each.
Added RAVI opcode UNMF to the VM - floating point unary minus.
Need to add more opcodes. So as a first step modified the SIZE_OP
to 8 bits and adjusted SIZE_B
and SIZE_C
in lopcodes.h.
Also in luaconf.h change LUAI_FUNC to LUA_API so that we can write some test cases using internal routines.