Skip to content

Cabal + Make based build #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 591 commits into
base: tmp/make-build-offset
Choose a base branch
from

Conversation

angerman
Copy link

This builds upon wip/make-build, and integrates some of the andrea/make-build parts.

@angerman angerman self-assigned this May 10, 2025
@angerman angerman changed the base branch from master to wip/make-build May 10, 2025 03:31
@angerman angerman changed the base branch from wip/make-build to tmp/make-build-offset May 10, 2025 04:45
@angerman angerman force-pushed the wip/make-build-pre-zig branch from 74fdffe to a3d41c0 Compare May 10, 2025 08:34
ticat123 and others added 23 commits May 20, 2025 17:23
This fixes #26017.

  * `integerRecipMod x 1` now returns `(# 1 | #)` for all x; previously it
    incorrectly returned `(# | () #)`, indicating failure.

  * `integerPowMod 0 e m` now returns `(# | () #)` for e<0 and m>1, indicating
    failure; previously it incorrectly returned `(# 0 | #)`.
It was fairly complex to do so and it doesn't seem to improve anything.
Nofib allocations were unaffected as well.

See also Historical Note [Floating dictionaries out of cases]
This commit adds support for a number of primops directly
to the interpreter. This avoids the indirection of going
through the primop wrapper for those primops speeding interpretation
of optimized code up massively.

Code involving IntSet runs about 25% faster with optimized core and these
changes. For core without breakpoints it's even more pronouced and I
saw reductions in runtime by up to 50%.

Running GHC itself in the interpreter was sped up by ~15% through this
change.

Additionally this comment does a few other related changes:

testsuite:
* Run foundation test in ghci and ghci-opt ways to test these
primops.
* Vastly expand the foundation test to cover all basic primops
  by comparing result with the result of calling the wrapper.

Interpreter:
* When pushing arguments for interpreted primops extend each argument to
  at least word with when pushing. This avoids some issues with big
  endian. We can revisit this if it causes performance issues.
* Restructure the stack chunk check logic. There are now macros for
  read accesses which might cross stack chunk boundries and macros which
  omit the checks which are used when we statically know we access an
  address in the current stack chunk.
This commit ensures we do a shape test before unifying. This ensures
we don't try to unify a TyVarTv with a non-tyvar, e.g.

  alpha[tyv] := Int

On the way, we refactor simpleUnifyCheck:

  1. Move the checkTopShape check into simpleUnifyCheck
  2. Refactors simpleUnifyCheck to return a value of the new type
     SimpleUnifyResult type. Now, simpleUnifyCheck returns "can unify",
     "cannot unify" or "dunno" (with "cannot unify" being the new result
     it can return). Now:
       - touchabilityTest is included; it it fails we return "cannot unify"
       - checkTopShape now returns "cannot unify" instead of "dunno" upon failure
  3. Move the call to simpleUnifyCheck out of checkTouchableTyVarEq.
     After that, checkTouchableTyVarEq becames a simple call to
     checkTyEqRhs, so we inline it.

This allows the logic in canEqCanLHSFinish_try_unification to be simplified.
In particular, we now avoid calling 'checkTopShape' twice.
Two further changes suggested by Simon were also implemented:

  - In canEqCanLHSFinish, if checkTyEqRhs returns PuFail with
    'do_not_prevent_rewriting', we now **continue with this constraint**.
    This allows us to use the constraint for rewriting.

  - checkTyEqRhs now has a top-level check to avoid flattening a tyfam app
    in a top-level equality of the form alpha ~ F tys, as this is
    going around in circles. This simplifies the implementation without
    any change in behaviour.

Fixes #25950
Fixes #26030
This commit tweaks the FixedRuntimeRepError case of pprTcSolverReportMsg,
to avoid including an explanation which refers to a type variable that
appears nowhere else.

For example, the old error message could look like the following:

  The pattern binding does not have a fixed runtime representation.
  Its type is:
    T :: TYPE R
  Cannot unify ‘R’ with the type variable ‘c0’
  because the former is not a concrete ‘RuntimeRep’.

With this commit, we now omit the last two lines, because the concrete
type variable (here 'c0') does not appear in the type displayed to the
user (here 'T :: TYPE R').
If ghcversion.h can't be found, don't try to include it. This happens
when there is no rts package in the package db and when -ghcversion-file
argument isn't passed.

Co-authored-by: Syvlain Henry <[email protected]>
In accordance with GHC Proposal #581 "Namespace-specified imports",
section 2.3 "Deprecate use of pattern in import/export lists", the
`pattern` namespace specifier is now deprecated.

Test cases: T25900 T25900_noext
Previously the linker's "proddable blocks" check relied on a simple
linked list of spans. This resulted in extremely poor complexity while
linking objects with lots of small sections (e.g. objects built with
split sections).

Rework the mechanism to instead use a simple interval set implemented
via binary search.

Fixes #26009.
The `LOAD_LIBRARY_SEARCH_USER_DIRS` and
`LOAD_LIBRARY_SEARCH_DEFAULT_DIRS` were introduced in Windows Vista and
have been available every since. As we no longer support Windows XP we
can drop this check.

Addresses #26009.
This is a useful helper which can be used for non-strings as well.
Previously the happy path of PEi386 used `break` in a double-`for` loop
resulting in redundant calls to `LoadLibraryEx`.

Fixes #26052.
Previously every DLL-imported symbol would result in a call to
`LoadLibraryEx`. This ended up constituting over 40% of the runtime of
`ghc --interactive -e 42` on Windows. Avoid this by maintaining a
hash-set of loaded DLL names, skipping the call if we have already
loaded the requested DLL.

Addresses #26009.
Remove emptyModBreaks and track the absence of ModBreaks with `Maybe
ModBreaks`. It avoids testing for null pointers...
This was specified in the proposal (CLC ghc#199) yet somehow didn't make it
into the implementation.

Fixes #26049.
@angerman
Copy link
Author

This supersedes #4

@angerman angerman force-pushed the wip/make-build-pre-zig branch from 15d5708 to 4ef9539 Compare May 27, 2025 11:24
angerman and others added 8 commits May 28, 2025 09:55
Replaced separate logging for stderr with `tee` command to capture both stdout and stderr in the same log file for better clarity and debugging.
(cherry picked from commit ffa530c)
(cherry picked from commit b1ca8d4)
@angerman angerman force-pushed the wip/make-build-pre-zig branch 4 times, most recently from 201b6dc to f7375b8 Compare June 14, 2025 00:36
@angerman angerman force-pushed the wip/make-build-pre-zig branch from f7375b8 to 2345fd5 Compare June 14, 2025 01:05
hsyl20 added 6 commits June 16, 2025 17:45
Erro was: ld.lld: error: T16180.o: requires an executable stack, but -z execstack is not specified
- Use ghc-internal instead of the rts (we only have a single
  ghc-internal package, for now).
- Make the error message a bit better by reporting all the candidate
  unit-ids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants