Spotlight on Date/Time parsing and formatting

As a bunch commits were just made, it is a good opportunity for a spotlight on dwsDateTime and TdwsFormatSettings.

The class was initially born out of two needs:

  1. to properly handle per-script date FormatSettings, with multiple scripts running in the same or different threads.
  2. to have date formatting and parsing be unambiguously based on the date format string.

(more…)

Delphi Code Coverage alive and kicking

Recently noticed DelphiCodeCoverage had a new home on GitHub, with several updates that make it stable. I had been it in a previous incarnation to assess DWScript test coverage, and help pick which aspects of the engine were in need of extra tests.

The DWScript tests can be quite heavy on exceptions, sub-processes and multithreading. The tests go after checking all things that should fail do fail as they should. That was a bit too much stress for the previous versions, which would occasionally crash. I am happy to say those issues are gone from the current version of DelphiCodeCoverage!

(more…)

DWScript now compatible with Delphi 11

Just pushed a few changes to the DWScript repository for compatibility with the just released Delphi 11 Alexandria.

The only change required was related to a fix of the Delphi compiler, which now properly has integer overflow checks controlled by $OVERFLOWCHECKS while they were previously controlled by $RANGECHECKS.

I also added support for the Delphi 11 dialect for binary literals (starting with %). DWScript already supported binary literals with the “0b” prefix since 2012 (as in C), I had been hoping the % symbol would not be sacrificed for this purpose, but oh well. (more…)

Nested types in DWScript

Just a word of warning about a recent commit that added support for nested types in DWScript.

This support is at the moment only enabled in class declarations, and very minimally tested, a lot more testing is required – and welcome 🙂 – before it can be considered safe to use, and extended to other type declarations.

The related code should only kickoff if a “type” keyword is encountered in a class declaration (which would previously be reported as an error), so the change should be innocuous to existing code.

First phase of dynamic arrays refactoring completed

The first phase of dynamic arrays refactoring mentioned previously is now complete, with dedicated implementations in place for all the base types. A single interface (IScriptDynArray) is now the only common ground.

  • Memory usage is reduced to 1/3 on average, performance is improved up to 2x (without JIT)
  • Array indexes have thus been bumped from Integer to NativeInt, as arrays of more than 2 billions elements have become more practical

The current state has been frozen in Release snapshot DWScript v21.3.11 on the GitHub mirror.

(more…)

Refactoring DWScript dynamic arrays

After reaching initial stages of the x86-64 JIT, work on a long overdue enhancement of the DWScript engine has started: refactoring how dynamic arrays are implemented.

One of the goals when the 32bit JIT was introduced was to edge out the Delphi 32bits compiler, which was not too complicated as Delphi was using the FPU, so merely using SSE2 at the time was enough. But the Delphi 64bits compiler makes good use of SSE2, so the only way to edge it out would be to leverage AVX2 and vectorisation.

(more…)