Commit graph

1446 commits

Author SHA1 Message Date
Benoît Minisini
c10fe0a6c3 Optimization of conditional jumps based on values known to be Boolean.
[COMPILER]
* OPT: Optimization of conditional jumps based on values known to be Boolean.
* BUG: Jump optimization is effective when debugging information is generated.
* BUG: The '/' operator correctly returns a Float if its arguments are Float.

[INTERPRETER]
* OPT: Optimization of conditional jumps based on values known to be Boolean.

[GB.JIT]
* NEW: Support for conditional jumps optimization.
2022-12-10 12:54:42 +01:00
Benoît Minisini
e082046379 Suppression de deux étiquettes inutiles dans la boucle de l'interpréteur.
[INTERPRETER]
* BUG: Suppression de deux étiquettes inutiles dans la boucle de l'interpréteur.
2022-12-09 20:05:39 +01:00
Benoît Minisini
5d0c54bca2 Some fixes in overflow detection.
[INTERPRETER]
* BUG: Fix overflow detection in conversion functions.
* BUG: Check for overflow detection only if the '__has_builtin' pseudo-macro is implemented by the compiler.
2022-12-09 16:07:12 +01:00
Benoît Minisini
af950247c4 Implement overflow detection in JIT compiler. Some jump optimizations in the compiler and the interpreter.
[COMPILER]
* OPT: Optimize jumps pointing at a JUMP instruction.

[INTERPRETER]
* OPT: Avoid conversion to boolean when possible in conditional jumps.

[GB.JIT]
* NEW: Implement overflow detection in integer arithmetic operations. The UNSAFE keyword disable them to get full speed.
2022-12-09 15:00:55 +01:00
Benoît Minisini
c2c08aef6c The '/' operator does not necessarily return a Float. Fix incorrect optimizations that lead to interpreter crashes.
[COMPILER]
* BUG: The '/' operator does not necessarily return a Float. Fix incorrect optimizations that lead to interpreter crashes.
2022-12-08 15:52:56 +01:00
Benoît Minisini
0a7f10ad52 Integer arithmetic and conversion now raise an error if overflow is detected.
[INTERPRETER]
* NEW: Integer arithmetic and conversion now raise an error if overflow is detected.
2022-12-06 20:30:39 +01:00
Benoît Minisini
7a238f4c76 Make the compiler more clever when deciding if an identifier is a reserved keyword or not. Some optimizations in the compiler parser.
[INTERPRETER]
* OPT: Put less code in the main interpreter loop because it became too big again with gcc 12.

[COMPILER]
* OPT: Some optimizations in the parser.
* NEW: Make the compiler more clever when deciding if an identifier is a reserved keyword or not.
2022-12-04 20:00:04 +01:00
Benoît Minisini
50e5bba9df Finally the divide operator does not return infinities. It raises a "Mathematic error" instead.
[INTERPRETER]
* NEW: Finally the divide operator does not return infinities. It raises a "Mathematic error" instead.
2022-11-29 20:47:26 +01:00
Benoît Minisini
c997255367 The divide operator now returns infinity when the numerator is infinity, and raises "Division by zero" error only if the numerator is zero.
[INTERPRETER]
* NEW: The divide operator now returns infinity when the numerator is infinity, and raises "Division by zero" error only if the numerator is zero.
2022-11-29 15:34:51 +01:00
Benoît Minisini
5621991e1f Fix Format$() on numbers when the format string uses "0" character in the exponant part and the exponant is negative.
[INTERPRETER]
* BUG: Fix Format$() on numbers when the format string uses "0" character in the exponant part and the exponant is negative.
2022-11-17 21:40:49 +01:00
Benoît Minisini
22ced08f0d The timezone now can be specified in a string that represents a date.
[INTERPRETER]
* NEW: The timezone now can be specified in a string that represents a
  date, by adding a space followed by "UTC" or "GMT", a plus or minus
  sign, the hours, and optionnaly a colon followed the minutes.
2022-11-17 01:35:05 +01:00
Benoît Minisini
3aa8434179 Add 'Array.Empty' and 'Collection.Empty' properties.
[INTERPRETER]
* NEW: Array: 'Empty' is new property that returns if an array is empty.
* NEW: Collection: 'Empty' is new property that returns if a collection is empty.
2022-11-16 23:03:37 +01:00
Benoît Minisini
3d628e41b3 Fix JIT compilation of extern function calls.
[INTERPRETER]
* NEW: Add an API for the JIT compiler that retrieves the address of an object or a class for external functions.

[GB.JIT]
* BUG: Fix JIT compilation of extern function calls.
2022-10-17 23:30:21 +02:00
Benoît Minisini
f528f4d4ca Fix JIT compilation of class inheriting from another class and Left$(), Right$() and Mid$() routines.
[INTERPRETER]
* BUG: Fix JIT compilation of class inheriting from another class.

[GB.JIT]
* BUG: Fix compilation of Left$(), Right$() and Mid$() routines.
2022-10-15 19:30:03 +02:00
Benoît Minisini
dc2d102a95 Move some code outside of 'gbx_exec_loop.c' source file.
[INTERPRETER]
* OPT: Move some code outside of 'gbx_exec_loop.c' source file. Apparently if the result of the compilation of this source file is too big, the interpreter can be about 150% slower.
2022-10-08 22:39:44 +02:00
Benoît Minisini
09adb643df Bool@(), Byte@()... functions can be the target of an affectation now.
[INTERPRETER]
* NEW: Bool@(), Byte@()... functions can be the target of an affectation now.

[COMPILER]
* NEW: Bool@(), Byte@()... functions can be the target of an affectation now.

[GB.JIT]
* NEW: Bool@(), Byte@()... functions can be the target of an affectation now.
2022-10-08 10:26:50 +02:00
Benoît Minisini
1004b39078 Optimization of small integer floating point constants.
[COMPILER]
* OPT: Optimization of small integer floating point constants.

[INTEGER]
* OPT: Optimization of small integer floating point constants.

[GB.JIT]
* OPT: Optimization of small integer floating point constants.
2022-10-07 13:10:22 +02:00
Benoît Minisini
56cc729fe0 Fix backward-compatibility with previous bytecode.
[INTERPRETER]
* BUG: Fix backward-compatibility with previous bytecode.
* OPT: Optimizations of local variables and argument assignements.
* BUG: NULL can be serialized on streams correctly now.
2022-10-04 22:49:01 +02:00
Benoît Minisini
50893e77cb Various optimizations of the interpreter execution loop.
[COMPILER]
* OPT: Support for local variable manipulation optimization.

[INTERPRETER]
* OPT: Avoid unneeded type conversion swhen manipulating local variables.
* OPT: Various optimizations of the interpreter execution loop. Apparently a smaller execution loop has a big impact on speed. I guess this is related to the size of the various CPU caches.
2022-10-04 01:04:15 +02:00
Benoît Minisini
dba45b1fed Don't use 3.18 multiply and divide optimization if current bytecode version is lower than 3.18.
[INTERPRETER]
* BUG: Don't use 3.18 multiply and divide optimization if current bytecode version is lower than 3.18.
2022-10-03 19:10:42 +02:00
Benoît Minisini
d7e373c633 Always check bytecode version when the current class changes during interpreter execution loop.
[INTERPRETER]
* BUG: Always check bytecode version when the current class changes during interpreter execution loop.
2022-10-03 13:46:20 +02:00
Benoît Minisini
df270cbbc0 Fix optimization of dynamic variable writing.
[INTERPRETER]
* BUG: Fix optimization of dynamic variable writing.
2022-10-01 20:04:20 +02:00
Benoît Minisini
5d1db11ab3 Fix optimization of dynamic variable reading.
[INTERPRETER]
* BUG: Fix optimization of dynamic variable reading.
2022-10-01 20:03:37 +02:00
Benoît Minisini
fd66b99f32 Some optimizations of the main interpreter loop.
[INTERPRETER]
* OPT: Some optimizations of the main interpreter loop.
2022-10-01 16:26:08 +02:00
Benoît Minisini
558360ab97 Fix compilation on non-C99 compiler.
[INTERPRETER]
* BUG: Fix compilation on non-C99 compiler.
2022-10-01 01:31:15 +02:00
Benoît Minisini
13aa1311d7 Optimize array access and basic arithmetic operator on integer and floats.
[INTERPRETER]
* OPT: Optimize array access and basic arithmetic operator on integer and floats.
2022-10-01 00:54:05 +02:00
Benoît Minisini
580a51b659 Replace hash native functions by static methods in a 'Hash' class implemented in the 'gb.hash' component.
[COMPILER]
* NEW: Remove Md5() and other hash native functions.

[INTERPRETER]
* NEW: Remove Md5() and other hash native functions.

[GB.HASH]
* NEW: 'Hash' is a new static class with methods that implement The 'Md5', 'Sha1', 'Sha256' and 'Sha512' hash functions.
2022-09-17 22:41:29 +02:00
Benoît Minisini
0b7c342e8e Add Md5(), Sha1(), Sha256() and Sha512() functions.
[CONFIGURATION]
* NEW: Update 'README' and 'README.md' files.

[COMPILER]
* NEW: Add Md5(), Sha1(), Sha256() and Sha512() functions.

[INTERPRETER]
* NEW: Add Md5(), Sha1(), Sha256() and Sha512() functions.

[GB.HASH]
* NEW: This is a new component that implements the Md5(), Sha1(), Sha256() and Sha512() functions.
  The code comes from BusyBox.
2022-09-13 02:48:11 +02:00
Benoît Minisini
6a793ddeb7 Replace my old depracted gmail mail by the new one.
[CONFIGURATION]
* NEW: Replace my old depracted gmail mail by the new one.
2022-09-12 15:13:13 +02:00
Benoît Minisini
f3cfc51374 Connection: Request substitution methods now support "[&1]" and "&1" quoting syntax to quote a table name or a column name.
[INTERPRETER]
* NEW: Enhance 'GB.SubstStringAdd()' and add 'GB.SubstStringUnquote()' API to support custom quoting in 'gb.db'.

[GB.DB]
* NEW: Connection: Request substitution methods now support "[&1]" and "`&1`" quoting syntax to quote a table name or a column name.
2022-09-05 00:59:44 +02:00
Benoît Minisini
0ec57295b7 Remove useless LIKELY() and UNLIKELY() macros. Add a class flag for bytecode strictly older than 3.18.
[COMPILER]
* NEW: Remove useless LIKELY() and UNLIKELY() macros.

[INTERPRETER]
* NEW: Remove useless LIKELY() and UNLIKELY() macros.
* NEW: Add a class flag for bytecode strictly older than 3.18.

[GB.DEBUG]
* BUG: Fix incorrect 'printf' format on 32-bits architectures.
2022-09-03 14:20:13 +02:00
Benoît Minisini
56e9129f85 PROPERTY WRITE now declares a write-only property.
[INTERPRETER]
* NEW: Support for write-only properties.

[COMPILER]
* NEW: PROPERTY WRITE now declares a write-only property.
2022-08-01 22:03:54 +02:00
Benoît Minisini
cfd42c7186 Support for breakpoints inside project components.
[INTERPRETER]
* NEW: Support for breakpoints inside project components.

[GB.DEBUG]
* NEW: Support for breakpoints inside project components.
2022-07-27 01:04:31 +02:00
Benoît Minisini
daa9c38517 Remove a now useless flag in the internal class structure. The exported name of a class does not overwrite the name field of the class structure anymore.
[INTERPRETER]
* NEW: Remove a now useless flag in the internal class structure.
* NEW: The exported name of a class does not overwrite the name field of the class structure anymore, fixing the stack backtrace.
2022-07-25 22:26:00 +02:00
Benoît Minisini
d053ced083 Add an API to retrieve the last error message.
[INTERPRETER]
* NEW: Add an API to retrieve the last error message.
2022-07-23 15:40:08 +02:00
Benoît Minisini
c78d7fb496 Add component name in debugger positions.
[INTERPRETER]
* NEW: Add component name in debugger positions.

[GB.DEBUG]
* NEW: Add component name in debugger positions.
2022-07-22 20:31:51 +02:00
Benoît Minisini
7f182bff2f Replace a global variable by a function argument in CLASS_look() and CLASS_find() functions.
[INTERPRETER]
* NEW: Replace a global variable by a function argument in CLASS_look() and CLASS_find() functions.
2022-06-20 01:37:03 +02:00
Benoît Minisini
b9ec608cde Fix 'String[].FindSorted()' and 'String[].ExistSorted()' when using 'gb.Like' or 'gb.Match' comparison methods.
[INTERPRETER]
* BUG: Fix 'String[].FindSorted()' and 'String[].ExistSorted()' when using 'gb.Like' or 'gb.Match' comparison methods.
2022-06-14 02:24:32 +02:00
Benoît Minisini
33ec6b88e3 'GB.Every()' API now creates a timer that is ignored by the event loop.
[INTERPRETER]
* NEW: 'GB.Every()' API now creates a timer that is ignored by the event loop.
2022-05-26 20:47:52 +02:00
Benoît Minisini
d27cbb5d1f Application.Task is a new property that returns if we are executing a Task object.
[INTERPRETER]
* NEW: Application.Task is a new property that returns if we are executing a Task object.
2022-05-24 11:55:48 +02:00
Benoît Minisini
d92eeb618c Always flush buffered streams at exit even if the exit is immediate.
[INTERPRETER]
* BUG: Always flush buffered streams at exit even if the exit is immediate.
2022-05-24 11:54:46 +02:00
Benoît Minisini
c771d1d316 QUIT now ends the process brutally. C++ static exit routines from unloaded shared libraries are not called anymore, avoiding the crash.
[INTERPRETER]
* BUG: QUIT now ends the process brutally. C++ static exit routines from unloaded shared libraries are not called anymore, avoiding the crash.
2022-04-28 23:39:42 +02:00
gambas
e07eb9b22f Allow errors to propagate from event handlers when the event is internally raised by the interpreter.
[INTERPRETER]
* NEW: Allow errors to propagate from event handlers when the event is internally raised by the interpreter.
  All events raised from a component written in Gambas through the Gambas API still do not propagate errors.
2022-04-15 16:33:13 +02:00
gambas
7d38878e70 Fix GB_Wait() calls as the meaning of its argument changed.
[INTERPRETER]
* BUG: Fix GB_Wait() calls as the meaning of its argument changed.
2022-04-13 02:24:55 +02:00
gambas
fe43102071 Program exit now can be hold by the debugger to workaround a missing feature of the Gnome terminal.
[INTERPRETER]
* NEW: Program exit now can be hold by the debugger to workaround a missing feature of the Gnome terminal.

[GB.DEBUG]
* NEW: Program exit now can be hold by the debugger to workaround a missing feature of the Gnome terminal.
2022-04-13 01:23:19 +02:00
gambas
b224cd3436 "Wait 0" is now an equivalent of "Wait" alone, but with processing of input events.
[INTERPRETER]
* NEW: "Wait 0" is now an equivalent of "Wait" alone, but with processing of input events.
2022-04-09 19:08:02 +02:00
gambas
b744c7e193 Allow to ignore up to 8 processes in extern debugging mode.
[INTERPRETER]
* NEW: Allow to ignore up to 8 processes in extern debugging mode.
2022-04-08 03:21:32 +02:00
gambas
7457b4de3f Fix Task.Wait() so that it restores SIGCHLD handler for GTK+ libraries, like Process.Wait().
[INTERPRETER]
* BUG: Fix Task.Wait() so that it restores SIGCHLD handler for GTK+ libraries, like Process.Wait().
* NEW: Task.Wait() now can take an optional timeout argument.
2022-03-09 14:25:22 +01:00
gambas
f677aef95c Fix backward-compatibility of serialization format.
[INTERPRETER]
* BUG: Fix backward-compatibility of serialization format.
2022-02-12 14:29:43 +01:00
gambas
dbd1091373 Try to make the new serialization format backward-compatible with the old one.
[INTERPRETER]
* BUG: Try to make the new serialization format backward-compatible with the old one.
2022-02-11 18:59:31 +01:00