Skip to main content

IOG GHC Update #4

ยท 3 min read

Biweekly update from the GHC DevX team at IOG.

Previous updates can be found here.

JavaScript backendโ€‹

Template Haskellโ€‹

Sylvain: !9779 adding TH support for the JS backend passes CI and is ready for reviews.

Ticket #23013 has been opened to keep track of an issue with the recompilation avoidance mechanism. Fixing the issue seems to require some invasive refactoring that is best left for a future merge request.

Luite: !10008 Implemented keeping track of subdirectories in GHC's temporary file manager. Ready for review. Fixes #22952.

Temporary subdirectories are used when linking Template Haskell with the JavaScript backend and also in some situations when linking with other backends. This would always result in files being left behind in GHC's temporary directory (and a warning at high enough verbosity settings) since these subdirectories were never removed. With this patch, GHC keeps track of all created subdirectories and removes them at the end of the session.

JavaScript RTS refactorโ€‹

Josh: has merged the refactor of the RTS generation module to reduce redundant code. In this refactor, debug logging was also completed to determine the correct numbers to use as the cache sizes for generated JavaScript names - allowing us to vastly reduce the size of these arrays for efficiency, and to remove panic cases in favour of generating higher numbered names without caching.

!9794

Integer performanceโ€‹

Sylvain: !9825 has been updated after an helpful review by Matthew Claven.

JavaScript EDSLโ€‹

Jeff: MR is open. In response to feedback from the team Jeff has added (and removed) several features that distinguish the eDSL from sunroof. These include: removing threading and continuations, adding named unique variables and a proper switch statement. These changes allow more of the RTS to be replaced in the eDSL and allow the RTS to be typed using Haskell's type system. For example, now the STG registers track the type of the values they hold.

CIโ€‹

Sylvain: fixed CI script test that prevented performance results to be stored for the JS backend (see #22923 and !10026).


Compiler performanceโ€‹

More-strict break/spanโ€‹

Josh: opened a CLC (Core Libraries Committee) proposal to add stricter versions of break and span to Data.List in addition to the existing lazy versions. The proposal considers evidence that these versions are situationally more performant, by comparing allocation statistics, generated STG, and microbenchmarks - as well as making the argument for consistency with existing List functions that also have strict versions.

See also:

Unboxed CodeBuffersโ€‹

Josh: opened a CLC proposal to modify the implementation of CodeBuffers in base to use unboxed tuples in the return type of encoding functions. This change presents a significant allocation improvement, due to the difficulty GHC has with applying a certain optimisation within data types.

See also:

Optimization Handbookโ€‹

Jeff: Has been hard at work on the Optimization Handbook. He has finished a chapter on Lambda Lifting, significantly expanded the glossary, and added documentation to the sphinx-exec-directive haskell extension that he finished last month. The optimization handbook is now in review by IOG's IT team to migrate it to the Haskell Foundation website.


GHCiโ€‹

Luite: Added a testcase and did some cleanups in the types of the C code in MR !9957, and adjusted the bytecode generator to not produce zero offset SLIDE instructions anymore. This is now ready for review.