Commit graph

48 commits

Author SHA1 Message Date
gambas
706a605cc3 Correctly restore the stack after calling a method through the interpreter, and handle null values as object values having a null address automatically.
[INTERPRETER]
* NEW: Creating a NULL value now clears the object address field so that it can be freely interpreted as a Object value with a null address by the JIT compiled code.

[GB.JIT]
* BUG: Correctly restore stack after calling a method through the interpreter.
2018-08-22 09:30:27 +02:00
gambas
7ab07bd95f Correctly handle optional object arguments.
[GB.JIT]
* BUG: Correctly handle optional object arguments.
2018-08-20 19:57:47 +02:00
gambas
7492efcc0e Always load the class before accessing a static variable, as it may not be ready.
[INTERPRETER]
* BUG: FIx JIT class loading API.

[GB.JIT]
* BUG: Always load the class before accessing a static variable, as it may not be ready.
2018-08-18 15:28:19 +02:00
gambas
07ccec7358 Compile correctly optional arguments initialization.
[GB.JIT]
* BUG: Compile correctly optional arguments initialization.
2018-08-18 12:03:44 +02:00
gambas
d371614662 Correctly compile conversion from object to boolean.
[GB.JIT]
* BUG: Correctly compile conversion from object to boolean.
2018-08-17 01:04:53 +02:00
gambas
979e22f6e9 Correctly load classes from archives other than the main project one during JIT compilation.
[INTERPRETER]
* NEW: When creating a new class, set its component immediately if we know the archive it comes from.

[GB.JIT]
* BUG: Correctly load classes from archives other than the main project one.
2018-08-16 01:50:45 +02:00
gambas
6d35875a56 Correctly raise exceptions on the number of arguments of function calls.
[GB.JIT]
* BUG: Correctly raise exceptions on the number of arguments of function calls.
2018-08-15 08:37:25 +02:00
gambas
0b341e7c91 Compile optional arguments correctly.
[GB.JIT]
* BUG: Compile optional arguments correctly.
2018-08-15 00:01:51 +02:00
gambas
0297c1bafa Load classes without running the _init method, so that the JIT behaviour is closer to the interpreter behaviour.
[INTERPRETER]
* NEW: Add a JIT API for loading classes without running the _init method.

[GB.JIT]
* BUG: Load classes without running the _init method, so that the JIT behaviour is closer to the interpreter behaviour.
2018-08-14 16:46:55 +02:00
gambas
c569a234be Don't leak memory when converting an object to a boolean and correctly pop the arguments from the stack when propagating an exception.
[GB.JIT]
* BUG: Don't leak memory when converting an object to a boolean.
* BUG: Correctly pop the arguments from the stack when propagating an exception.
2018-08-14 12:15:04 +02:00
gambas
ad16238574 Correctly compile subroutines that return an unknown datatype.
[GB.JIT]
* BUG: Correctly compile subroutines that return an unknown datatype.
2018-08-14 10:57:49 +02:00
gambas
698e5dd948 Fix access to objects that can be invalid.
[GB.JIT]
* BUG: Fix access to objects that can be invalid.
2018-08-13 23:01:27 +02:00
gambas
7a129a8d83 Add support fot date variables.
[GB.JIT]
* NEW: Add support fot date variables.
2018-08-13 22:55:01 +02:00
gambas
ffa3cd0875 Correctly read pointer variables.
[GB.JIT]
* BUG: Correctly read pointer variables.
2018-08-13 00:36:33 +02:00
gambas
bdb60ecef7 Correctly compile long public constants.
[GB.JIT]
* BUG: Correctly compile long public constants.
2018-08-13 00:24:38 +02:00
gambas
9c1fa46558 Reading variants from memory is done correctly now.
[GB.JIT]
* BUG: Reading variants from memory is done correctly now.
2018-08-12 09:43:15 +02:00
gambas
a2123c7f27 Accesses to byte global variables are compiled correctly now.
[GB.JIT]
* BUG: Accesses to byte global variables are compiled correctly now.
2018-08-12 00:22:44 +02:00
gambas
0975e520db JIT: Handle function datatype by raising a type mismatch error.
[INTERPRETER]
* NEW: JIT: Add an API for throwing type mismatch errors.
* BUG: Raise a type mismatch error when converting a function to a variant. Don't panic anymore.

[GB.JIT]
* BUG: Handle function datatype by raising a type mismatch error.
2018-08-11 14:06:46 +02:00
gambas
f882946561 Fix conversions of NULL.
[GB.JIT]
* BUG: Fix conversions of NULL.
2018-08-11 07:55:08 +02:00
gambas
4e83422f20 Fix optional arguments management.
[INTERPRETER]
* NEW: Fix panic error message again.

[GB.JIT]
* BUG: Fix optional arguments management.
2018-08-10 14:22:49 +02:00
gambas
3966bfbca7 Fix compilation of variant values borrowings and NULL values conversions.
[GB.JIT]
* BUG: Fix compilation of variant values borrowings.
* BUG: Fix NULL values conversions.
2018-08-10 13:53:20 +02:00
gambas
5df6553247 Fix compilation of variant values releases.
[GB.JIT]
* BUG: Fix compilation of variant values releases.
2018-08-10 13:35:20 +02:00
gambas
4209cffa11 [INTERPRETER]
* NEW: Fix panic error message.

[GB.JIT]
* BUG: Load project classes before try to resolve a unknown symbol.
* BUG: Correctly restore the stack pointer in all cases at function exit.
2018-08-10 13:26:54 +02:00
gambas
acf401ba2d Correctly reset the stack pointer when releasing the stack in error handlers.
[INTERPRETER]
* BUG: Do not clear the 'super' field of the object value returned by NEW, as it does not fix actually anything.

[GB.JIT]
* BUG: Correctly reset the stack pointer when releasing the stack in error handlers.
2018-08-09 11:05:51 +02:00
gambas
bb34431646 Fix a crash in JIT relative to SUPER management.
[INTERPRETER]
* BUG: Clear the 'super' field of the object value returned by NEW.

[GB.JIT]
* BUG: Correctly reset EXEC_super in error catching.
2018-08-06 13:26:49 +02:00
gambas
bba1946700 The datatype of object symbols was incorrectly computed.
[GB.JIT]
* BUG: The datatype of object symbols was incorrectly computed.
2018-07-08 08:24:31 +02:00
gambas
e04ec717c7 JIT: Structures and static arrays have been implemented.
[INTERPRETER]
* NEW: JIT: Support for structures and static arrays.

[GB.JIT]
* NEW: Structures and static arrays have been implemented.
2018-07-07 14:54:23 +02:00
gambas
ed775d62d4 Correctly handle function values used as arguments.
[GB.JIT]
* BUG: Correctly handle function values used as arguments.
2018-07-07 00:58:55 +02:00
gambas
50dedeb8cb Don't use __attribute__((noreturn)), it makes gcc dizzy and slow as hell.
[GB.JIT]
* BUG: Don't use __attribute__((noreturn)), it makes gcc dizzy and slow as hell.
2018-07-05 07:15:23 +02:00
gambas
d3c93a05e4 Work on new JIT system continues.
[INTERPRETER]
* NEW: Abort if a stack mismatch is detected after a JIT function has been called.

[GB.JIT]
* NEW: The GB_JIT_CC environment variable allows to define the C compiler that will generate the code.
* OPT: Don't call the compiler through a shell anymore.
* NEW: Support for clang.
* BUG: Don't use the "," operator anymore to write JIT code.
* BUG: Correctly free stack when leaving a function whereas we are still inside a GOSUB.
* BUG: Declare all local variables and arguments as volatile as soon the function uses CATCH or FINALLY.
2018-07-05 07:10:31 +02:00
gambas
4a1c81d0aa Jit.Time is a new property that returns the time spent in JIT compilation, in seconds.
[INTERPRETER]
* NEW: Jit is a new static class that allows to deal with the JIT compiler.
* NEW: Jit.Time is a new property that returns the time spent in JIT compilation, in seconds.

[GB.JIT]
* NEW: Support for the Jit.Time property.
2018-07-03 00:52:19 +02:00
gambas
527702ea59 Subroutines returning something that are used as instructions correctly drop their return value now.
[GB.JIT]
* BUG: Subroutines returning something that are used as instructions correctly drop their return value now.
2018-07-02 22:37:33 +02:00
gambas
9cf443a04f [INTERPRETER]
* BUG: Take JIT code into account when displaying current position in DEBUG instruction.

[COMPILER]
* BUG: Fix subroutine metadata.
* BUG: Fix subroutine search function.

[GB.JIT]
* BUG: Fix string referencing.
* NEW: Implement date arrays accessors.
* BUG: Fix error management.
* BUG: Fix mathematic functions implementation.
* NEW: Support of functions with a variable number of arguments.
* BUG: Fix support of Long constants.
* BUG: Fix implementation of Collection array operator.
* BUG: Fix READ, EXEC, SHELL and DEBUG instructions.
* BUG: Fix VarPtr().
* BUG: Fix TRUE constant implementation.
2018-07-02 19:37:37 +02:00
gambas
5f4f12acf3 [COMPILER]
* NEW: UNSAFE is a new keyword used in conjunction with FAST. It tells the JIT compiler not to do any safety check (null objects, division by zero, out of array bounds...). It makes the code a bit faster, but prone to segmentation fault.

[INTERPRETER]
* NEW: Support for the UNSAFE keyword.

[GB.JIT]
* NEW: Support for the UNSAFE keyword.
* NEW: Check validity of objects that can be invalid.
2018-06-29 00:10:31 +02:00
gambas
fe08dfa333 Work continues on new JIT system.
[INTERPRETER]
* NEW: JIT: Support for SUPER.
* NEW: JIT: Support for extern functions.
* NEW: Add a flag in Gambas functions to know if they are static or not.

[GB.JIT]
* NEW: Support for SUPER.
* NEW: Support for extern functions.
* BUG: Fix object arrays access.
* OPT: Optimization of Abs, Sgn, Int, Fix, and Pi subroutines.
2018-06-27 19:35:23 +02:00
gambas
ab3963c99c Fix some bugs detected by clang, and JIT code can now raise events.
[INTERPRETER]
* NEW: JIT: Support for event raising.
* BUG: Fix some bugs detected by clang.

[GB.JIT]
* NEW: Support for event raising.
* OPT: Some optimizations in jit code generation and compilation.
2018-06-25 19:17:44 +02:00
gambas
06d139920d Work continues on new JIT system.
[INTERPRETER]
* BUG: JIT: No need to support breakpoints.

[GB.JIT]
* BUG: No need to support breakpoints.
2018-06-23 01:37:06 +02:00
gambas
128b5de2f2 [INTERPRETER]
* NEW: JIT: Support for QUIT and STOP EVENT instructions.

[GB.JIT]
* NEW: Implement QUIT and STOP EVENT instructions.
2018-06-23 01:31:39 +02:00
gambas
6502645560 Work continues on new JIT system.
[INTERPRETER]
* BUG: JIT: Fix error handling when calling methods from JIT code.

[GB.JIT]
* NEW: Fix support of CATCH and FINALLY.
* NEW: Support for ON GOTO and ON GOSUB.
2018-06-22 04:49:05 +02:00
gambas
3bd9dca142 Work on new JIT system continues.
[INTERPRETER]
* NEW: JIT: Complex number support.
* NEW: JIT: LAST support.

[GB.JIT]
* BUG: Fix management of local variable declaration of translated functions.
* NEW: Support for WITH ... END WITH.
* NEW: JIT: Complex number support.
* NEW: JIT: LAST support.
2018-06-19 00:30:12 +02:00
gambas
4ef9c15a1b Support for CATCH and FINALLY.
[INTERPRETER]
* NEW: The NEW implementation routine takes its opcode as argument now, like other subroutines with a variable number of arguments.

[GB.JIT]
* OPT: Call subroutines using their static address. No significative performance gain was detected.
* NEW: Support for CATCH and FINALLY.
2018-06-16 01:12:13 +02:00
gambas
b9a83c8a10 Work continues on new JIT system.
[INTERPRETER]
* NEW: Support for error management in JIT methods.

[COMPILER]
* BUG: Fix Error() function metadata.

[GB.JIT]
* NEW: Support for error management.
* NEW: TRY instruction.
* BUG: Correct support of NULL.
2018-06-14 16:45:05 +02:00
gambas
5a1e3b48e9 Fix label generation again.
[GB.JIT]
* BUG: Fix label generation again.
2018-06-13 18:19:32 +02:00
gambas
08c772a290 Fix FOR EACH loops translation.
[GB.JIT]
* BUG: Panic if the stack is not void once a function has been translated.
* BUG: Fix FOR EACH loops translation.
2018-06-13 16:59:56 +02:00
gambas
b8198005db [BENCHMARKS]
* OPT: Little optimization in nbody benchmark.

[GB.JIT]
* BUG: Fix translation of loops.
* BUG: Fix label generation.
2018-06-13 16:55:25 +02:00
gambas
6b8afd0617 [COMPILER]
* BUG: Fix Left, Mid and Right subroutines metadata.

[GB.JIT]
* BUG: Fix function arguments management.
* BUG: Functions returning objects work correctly now.
* BUG: Fix internal control variables management.
2018-06-13 00:38:18 +02:00
gambas
c671adfd6b Work continues on new JIT system.
[INTERPRETER]
* OPT: String searching (Instr, RInstr and Replace) has been made about 4x faster by searching the first occurence with memchr() and memrchr().

[GB.FORM.TERMINAL]
* BUG: Fix warning messages.

[GB.JIT]
* BUG: Fix byte, short and boolean pushing and popping routines.
* BUG: Fix string values referencing.
* BUG: Fix optional argument management.
* NEW: Optimization of bits management subroutines.

[GB.QT4]
* BUG: Delay hooks initialization, because now socket notifiers must not be used before creating the event loop.

[GB.QT5]
* BUG: Delay hooks initialization, because now socket notifiers must not be used before creating the event loop.
2018-06-11 18:56:39 +02:00
gambas
4e50dec11d Work continues on new JIT system. Translation is now done at runtime.
[INTERPRETER]
* OPT: String routines are now compiled with -O3.
* NEW: Don't display JIT debugging message unless GB_JIT_DEBUG is set to something different from zero.
* NEW: String whose length is greater than 256 now have a growth step of 256 bytes instead of 16.

[GB.JIT]
* NEW: Do many global optimizations as now the class metadata is fully available.
* NEW: Support for optional argument. Still buggy at the moment.
2018-06-09 22:42:35 +02:00