Ben Gamari pushed to branch wip/T26166 at Glasgow Haskell Compiler / GHC
Commits:
-
2c168cf3
by Ben Gamari at 2025-09-26T13:23:49-04:00
-
6044a105
by Ben Gamari at 2025-09-26T13:23:49-04:00
26 changed files:
- compiler/GHC/HsToCore/Foreign/C.hs
- + libraries/ghc-internal/cbits/RtsIface.c
- libraries/ghc-internal/ghc-internal.cabal.in
- + libraries/ghc-internal/include/RtsIfaceSymbols.h
- + rts/BuiltinClosures.c
- + rts/BuiltinClosures.h
- rts/Compact.cmm
- rts/ContinuationOps.cmm
- rts/Exception.cmm
- rts/Prelude.h
- rts/PrimOps.cmm
- rts/RtsAPI.c
- rts/RtsStartup.c
- + rts/RtsToHsIface.c
- rts/Schedule.c
- rts/StgMiscClosures.cmm
- rts/StgStdThunks.cmm
- rts/include/Rts.h
- rts/include/RtsAPI.h
- rts/include/rts/Constants.h
- + rts/include/rts/RtsToHsIface.h
- rts/include/stg/MiscClosures.h
- rts/posix/Signals.c
- rts/rts.cabal
- rts/wasm/JSFFI.c
- utils/deriveConstants/Main.hs
Changes:
| ... | ... | @@ -517,8 +517,8 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc |
| 517 | 517 | text "rts_apply" <> parens (
|
| 518 | 518 | cap
|
| 519 | 519 | <> (if is_IO_res_ty
|
| 520 | - then text "runIO_closure"
|
|
| 521 | - else text "runNonIO_closure")
|
|
| 520 | + then text "ghc_hs_iface->runIO_closure"
|
|
| 521 | + else text "ghc_hs_iface->runNonIO_closure")
|
|
| 522 | 522 | <> comma
|
| 523 | 523 | <> expr_to_run
|
| 524 | 524 | ) <+> comma
|
| 1 | +/*
|
|
| 2 | + * (c) The GHC Team, 2025-2026
|
|
| 3 | + *
|
|
| 4 | + * RTS/ghc-internal interface
|
|
| 5 | + *
|
|
| 6 | + * See Note [RTS/ghc-internal interface].
|
|
| 7 | + */
|
|
| 8 | + |
|
| 9 | +#include "Rts.h"
|
|
| 10 | + |
|
| 11 | +void init_ghc_hs_iface(void) __attribute__((constructor));
|
|
| 12 | + |
|
| 13 | +#define CLOSURE(module, symbol) \
|
|
| 14 | + extern StgClosure ghczminternal_##module##_##symbol;
|
|
| 15 | + |
|
| 16 | +#define UNDEF_CLOSURE(module, symbol)
|
|
| 17 | + |
|
| 18 | +#define INFO_TBL(module, symbol) \
|
|
| 19 | + extern StgInfoTable ghczminternal_##module##_##symbol;
|
|
| 20 | + |
|
| 21 | +#include "RtsIfaceSymbols.h"
|
|
| 22 | + |
|
| 23 | +#undef CLOSURE
|
|
| 24 | +#undef INFO_TBL
|
|
| 25 | + |
|
| 26 | +#define CLOSURE(module, symbol) \
|
|
| 27 | + .symbol = &ghczminternal_##module##_##symbol,
|
|
| 28 | + |
|
| 29 | +#define UNDEF_CLOSURE(module, symbol) \
|
|
| 30 | + .symbol = NULL,
|
|
| 31 | + |
|
| 32 | +#define INFO_TBL(module, symbol) \
|
|
| 33 | + .symbol = &ghczminternal_##module##_##symbol,
|
|
| 34 | + |
|
| 35 | +HsIface the_ghc_hs_iface = {
|
|
| 36 | +#include "RtsIfaceSymbols.h"
|
|
| 37 | +};
|
|
| 38 | + |
|
| 39 | +void init_ghc_hs_iface(void)
|
|
| 40 | +{
|
|
| 41 | + ghc_hs_iface = &the_ghc_hs_iface;
|
|
| 42 | +} |
| ... | ... | @@ -43,6 +43,7 @@ extra-source-files: |
| 43 | 43 | include/winio_structs.h
|
| 44 | 44 | include/WordSize.h
|
| 45 | 45 | include/HsIntegerGmp.h.in
|
| 46 | + include/RtsIfaceSymbols.h
|
|
| 46 | 47 | install-sh
|
| 47 | 48 | |
| 48 | 49 | source-repository head
|
| ... | ... | @@ -457,6 +458,7 @@ Library |
| 457 | 458 | cbits/vectorQuotRem.c
|
| 458 | 459 | cbits/word2float.c
|
| 459 | 460 | cbits/Stack_c.c
|
| 461 | + cbits/RtsIface.c
|
|
| 460 | 462 | |
| 461 | 463 | cmm-sources:
|
| 462 | 464 | cbits/StackCloningDecoding.cmm
|
| 1 | +// See Note [RTS/ghc-internal interface].
|
|
| 2 | + |
|
| 3 | +#if defined(mingw32_HOST_OS)
|
|
| 4 | +CLOSURE(GHCziInternalziEventziWindows, processRemoteCompletion_closure)
|
|
| 5 | +#else
|
|
| 6 | +UNDEF_CLOSURE(GHCziInternalziEventziWindows, processRemoteCompletion_closure)
|
|
| 7 | +#endif
|
|
| 8 | +CLOSURE(GHCziInternalziTopHandler, runIO_closure)
|
|
| 9 | +CLOSURE(GHCziInternalziTopHandler, runNonIO_closure)
|
|
| 10 | +CLOSURE(GHCziInternalziTuple, Z0T_closure)
|
|
| 11 | +CLOSURE(GHCziInternalziTypes, True_closure)
|
|
| 12 | +CLOSURE(GHCziInternalziTypes, False_closure)
|
|
| 13 | +CLOSURE(GHCziInternalziPack, unpackCString_closure)
|
|
| 14 | +CLOSURE(GHCziInternalziWeakziFinalizze, runFinalizzerBatch_closure)
|
|
| 15 | +CLOSURE(GHCziInternalziIOziException, stackOverflow_closure)
|
|
| 16 | +CLOSURE(GHCziInternalziIOziException, heapOverflow_closure)
|
|
| 17 | +CLOSURE(GHCziInternalziIOziException, allocationLimitExceeded_closure)
|
|
| 18 | +CLOSURE(GHCziInternalziIOziException, blockedIndefinitelyOnMVar_closure)
|
|
| 19 | +CLOSURE(GHCziInternalziIOziException, blockedIndefinitelyOnSTM_closure)
|
|
| 20 | +CLOSURE(GHCziInternalziIOziException, cannotCompactFunction_closure)
|
|
| 21 | +CLOSURE(GHCziInternalziIOziException, cannotCompactPinned_closure)
|
|
| 22 | +CLOSURE(GHCziInternalziIOziException, cannotCompactMutable_closure)
|
|
| 23 | +CLOSURE(GHCziInternalziControlziExceptionziBase, nonTermination_closure)
|
|
| 24 | +CLOSURE(GHCziInternalziControlziExceptionziBase, nestedAtomically_closure)
|
|
| 25 | +CLOSURE(GHCziInternalziControlziExceptionziBase, noMatchingContinuationPrompt_closure)
|
|
| 26 | +CLOSURE(GHCziInternalziEventziThread, blockedOnBadFD_closure)
|
|
| 27 | +CLOSURE(GHCziInternalziConcziSync, runSparks_closure)
|
|
| 28 | +CLOSURE(GHCziInternalziConcziIO, ensureIOManagerIsRunning_closure)
|
|
| 29 | +CLOSURE(GHCziInternalziConcziIO, interruptIOManager_closure)
|
|
| 30 | +CLOSURE(GHCziInternalziConcziIO, ioManagerCapabilitiesChanged_closure)
|
|
| 31 | +CLOSURE(GHCziInternalziConcziSignal, runHandlersPtr_closure)
|
|
| 32 | +CLOSURE(GHCziInternalziTopHandler, flushStdHandles_closure)
|
|
| 33 | +CLOSURE(GHCziInternalziTopHandler, runMainIO_closure)
|
|
| 34 | +INFO_TBL(GHCziInternalziTypes, Czh_con_info)
|
|
| 35 | +INFO_TBL(GHCziInternalziTypes, Izh_con_info)
|
|
| 36 | +INFO_TBL(GHCziInternalziTypes, Fzh_con_info)
|
|
| 37 | +INFO_TBL(GHCziInternalziTypes, Dzh_con_info)
|
|
| 38 | +INFO_TBL(GHCziInternalziTypes, Wzh_con_info)
|
|
| 39 | +CLOSURE(GHCziInternalziPrimziPanic, absentSumFieldError_closure)
|
|
| 40 | +CLOSURE(GHCziInternalziAllocationLimitHandler, runAllocationLimitHandler_closure)
|
|
| 41 | +INFO_TBL(GHCziInternalziPtr, Ptr_con_info)
|
|
| 42 | +INFO_TBL(GHCziInternalziPtr, FunPtr_con_info)
|
|
| 43 | +INFO_TBL(GHCziInternalziInt, I8zh_con_info)
|
|
| 44 | +INFO_TBL(GHCziInternalziInt, I16zh_con_info)
|
|
| 45 | +INFO_TBL(GHCziInternalziInt, I32zh_con_info)
|
|
| 46 | +INFO_TBL(GHCziInternalziInt, I64zh_con_info)
|
|
| 47 | +INFO_TBL(GHCziInternalziWord, W8zh_con_info)
|
|
| 48 | +INFO_TBL(GHCziInternalziWord, W16zh_con_info)
|
|
| 49 | +INFO_TBL(GHCziInternalziWord, W32zh_con_info)
|
|
| 50 | +INFO_TBL(GHCziInternalziWord, W64zh_con_info)
|
|
| 51 | +INFO_TBL(GHCziInternalziStable, StablePtr_con_info)
|
|
| 52 | +CLOSURE(GHCziInternalziStackziCloneStack, StackSnapshot_closure)
|
|
| 53 | +CLOSURE(GHCziInternalziExceptionziType, divZZeroException_closure)
|
|
| 54 | +CLOSURE(GHCziInternalziExceptionziType, underflowException_closure)
|
|
| 55 | +CLOSURE(GHCziInternalziExceptionziType, overflowException_closure)
|
|
| 56 | +CLOSURE(GHCziInternalziCString, unpackCStringzh_closure)
|
|
| 57 | +INFO_TBL(GHCziInternalziCString, unpackCStringzh_info)
|
|
| 58 | +INFO_TBL(GHCziInternalziCString, unpackCStringUtf8zh_info)
|
|
| 59 | + |
| 1 | +#include "Rts.h"
|
|
| 2 | +#include "BuiltinClosures.h"
|
|
| 3 | + |
|
| 4 | +/*
|
|
| 5 | + * Note [CHARLIKE and INTLIKE closures]
|
|
| 6 | + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 7 | + * These are static representations of Chars and small Ints, so that
|
|
| 8 | + * we can remove dynamic Chars and Ints during garbage collection and
|
|
| 9 | + * replace them with references to the static objects.
|
|
| 10 | + */
|
|
| 11 | + |
|
| 12 | +StgIntCharlikeClosure stg_INTLIKE_closure[MAX_INTLIKE - MIN_INTLIKE + 1];
|
|
| 13 | +StgIntCharlikeClosure stg_CHARLIKE_closure[MAX_CHARLIKE - MIN_CHARLIKE + 1];
|
|
| 14 | + |
|
| 15 | +void initBuiltinClosures() {
|
|
| 16 | + // INTLIKE closures
|
|
| 17 | + for (int i = MIN_INTLIKE; i <= MAX_INTLIKE - MIN_INTLIKE; i++) {
|
|
| 18 | + StgIntCharlikeClosure *c = &stg_INTLIKE_closure[i];
|
|
| 19 | + SET_HDR((StgClosure* ) c, ghc_hs_iface->Izh_con_info, CCS_SYSTEM_OR_NULL);
|
|
| 20 | + c->data = MIN_INTLIKE + i;
|
|
| 21 | + }
|
|
| 22 | + |
|
| 23 | + // CHARLIKE closures
|
|
| 24 | + for (int i = MIN_CHARLIKE; i <= MAX_CHARLIKE - MIN_CHARLIKE; i++) {
|
|
| 25 | + StgIntCharlikeClosure *c = &stg_CHARLIKE_closure[i];
|
|
| 26 | + SET_HDR((StgClosure* ) c, ghc_hs_iface->Czh_con_info, CCS_SYSTEM_OR_NULL);
|
|
| 27 | + c->data = MIN_CHARLIKE + i;
|
|
| 28 | + }
|
|
| 29 | +} |
| 1 | +void initBuiltinClosures(void); |
| ... | ... | @@ -10,9 +10,6 @@ |
| 10 | 10 | #include "Cmm.h"
|
| 11 | 11 | #include "sm/ShouldCompact.h"
|
| 12 | 12 | |
| 13 | -import CLOSURE ghczminternal_GHCziInternalziIOziException_cannotCompactFunction_closure;
|
|
| 14 | -import CLOSURE ghczminternal_GHCziInternalziIOziException_cannotCompactMutable_closure;
|
|
| 15 | -import CLOSURE ghczminternal_GHCziInternalziIOziException_cannotCompactPinned_closure;
|
|
| 16 | 13 | #if !defined(UnregisterisedCompiler)
|
| 17 | 14 | import CLOSURE g0;
|
| 18 | 15 | import CLOSURE large_alloc_lim;
|
| ... | ... | @@ -124,7 +121,7 @@ eval: |
| 124 | 121 | SMALL_MUT_ARR_PTRS_CLEAN,
|
| 125 | 122 | SMALL_MUT_ARR_PTRS_DIRTY,
|
| 126 | 123 | COMPACT_NFDATA: {
|
| 127 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_cannotCompactMutable_closure);
|
|
| 124 | + jump stg_raisezh(HsIface_cannotCompactMutable_closure(W_[ghc_hs_iface]));
|
|
| 128 | 125 | }
|
| 129 | 126 | |
| 130 | 127 | // We shouldn't see any functions, if this data structure was NFData.
|
| ... | ... | @@ -139,7 +136,7 @@ eval: |
| 139 | 136 | BCO,
|
| 140 | 137 | PAP,
|
| 141 | 138 | CONTINUATION: {
|
| 142 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_cannotCompactFunction_closure);
|
|
| 139 | + jump stg_raisezh(HsIface_cannotCompactFunction_closure(W_[ghc_hs_iface]));
|
|
| 143 | 140 | }
|
| 144 | 141 | |
| 145 | 142 | case ARR_WORDS: {
|
| ... | ... | @@ -147,7 +144,7 @@ eval: |
| 147 | 144 | (should) = ccall shouldCompact(compact "ptr", p "ptr");
|
| 148 | 145 | if (should == SHOULDCOMPACT_IN_CNF) { P_[pp] = p; return(); }
|
| 149 | 146 | if (should == SHOULDCOMPACT_PINNED) {
|
| 150 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_cannotCompactPinned_closure);
|
|
| 147 | + jump stg_raisezh(HsIface_cannotCompactPinned_closure(W_[ghc_hs_iface]));
|
|
| 151 | 148 | }
|
| 152 | 149 | |
| 153 | 150 | CHECK_HASH();
|
| ... | ... | @@ -12,7 +12,6 @@ |
| 12 | 12 | |
| 13 | 13 | #include "Cmm.h"
|
| 14 | 14 | |
| 15 | -import CLOSURE ghczminternal_GHCziInternalziControlziExceptionziBase_noMatchingContinuationPrompt_closure;
|
|
| 16 | 15 | #if !defined(UnregisterisedCompiler)
|
| 17 | 16 | import CLOSURE ALLOC_RTS_ctr;
|
| 18 | 17 | import CLOSURE ALLOC_RTS_tot;
|
| ... | ... | @@ -104,7 +103,7 @@ stg_control0zh_ll // explicit stack |
| 104 | 103 | |
| 105 | 104 | // see Note [When capturing the continuation fails] in Continuation.c
|
| 106 | 105 | if (cont == NULL) (likely: False) {
|
| 107 | - jump stg_raisezh(ghczminternal_GHCziInternalziControlziExceptionziBase_noMatchingContinuationPrompt_closure);
|
|
| 106 | + jump stg_raisezh(HsIface_noMatchingContinuationPrompt_closure(W_[ghc_hs_iface]));
|
|
| 108 | 107 | }
|
| 109 | 108 | |
| 110 | 109 | W_ apply_mask_frame;
|
| ... | ... | @@ -13,10 +13,6 @@ |
| 13 | 13 | #include "Cmm.h"
|
| 14 | 14 | #include "RaiseAsync.h"
|
| 15 | 15 | |
| 16 | -import CLOSURE ghczminternal_GHCziInternalziTypes_True_closure;
|
|
| 17 | -import CLOSURE ghczminternal_GHCziInternalziExceptionziType_divZZeroException_closure;
|
|
| 18 | -import CLOSURE ghczminternal_GHCziInternalziExceptionziType_underflowException_closure;
|
|
| 19 | -import CLOSURE ghczminternal_GHCziInternalziExceptionziType_overflowException_closure;
|
|
| 20 | 16 | #if !defined(UnregisterisedCompiler)
|
| 21 | 17 | import CLOSURE CATCHF_PUSHED_ctr;
|
| 22 | 18 | import CLOSURE RtsFlags;
|
| ... | ... | @@ -539,7 +535,7 @@ retry_pop_stack: |
| 539 | 535 | Sp(10) = exception;
|
| 540 | 536 | Sp(9) = stg_raise_ret_info;
|
| 541 | 537 | Sp(8) = exception;
|
| 542 | - Sp(7) = ghczminternal_GHCziInternalziTypes_True_closure; // True <=> an exception
|
|
| 538 | + Sp(7) = HsIface_True_closure(W_[ghc_hs_iface]); // True <=> an exception
|
|
| 543 | 539 | Sp(6) = stg_ap_ppv_info;
|
| 544 | 540 | Sp(5) = 0;
|
| 545 | 541 | Sp(4) = stg_ap_n_info;
|
| ... | ... | @@ -650,17 +646,17 @@ stg_raiseIOzh (P_ exception) |
| 650 | 646 | |
| 651 | 647 | stg_raiseDivZZerozh ()
|
| 652 | 648 | {
|
| 653 | - jump stg_raisezh(ghczminternal_GHCziInternalziExceptionziType_divZZeroException_closure);
|
|
| 649 | + jump stg_raisezh(HsIface_divZZeroException_closure(W_[ghc_hs_iface]));
|
|
| 654 | 650 | }
|
| 655 | 651 | |
| 656 | 652 | stg_raiseUnderflowzh ()
|
| 657 | 653 | {
|
| 658 | - jump stg_raisezh(ghczminternal_GHCziInternalziExceptionziType_underflowException_closure);
|
|
| 654 | + jump stg_raisezh(HsIface_underflowException_closure(W_[ghc_hs_iface]));
|
|
| 659 | 655 | }
|
| 660 | 656 | |
| 661 | 657 | stg_raiseOverflowzh ()
|
| 662 | 658 | {
|
| 663 | - jump stg_raisezh(ghczminternal_GHCziInternalziExceptionziType_overflowException_closure);
|
|
| 659 | + jump stg_raisezh(HsIface_overflowException_closure(W_[ghc_hs_iface]));
|
|
| 664 | 660 | }
|
| 665 | 661 | |
| 666 | 662 | /* The FFI doesn't support variadic C functions so we can't directly expose
|
| ... | ... | @@ -19,126 +19,69 @@ |
| 19 | 19 | #define PRELUDE_CLOSURE(i) extern StgClosure (i)
|
| 20 | 20 | #endif
|
| 21 | 21 | |
| 22 | -/* See Note [Wired-in exceptions are not CAFfy] in GHC.Core.Make. */
|
|
| 23 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziPrimziPanic_absentSumFieldError_closure);
|
|
| 24 | 22 | |
| 25 | 23 | /* Define canonical names so we can abstract away from the actual
|
| 26 | 24 | * modules these names are defined in.
|
| 27 | 25 | */
|
| 28 | 26 | |
| 29 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTuple_Z0T_closure);
|
|
| 30 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTypes_True_closure);
|
|
| 31 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTypes_False_closure);
|
|
| 32 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziPack_unpackCString_closure);
|
|
| 33 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziPack_unpackCStringUtf8_closure);
|
|
| 34 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziWeak_runFinalizzerBatch_closure);
|
|
| 35 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziWeakziFinalizze_runFinalizzerBatch_closure);
|
|
| 36 | - |
|
| 37 | 27 | #if defined(IN_STG_CODE)
|
| 38 | 28 | extern W_ ZCMain_main_closure[];
|
| 39 | 29 | #else
|
| 40 | 30 | extern StgClosure ZCMain_main_closure;
|
| 41 | 31 | #endif
|
| 42 | 32 | |
| 43 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_stackOverflow_closure);
|
|
| 44 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 45 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_allocationLimitExceeded_closure);
|
|
| 46 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnMVar_closure);
|
|
| 47 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnSTM_closure);
|
|
| 48 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_cannotCompactFunction_closure);
|
|
| 49 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_cannotCompactPinned_closure);
|
|
| 50 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziIOziException_cannotCompactMutable_closure);
|
|
| 51 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziControlziExceptionziBase_nonTermination_closure);
|
|
| 52 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziControlziExceptionziBase_nestedAtomically_closure);
|
|
| 53 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziEventziThread_blockedOnBadFD_closure);
|
|
| 54 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziExceptionziType_divZZeroException_closure);
|
|
| 55 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziExceptionziType_underflowException_closure);
|
|
| 56 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziExceptionziType_overflowException_closure);
|
|
| 57 | - |
|
| 58 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziConcziSync_runSparks_closure);
|
|
| 59 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziConcziIO_ensureIOManagerIsRunning_closure);
|
|
| 60 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziConcziIO_interruptIOManager_closure);
|
|
| 61 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure);
|
|
| 62 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure);
|
|
| 63 | -#if defined(mingw32_HOST_OS)
|
|
| 64 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure);
|
|
| 65 | -#endif
|
|
| 66 | - |
|
| 67 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure);
|
|
| 68 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure);
|
|
| 69 | -PRELUDE_CLOSURE(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure);
|
|
| 70 | - |
|
| 71 | -PRELUDE_INFO(ghczminternal_GHCziInternalziCString_unpackCStringzh_info);
|
|
| 72 | -PRELUDE_INFO(ghczminternal_GHCziInternalziTypes_Czh_con_info);
|
|
| 73 | -PRELUDE_INFO(ghczminternal_GHCziInternalziTypes_Izh_con_info);
|
|
| 74 | -PRELUDE_INFO(ghczminternal_GHCziInternalziTypes_Fzh_con_info);
|
|
| 75 | -PRELUDE_INFO(ghczminternal_GHCziInternalziTypes_Dzh_con_info);
|
|
| 76 | -PRELUDE_INFO(ghczminternal_GHCziInternalziTypes_Wzh_con_info);
|
|
| 77 | - |
|
| 78 | -PRELUDE_INFO(ghczminternal_GHCziInternalziPtr_Ptr_con_info);
|
|
| 79 | -PRELUDE_INFO(ghczminternal_GHCziInternalziPtr_FunPtr_con_info);
|
|
| 80 | -PRELUDE_INFO(ghczminternal_GHCziInternalziInt_I8zh_con_info);
|
|
| 81 | -PRELUDE_INFO(ghczminternal_GHCziInternalziInt_I16zh_con_info);
|
|
| 82 | -PRELUDE_INFO(ghczminternal_GHCziInternalziInt_I32zh_con_info);
|
|
| 83 | -PRELUDE_INFO(ghczminternal_GHCziInternalziInt_I64zh_con_info);
|
|
| 84 | -PRELUDE_INFO(ghczminternal_GHCziInternalziWord_W8zh_con_info);
|
|
| 85 | -PRELUDE_INFO(ghczminternal_GHCziInternalziWord_W16zh_con_info);
|
|
| 86 | -PRELUDE_INFO(ghczminternal_GHCziInternalziWord_W32zh_con_info);
|
|
| 87 | -PRELUDE_INFO(ghczminternal_GHCziInternalziWord_W64zh_con_info);
|
|
| 88 | -PRELUDE_INFO(ghczminternal_GHCziInternalziStable_StablePtr_con_info);
|
|
| 89 | - |
|
| 90 | -#define Unit_closure (&(ghczminternal_GHCziInternalziTuple_Z0T_closure))
|
|
| 91 | -#define True_closure (&(ghczminternal_GHCziInternalziTypes_True_closure))
|
|
| 92 | -#define False_closure (&(ghczminternal_GHCziInternalziTypes_False_closure))
|
|
| 93 | -#define unpackCString_closure (&(ghczminternal_GHCziInternalziPack_unpackCString_closure))
|
|
| 94 | -#define runFinalizerBatch_closure (&(ghczminternal_GHCziInternalziWeakziFinalizze_runFinalizzerBatch_closure))
|
|
| 33 | +#define Unit_closure ghc_hs_iface->Z0T_closure
|
|
| 34 | +#define True_closure ghc_hs_iface->True_closure
|
|
| 35 | +#define False_closure ghc_hs_iface->False_closure
|
|
| 36 | +#define unpackCString_closure ghc_hs_iface->unpackCString_closure
|
|
| 37 | +#define runFinalizerBatch_closure ghc_hs_iface->runFinalizzerBatch_closure
|
|
| 95 | 38 | #define mainIO_closure (&ZCMain_main_closure)
|
| 96 | 39 | |
| 97 | -#define runSparks_closure (&(ghczminternal_GHCziInternalziConcziSync_runSparks_closure))
|
|
| 98 | -#define ensureIOManagerIsRunning_closure (&(ghczminternal_GHCziInternalziConcziIO_ensureIOManagerIsRunning_closure))
|
|
| 99 | -#define interruptIOManager_closure (&(ghczminternal_GHCziInternalziConcziIO_interruptIOManager_closure))
|
|
| 100 | -#define ioManagerCapabilitiesChanged_closure (&(ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure))
|
|
| 101 | -#define runHandlersPtr_closure (&(ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure))
|
|
| 40 | +#define runSparks_closure ghc_hs_iface->runSparks_closure
|
|
| 41 | +#define ensureIOManagerIsRunning_closure ghc_hs_iface->ensureIOManagerIsRunning_closure
|
|
| 42 | +#define interruptIOManager_closure ghc_hs_iface->interruptIOManager_closure
|
|
| 43 | +#define ioManagerCapabilitiesChanged_closure ghc_hs_iface->ioManagerCapabilitiesChanged_closure
|
|
| 44 | +#define runHandlersPtr_closure ghc_hs_iface->runHandlersPtr_closure
|
|
| 102 | 45 | #if defined(mingw32_HOST_OS)
|
| 103 | -#define processRemoteCompletion_closure (&(ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure))
|
|
| 46 | +#define processRemoteCompletion_closure ghc_hs_iface->processRemoteCompletion_closure
|
|
| 104 | 47 | #endif
|
| 105 | -#define runAllocationLimitHandler_closure (&(ghczminternal_GHCziInternalziAllocationLimitHandler_runAllocationLimitHandler_closure))
|
|
| 106 | - |
|
| 107 | -#define flushStdHandles_closure (&(ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure))
|
|
| 108 | -#define runMainIO_closure (&(ghczminternal_GHCziInternalziTopHandler_runMainIO_closure))
|
|
| 109 | - |
|
| 110 | -#define stackOverflow_closure (&(ghczminternal_GHCziInternalziIOziException_stackOverflow_closure))
|
|
| 111 | -#define heapOverflow_closure (&(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure))
|
|
| 112 | -#define allocationLimitExceeded_closure (&(ghczminternal_GHCziInternalziIOziException_allocationLimitExceeded_closure))
|
|
| 113 | -#define blockedIndefinitelyOnMVar_closure (&(ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnMVar_closure))
|
|
| 114 | -#define blockedIndefinitelyOnSTM_closure (&(ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnSTM_closure))
|
|
| 115 | -#define cannotCompactFunction_closure (&(ghczminternal_GHCziInternalziIOziException_cannotCompactFunction_closure))
|
|
| 116 | -#define cannotCompactPinned_closure (&(ghczminternal_GHCziInternalziIOziException_cannotCompactPinned_closure))
|
|
| 117 | -#define cannotCompactMutable_closure (&(ghczminternal_GHCziInternalziIOziException_cannotCompactMutable_closure))
|
|
| 118 | -#define nonTermination_closure (&(ghczminternal_GHCziInternalziControlziExceptionziBase_nonTermination_closure))
|
|
| 119 | -#define nestedAtomically_closure (&(ghczminternal_GHCziInternalziControlziExceptionziBase_nestedAtomically_closure))
|
|
| 120 | -#define absentSumFieldError_closure (&(ghczminternal_GHCziInternalziPrimziPanic_absentSumFieldError_closure))
|
|
| 121 | -#define underflowException_closure (&(ghczminternal_GHCziInternalziExceptionziType_underflowException_closure))
|
|
| 122 | -#define overflowException_closure (&(ghczminternal_GHCziInternalziExceptionziType_overflowException_closure))
|
|
| 123 | -#define divZeroException_closure (&(ghczminternal_GHCziInternalziExceptionziType_divZZeroException_closure))
|
|
| 124 | - |
|
| 125 | -#define blockedOnBadFD_closure (&(ghczminternal_GHCziInternalziEventziThread_blockedOnBadFD_closure))
|
|
| 126 | - |
|
| 127 | -#define Czh_con_info (&(ghczminternal_GHCziInternalziTypes_Czh_con_info))
|
|
| 128 | -#define Izh_con_info (&(ghczminternal_GHCziInternalziTypes_Izh_con_info))
|
|
| 129 | -#define Fzh_con_info (&(ghczminternal_GHCziInternalziTypes_Fzh_con_info))
|
|
| 130 | -#define Dzh_con_info (&(ghczminternal_GHCziInternalziTypes_Dzh_con_info))
|
|
| 131 | -#define Wzh_con_info (&(ghczminternal_GHCziInternalziTypes_Wzh_con_info))
|
|
| 132 | -#define W8zh_con_info (&(ghczminternal_GHCziInternalziWord_W8zh_con_info))
|
|
| 133 | -#define W16zh_con_info (&(ghczminternal_GHCziInternalziWord_W16zh_con_info))
|
|
| 134 | -#define W32zh_con_info (&(ghczminternal_GHCziInternalziWord_W32zh_con_info))
|
|
| 135 | -#define W64zh_con_info (&(ghczminternal_GHCziInternalziWord_W64zh_con_info))
|
|
| 136 | -#define I8zh_con_info (&(ghczminternal_GHCziInternalziInt_I8zh_con_info))
|
|
| 137 | -#define I16zh_con_info (&(ghczminternal_GHCziInternalziInt_I16zh_con_info))
|
|
| 138 | -#define I32zh_con_info (&(ghczminternal_GHCziInternalziInt_I32zh_con_info))
|
|
| 139 | -#define I64zh_con_info (&(ghczminternal_GHCziInternalziInt_I64zh_con_info))
|
|
| 140 | -#define I64zh_con_info (&(ghczminternal_GHCziInternalziInt_I64zh_con_info))
|
|
| 141 | -#define Ptr_con_info (&(ghczminternal_GHCziInternalziPtr_Ptr_con_info))
|
|
| 142 | -#define FunPtr_con_info (&(ghczminternal_GHCziInternalziPtr_FunPtr_con_info))
|
|
| 143 | -#define StablePtr_static_info (&(ghczminternal_GHCziInternalziStable_StablePtr_static_info))
|
|
| 144 | -#define StablePtr_con_info (&(ghczminternal_GHCziInternalziStable_StablePtr_con_info)) |
|
| 48 | +#define runAllocationLimitHandler_closure ghc_hs_iface->runAllocationLimitHandler_closure
|
|
| 49 | + |
|
| 50 | +#define flushStdHandles_closure ghc_hs_iface->flushStdHandles_closure
|
|
| 51 | +#define runMainIO_closure ghc_hs_iface->runMainIO_closure
|
|
| 52 | + |
|
| 53 | +#define stackOverflow_closure ghc_hs_iface->stackOverflow_closure
|
|
| 54 | +#define heapOverflow_closure ghc_hs_iface->heapOverflow_closure
|
|
| 55 | +#define allocationLimitExceeded_closure ghc_hs_iface->allocationLimitExceeded_closure
|
|
| 56 | +#define blockedIndefinitelyOnMVar_closure ghc_hs_iface->blockedIndefinitelyOnMVar_closure
|
|
| 57 | +#define blockedIndefinitelyOnSTM_closure ghc_hs_iface->blockedIndefinitelyOnSTM_closure
|
|
| 58 | +#define cannotCompactFunction_closure ghc_hs_iface->cannotCompactFunction_closure
|
|
| 59 | +#define cannotCompactPinned_closure ghc_hs_iface->cannotCompactPinned_closure
|
|
| 60 | +#define cannotCompactMutable_closure ghc_hs_iface->cannotCompactMutable_closure
|
|
| 61 | +#define nonTermination_closure ghc_hs_iface->nonTermination_closure
|
|
| 62 | +#define nestedAtomically_closure ghc_hs_iface->nestedAtomically_closure
|
|
| 63 | +#define absentSumFieldError_closure ghc_hs_iface->absentSumFieldError_closure
|
|
| 64 | +#define underflowException_closure ghc_hs_iface->underflowException_closure
|
|
| 65 | +#define overflowException_closure ghc_hs_iface->overflowException_closure
|
|
| 66 | +#define divZeroException_closure ghc_hs_iface->divZZeroException_closure
|
|
| 67 | + |
|
| 68 | +#define blockedOnBadFD_closure ghc_hs_iface->blockedOnBadFD_closure
|
|
| 69 | + |
|
| 70 | +#define Czh_con_info ghc_hs_iface->Czh_con_info
|
|
| 71 | +#define Izh_con_info ghc_hs_iface->Izh_con_info
|
|
| 72 | +#define Fzh_con_info ghc_hs_iface->Fzh_con_info
|
|
| 73 | +#define Dzh_con_info ghc_hs_iface->Dzh_con_info
|
|
| 74 | +#define Wzh_con_info ghc_hs_iface->Wzh_con_info
|
|
| 75 | +#define W8zh_con_info ghc_hs_iface->W8zh_con_info
|
|
| 76 | +#define W16zh_con_info ghc_hs_iface->W16zh_con_info
|
|
| 77 | +#define W32zh_con_info ghc_hs_iface->W32zh_con_info
|
|
| 78 | +#define W64zh_con_info ghc_hs_iface->W64zh_con_info
|
|
| 79 | +#define I8zh_con_info ghc_hs_iface->I8zh_con_info
|
|
| 80 | +#define I16zh_con_info ghc_hs_iface->I16zh_con_info
|
|
| 81 | +#define I32zh_con_info ghc_hs_iface->I32zh_con_info
|
|
| 82 | +#define I64zh_con_info ghc_hs_iface->I64zh_con_info
|
|
| 83 | +#define I64zh_con_info ghc_hs_iface->I64zh_con_info
|
|
| 84 | +#define Ptr_con_info ghc_hs_iface->Ptr_con_info
|
|
| 85 | +#define FunPtr_con_info ghc_hs_iface->FunPtr_con_info
|
|
| 86 | +#define StablePtr_static_info ghc_hs_iface->StablePtr_static_info
|
|
| 87 | +#define StablePtr_con_info ghc_hs_iface->StablePtr_con_info |
| ... | ... | @@ -25,12 +25,8 @@ |
| 25 | 25 | #include "MachDeps.h"
|
| 26 | 26 | #include "SMPClosureOps.h"
|
| 27 | 27 | |
| 28 | -import CLOSURE ghczminternal_GHCziInternalziControlziExceptionziBase_nestedAtomically_closure;
|
|
| 29 | -import CLOSURE ghczminternal_GHCziInternalziIOziException_heapOverflow_closure;
|
|
| 30 | -import CLOSURE ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnMVar_closure;
|
|
| 31 | 28 | import AcquireSRWLockExclusive;
|
| 32 | 29 | import ReleaseSRWLockExclusive;
|
| 33 | -import CLOSURE ghczminternal_GHCziInternalziTypes_False_closure;
|
|
| 34 | 30 | #if defined(PROFILING)
|
| 35 | 31 | import CLOSURE CCS_MAIN;
|
| 36 | 32 | #endif
|
| ... | ... | @@ -118,7 +114,7 @@ stg_newByteArrayzh ( W_ n ) |
| 118 | 114 | |
| 119 | 115 | ("ptr" p) = ccall allocateArrBytes(MyCapability() "ptr", n, CCCS);
|
| 120 | 116 | if (p == NULL) (likely: False) {
|
| 121 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 117 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 122 | 118 | }
|
| 123 | 119 | return (p);
|
| 124 | 120 | }
|
| ... | ... | @@ -135,7 +131,7 @@ stg_newPinnedByteArrayzh ( W_ n ) |
| 135 | 131 | ("ptr" p) = ccall allocateArrBytesPinned(MyCapability() "ptr", n,
|
| 136 | 132 | BA_ALIGN, CCCS);
|
| 137 | 133 | if (p == NULL) (likely: False) {
|
| 138 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 134 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 139 | 135 | }
|
| 140 | 136 | return (p);
|
| 141 | 137 | }
|
| ... | ... | @@ -149,7 +145,7 @@ stg_newAlignedPinnedByteArrayzh ( W_ n, W_ alignment ) |
| 149 | 145 | ("ptr" p) = ccall allocateArrBytesPinned(MyCapability() "ptr", n,
|
| 150 | 146 | alignment, CCCS);
|
| 151 | 147 | if (p == NULL) (likely: False) {
|
| 152 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 148 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 153 | 149 | }
|
| 154 | 150 | return (p);
|
| 155 | 151 | }
|
| ... | ... | @@ -364,7 +360,7 @@ stg_newArrayzh ( W_ n /* words */, gcptr init ) |
| 364 | 360 | |
| 365 | 361 | ("ptr" arr) = ccall allocateMutArrPtrs(MyCapability() "ptr", n, CCCS);
|
| 366 | 362 | if (arr == NULL) (likely: False) {
|
| 367 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 363 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 368 | 364 | }
|
| 369 | 365 | |
| 370 | 366 | // Initialise all elements of the array with the value init
|
| ... | ... | @@ -474,7 +470,7 @@ stg_newSmallArrayzh ( W_ n /* words */, gcptr init ) |
| 474 | 470 | |
| 475 | 471 | ("ptr" arr) = ccall allocateSmallMutArrPtrs(MyCapability() "ptr", n, CCCS);
|
| 476 | 472 | if (arr == NULL) (likely: False) {
|
| 477 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 473 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 478 | 474 | }
|
| 479 | 475 | |
| 480 | 476 | // Initialise all elements of the array with the value init
|
| ... | ... | @@ -1090,7 +1086,7 @@ stg_listThreadszh () |
| 1090 | 1086 | ("ptr" arr) = ccall listThreads(MyCapability() "ptr");
|
| 1091 | 1087 | |
| 1092 | 1088 | if (arr == NULL) (likely: False) {
|
| 1093 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 1089 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 1094 | 1090 | }
|
| 1095 | 1091 | |
| 1096 | 1092 | return (arr);
|
| ... | ... | @@ -1360,7 +1356,7 @@ stg_atomicallyzh (P_ stm) |
| 1360 | 1356 | |
| 1361 | 1357 | /* Nested transactions are not allowed; raise an exception */
|
| 1362 | 1358 | if (old_trec != NO_TREC) (likely: False) {
|
| 1363 | - jump stg_raisezh(ghczminternal_GHCziInternalziControlziExceptionziBase_nestedAtomically_closure);
|
|
| 1359 | + jump stg_raisezh(HsIface_nestedAtomically_closure(W_[ghc_hs_iface]));
|
|
| 1364 | 1360 | }
|
| 1365 | 1361 | |
| 1366 | 1362 | code = stm;
|
| ... | ... | @@ -2231,7 +2227,7 @@ stg_unpackClosurezh ( P_ closure ) |
| 2231 | 2227 | dat_arr_sz = SIZEOF_StgArrBytes + WDS(len);
|
| 2232 | 2228 | ("ptr" dat_arr) = ccall allocateMightFail(MyCapability() "ptr", BYTES_TO_WDS(dat_arr_sz));
|
| 2233 | 2229 | if (dat_arr == NULL) (likely: False) {
|
| 2234 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 2230 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 2235 | 2231 | }
|
| 2236 | 2232 | TICK_ALLOC_PRIM(SIZEOF_StgArrBytes, WDS(len), 0);
|
| 2237 | 2233 | |
| ... | ... | @@ -2251,7 +2247,7 @@ for: |
| 2251 | 2247 | ("ptr" ptrArray) = foreign "C" heap_view_closurePtrs(MyCapability() "ptr", clos "ptr");
|
| 2252 | 2248 | |
| 2253 | 2249 | if (ptrArray == NULL) (likely: False) {
|
| 2254 | - jump stg_raisezh(ghczminternal_GHCziInternalziIOziException_heapOverflow_closure);
|
|
| 2250 | + jump stg_raisezh(HsIface_heapOverflow_closure(W_[ghc_hs_iface]));
|
|
| 2255 | 2251 | }
|
| 2256 | 2252 | |
| 2257 | 2253 | return (info, dat_arr, ptrArray);
|
| ... | ... | @@ -2518,13 +2514,13 @@ stg_getSparkzh () |
| 2518 | 2514 | W_ spark;
|
| 2519 | 2515 | |
| 2520 | 2516 | #if !defined(THREADED_RTS)
|
| 2521 | - return (0,ghczminternal_GHCziInternalziTypes_False_closure);
|
|
| 2517 | + return (0,HsIface_False_closure(W_[ghc_hs_iface]));
|
|
| 2522 | 2518 | #else
|
| 2523 | 2519 | ("ptr" spark) = ccall findSpark(MyCapability() "ptr");
|
| 2524 | 2520 | if (spark != 0) {
|
| 2525 | 2521 | return (1,spark);
|
| 2526 | 2522 | } else {
|
| 2527 | - return (0,ghczminternal_GHCziInternalziTypes_False_closure);
|
|
| 2523 | + return (0,HsIface_False_closure(W_[ghc_hs_iface]));
|
|
| 2528 | 2524 | }
|
| 2529 | 2525 | #endif
|
| 2530 | 2526 | }
|
| ... | ... | @@ -509,7 +509,7 @@ void rts_evalStableIOMain(/* inout */ Capability **cap, |
| 509 | 509 | SchedulerStatus stat;
|
| 510 | 510 | |
| 511 | 511 | p = (StgClosure *)deRefStablePtr(s);
|
| 512 | - w = rts_apply(*cap, &ghczminternal_GHCziInternalziTopHandler_runMainIO_closure, p);
|
|
| 512 | + w = rts_apply(*cap, runMainIO_closure, p);
|
|
| 513 | 513 | tso = createStrictIOThread(*cap, RtsFlags.GcFlags.initialStkSize, w);
|
| 514 | 514 | // async exceptions are always blocked by default in the created
|
| 515 | 515 | // thread. See #1048.
|
| ... | ... | @@ -961,7 +961,7 @@ void rts_done (void) |
| 961 | 961 | void hs_try_putmvar (/* in */ int capability,
|
| 962 | 962 | /* in */ HsStablePtr mvar)
|
| 963 | 963 | {
|
| 964 | - hs_try_putmvar_with_value(capability, mvar, TAG_CLOSURE(1, Unit_closure));
|
|
| 964 | + hs_try_putmvar_with_value(capability, mvar, TAG_CLOSURE(1, ghc_hs_iface->Z0T_closure));
|
|
| 965 | 965 | }
|
| 966 | 966 | |
| 967 | 967 | void hs_try_putmvar_with_value (/* in */ int capability,
|
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | #include "linker/MMap.h"
|
| 15 | 15 | #include "RtsFlags.h"
|
| 16 | 16 | #include "RtsUtils.h"
|
| 17 | +#include "BuiltinClosures.h"
|
|
| 17 | 18 | #include "Prelude.h"
|
| 18 | 19 | #include "Printer.h" /* DEBUG_LoadSymbols */
|
| 19 | 20 | #include "Schedule.h" /* initScheduler */
|
| ... | ... | @@ -182,8 +183,8 @@ static void initBuiltinGcRoots(void) |
| 182 | 183 | * these closures `Id`s of these can be safely marked as non-CAFFY
|
| 183 | 184 | * in the compiler.
|
| 184 | 185 | */
|
| 185 | - getStablePtr((StgPtr)runIO_closure);
|
|
| 186 | - getStablePtr((StgPtr)runNonIO_closure);
|
|
| 186 | + getStablePtr((StgPtr)ghc_hs_iface->runIO_closure);
|
|
| 187 | + getStablePtr((StgPtr)ghc_hs_iface->runNonIO_closure);
|
|
| 187 | 188 | getStablePtr((StgPtr)flushStdHandles_closure);
|
| 188 | 189 | |
| 189 | 190 | getStablePtr((StgPtr)runFinalizerBatch_closure);
|
| ... | ... | @@ -262,6 +263,14 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config) |
| 262 | 263 | |
| 263 | 264 | setlocale(LC_CTYPE,"");
|
| 264 | 265 | |
| 266 | + if (ghc_hs_iface == NULL) {
|
|
| 267 | + errorBelch("hs_init_ghc: ghc_hs_iface is uninitialized");
|
|
| 268 | + stg_exit(1);
|
|
| 269 | + }
|
|
| 270 | + |
|
| 271 | + |
|
| 272 | + initBuiltinClosures();
|
|
| 273 | + |
|
| 265 | 274 | /* Initialise the stats department, phase 0 */
|
| 266 | 275 | initStats0();
|
| 267 | 276 |
| 1 | +/*
|
|
| 2 | + * (c) The GHC Team, 2025-2026
|
|
| 3 | + *
|
|
| 4 | + * RTS/ghc-internal interface
|
|
| 5 | + *
|
|
| 6 | + *
|
|
| 7 | + * Note [RTS/ghc-internal interface]
|
|
| 8 | + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 9 | + *
|
|
| 10 | + * The runtime system depends upon a variety of symbols defined by Haskell
|
|
| 11 | + * modules living in `ghc-internal`. To avoid cyclic dependencies between
|
|
| 12 | + * ghc-internal and the RTS, these symbols are referenced indirectly via the
|
|
| 13 | + * the `HsIface` structure (specifically `ghc_hs_iface`):
|
|
| 14 | + *
|
|
| 15 | + * struct HsIface {
|
|
| 16 | + * StgClosure *runIO; // GHC.Internal.TopHandler.runIO
|
|
| 17 | + * StgClosure *Z0T; // GHC.Internal.Tuple.()
|
|
| 18 | + * // etc.
|
|
| 19 | + * };
|
|
| 20 | + *
|
|
| 21 | + * `ghc_hs_iface` is initialized during program loading via the
|
|
| 22 | + * `init_ghc_hs_iface` constructor in `ghc-interface`
|
|
| 23 | + *
|
|
| 24 | + * const struct HsIface the_hs_iface = {
|
|
| 25 | + * .runIO = &ghczminternal_GHCziInternalziTopHandler_runIO_closure,
|
|
| 26 | + * .Z0T = &ghczminternal_GHCziInternalziTuple_Z0T_closure,
|
|
| 27 | + * // etc.
|
|
| 28 | + * };
|
|
| 29 | + *
|
|
| 30 | + * void __attribute__((constructor)) init_ghc_hs_iface() {
|
|
| 31 | + * ghc_hs_iface = &the_hs_iface;
|
|
| 32 | + * }
|
|
| 33 | + *
|
|
| 34 | + * This effectively breaks the RTS's link-time dependency, replacing it with a
|
|
| 35 | + * run-time dependency at the cost of an indirection. It also has the pleasant
|
|
| 36 | + * side-effect of making the interface between the RTS and `ghc-internal`
|
|
| 37 | + * explicit.
|
|
| 38 | + *
|
|
| 39 | + */
|
|
| 40 | + |
|
| 41 | +#include "Rts.h"
|
|
| 42 | + |
|
| 43 | +// This captures the symbols provided by ghc-internal which
|
|
| 44 | +// are needed by the RTS.
|
|
| 45 | +const HsIface *ghc_hs_iface = NULL; |
| ... | ... | @@ -1053,7 +1053,7 @@ scheduleProcessInbox (Capability **pcap USED_IF_THREADS) |
| 1053 | 1053 | while (p != NULL) {
|
| 1054 | 1054 | pnext = p->link;
|
| 1055 | 1055 | performTryPutMVar(cap, (StgMVar*)deRefStablePtr(p->mvar),
|
| 1056 | - Unit_closure);
|
|
| 1056 | + ghc_hs_iface->Z0T_closure);
|
|
| 1057 | 1057 | freeStablePtr(p->mvar);
|
| 1058 | 1058 | stgFree(p);
|
| 1059 | 1059 | p = pnext;
|
| ... | ... | @@ -13,8 +13,6 @@ |
| 13 | 13 | #include "Cmm.h"
|
| 14 | 14 | |
| 15 | 15 | import pthread_mutex_lock;
|
| 16 | -import ghczminternal_GHCziInternalziTypes_Czh_info;
|
|
| 17 | -import ghczminternal_GHCziInternalziTypes_Izh_info;
|
|
| 18 | 16 | import AcquireSRWLockExclusive;
|
| 19 | 17 | import ReleaseSRWLockExclusive;
|
| 20 | 18 | |
| ... | ... | @@ -23,7 +21,6 @@ import whitehole_lockClosure_spin; |
| 23 | 21 | import whitehole_lockClosure_yield;
|
| 24 | 22 | #endif
|
| 25 | 23 | |
| 26 | - |
|
| 27 | 24 | #if !defined(UnregisterisedCompiler)
|
| 28 | 25 | import CLOSURE CCS_SYSTEM;
|
| 29 | 26 | import CLOSURE ENT_DYN_IND_ctr;
|
| ... | ... | @@ -1031,554 +1028,3 @@ INFO_TABLE_CONSTR(stg_ASYNCIO_LIVE0,0,0,0,CONSTR_NOCAF,"ASYNCIO_LIVE0","ASYNCIO_ |
| 1031 | 1028 | { foreign "C" barf("ASYNCIO_LIVE0 object (%p) entered!", R1) never returns; }
|
| 1032 | 1029 | |
| 1033 | 1030 | CLOSURE(stg_ASYNCIO_LIVE0_closure,stg_ASYNCIO_LIVE0); |
| 1034 | - |
|
| 1035 | -/* ----------------------------------------------------------------------------
|
|
| 1036 | - Note [CHARLIKE and INTLIKE closures]
|
|
| 1037 | - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 1038 | - These are static representations of Chars and small Ints, so that
|
|
| 1039 | - we can remove dynamic Chars and Ints during garbage collection and
|
|
| 1040 | - replace them with references to the static objects.
|
|
| 1041 | - ------------------------------------------------------------------------- */
|
|
| 1042 | - |
|
| 1043 | -#define Char_hash_con_info ghczminternal_GHCziInternalziTypes_Czh_con_info
|
|
| 1044 | -#define Int_hash_con_info ghczminternal_GHCziInternalziTypes_Izh_con_info
|
|
| 1045 | - |
|
| 1046 | -#define CHARLIKE_HDR(n) CLOSURE(Char_hash_con_info, n)
|
|
| 1047 | -#define INTLIKE_HDR(n) CLOSURE(Int_hash_con_info, n)
|
|
| 1048 | - |
|
| 1049 | -section "data" {
|
|
| 1050 | - stg_CHARLIKE_closure:
|
|
| 1051 | - CHARLIKE_HDR(0)
|
|
| 1052 | - CHARLIKE_HDR(1)
|
|
| 1053 | - CHARLIKE_HDR(2)
|
|
| 1054 | - CHARLIKE_HDR(3)
|
|
| 1055 | - CHARLIKE_HDR(4)
|
|
| 1056 | - CHARLIKE_HDR(5)
|
|
| 1057 | - CHARLIKE_HDR(6)
|
|
| 1058 | - CHARLIKE_HDR(7)
|
|
| 1059 | - CHARLIKE_HDR(8)
|
|
| 1060 | - CHARLIKE_HDR(9)
|
|
| 1061 | - CHARLIKE_HDR(10)
|
|
| 1062 | - CHARLIKE_HDR(11)
|
|
| 1063 | - CHARLIKE_HDR(12)
|
|
| 1064 | - CHARLIKE_HDR(13)
|
|
| 1065 | - CHARLIKE_HDR(14)
|
|
| 1066 | - CHARLIKE_HDR(15)
|
|
| 1067 | - CHARLIKE_HDR(16)
|
|
| 1068 | - CHARLIKE_HDR(17)
|
|
| 1069 | - CHARLIKE_HDR(18)
|
|
| 1070 | - CHARLIKE_HDR(19)
|
|
| 1071 | - CHARLIKE_HDR(20)
|
|
| 1072 | - CHARLIKE_HDR(21)
|
|
| 1073 | - CHARLIKE_HDR(22)
|
|
| 1074 | - CHARLIKE_HDR(23)
|
|
| 1075 | - CHARLIKE_HDR(24)
|
|
| 1076 | - CHARLIKE_HDR(25)
|
|
| 1077 | - CHARLIKE_HDR(26)
|
|
| 1078 | - CHARLIKE_HDR(27)
|
|
| 1079 | - CHARLIKE_HDR(28)
|
|
| 1080 | - CHARLIKE_HDR(29)
|
|
| 1081 | - CHARLIKE_HDR(30)
|
|
| 1082 | - CHARLIKE_HDR(31)
|
|
| 1083 | - CHARLIKE_HDR(32)
|
|
| 1084 | - CHARLIKE_HDR(33)
|
|
| 1085 | - CHARLIKE_HDR(34)
|
|
| 1086 | - CHARLIKE_HDR(35)
|
|
| 1087 | - CHARLIKE_HDR(36)
|
|
| 1088 | - CHARLIKE_HDR(37)
|
|
| 1089 | - CHARLIKE_HDR(38)
|
|
| 1090 | - CHARLIKE_HDR(39)
|
|
| 1091 | - CHARLIKE_HDR(40)
|
|
| 1092 | - CHARLIKE_HDR(41)
|
|
| 1093 | - CHARLIKE_HDR(42)
|
|
| 1094 | - CHARLIKE_HDR(43)
|
|
| 1095 | - CHARLIKE_HDR(44)
|
|
| 1096 | - CHARLIKE_HDR(45)
|
|
| 1097 | - CHARLIKE_HDR(46)
|
|
| 1098 | - CHARLIKE_HDR(47)
|
|
| 1099 | - CHARLIKE_HDR(48)
|
|
| 1100 | - CHARLIKE_HDR(49)
|
|
| 1101 | - CHARLIKE_HDR(50)
|
|
| 1102 | - CHARLIKE_HDR(51)
|
|
| 1103 | - CHARLIKE_HDR(52)
|
|
| 1104 | - CHARLIKE_HDR(53)
|
|
| 1105 | - CHARLIKE_HDR(54)
|
|
| 1106 | - CHARLIKE_HDR(55)
|
|
| 1107 | - CHARLIKE_HDR(56)
|
|
| 1108 | - CHARLIKE_HDR(57)
|
|
| 1109 | - CHARLIKE_HDR(58)
|
|
| 1110 | - CHARLIKE_HDR(59)
|
|
| 1111 | - CHARLIKE_HDR(60)
|
|
| 1112 | - CHARLIKE_HDR(61)
|
|
| 1113 | - CHARLIKE_HDR(62)
|
|
| 1114 | - CHARLIKE_HDR(63)
|
|
| 1115 | - CHARLIKE_HDR(64)
|
|
| 1116 | - CHARLIKE_HDR(65)
|
|
| 1117 | - CHARLIKE_HDR(66)
|
|
| 1118 | - CHARLIKE_HDR(67)
|
|
| 1119 | - CHARLIKE_HDR(68)
|
|
| 1120 | - CHARLIKE_HDR(69)
|
|
| 1121 | - CHARLIKE_HDR(70)
|
|
| 1122 | - CHARLIKE_HDR(71)
|
|
| 1123 | - CHARLIKE_HDR(72)
|
|
| 1124 | - CHARLIKE_HDR(73)
|
|
| 1125 | - CHARLIKE_HDR(74)
|
|
| 1126 | - CHARLIKE_HDR(75)
|
|
| 1127 | - CHARLIKE_HDR(76)
|
|
| 1128 | - CHARLIKE_HDR(77)
|
|
| 1129 | - CHARLIKE_HDR(78)
|
|
| 1130 | - CHARLIKE_HDR(79)
|
|
| 1131 | - CHARLIKE_HDR(80)
|
|
| 1132 | - CHARLIKE_HDR(81)
|
|
| 1133 | - CHARLIKE_HDR(82)
|
|
| 1134 | - CHARLIKE_HDR(83)
|
|
| 1135 | - CHARLIKE_HDR(84)
|
|
| 1136 | - CHARLIKE_HDR(85)
|
|
| 1137 | - CHARLIKE_HDR(86)
|
|
| 1138 | - CHARLIKE_HDR(87)
|
|
| 1139 | - CHARLIKE_HDR(88)
|
|
| 1140 | - CHARLIKE_HDR(89)
|
|
| 1141 | - CHARLIKE_HDR(90)
|
|
| 1142 | - CHARLIKE_HDR(91)
|
|
| 1143 | - CHARLIKE_HDR(92)
|
|
| 1144 | - CHARLIKE_HDR(93)
|
|
| 1145 | - CHARLIKE_HDR(94)
|
|
| 1146 | - CHARLIKE_HDR(95)
|
|
| 1147 | - CHARLIKE_HDR(96)
|
|
| 1148 | - CHARLIKE_HDR(97)
|
|
| 1149 | - CHARLIKE_HDR(98)
|
|
| 1150 | - CHARLIKE_HDR(99)
|
|
| 1151 | - CHARLIKE_HDR(100)
|
|
| 1152 | - CHARLIKE_HDR(101)
|
|
| 1153 | - CHARLIKE_HDR(102)
|
|
| 1154 | - CHARLIKE_HDR(103)
|
|
| 1155 | - CHARLIKE_HDR(104)
|
|
| 1156 | - CHARLIKE_HDR(105)
|
|
| 1157 | - CHARLIKE_HDR(106)
|
|
| 1158 | - CHARLIKE_HDR(107)
|
|
| 1159 | - CHARLIKE_HDR(108)
|
|
| 1160 | - CHARLIKE_HDR(109)
|
|
| 1161 | - CHARLIKE_HDR(110)
|
|
| 1162 | - CHARLIKE_HDR(111)
|
|
| 1163 | - CHARLIKE_HDR(112)
|
|
| 1164 | - CHARLIKE_HDR(113)
|
|
| 1165 | - CHARLIKE_HDR(114)
|
|
| 1166 | - CHARLIKE_HDR(115)
|
|
| 1167 | - CHARLIKE_HDR(116)
|
|
| 1168 | - CHARLIKE_HDR(117)
|
|
| 1169 | - CHARLIKE_HDR(118)
|
|
| 1170 | - CHARLIKE_HDR(119)
|
|
| 1171 | - CHARLIKE_HDR(120)
|
|
| 1172 | - CHARLIKE_HDR(121)
|
|
| 1173 | - CHARLIKE_HDR(122)
|
|
| 1174 | - CHARLIKE_HDR(123)
|
|
| 1175 | - CHARLIKE_HDR(124)
|
|
| 1176 | - CHARLIKE_HDR(125)
|
|
| 1177 | - CHARLIKE_HDR(126)
|
|
| 1178 | - CHARLIKE_HDR(127)
|
|
| 1179 | - CHARLIKE_HDR(128)
|
|
| 1180 | - CHARLIKE_HDR(129)
|
|
| 1181 | - CHARLIKE_HDR(130)
|
|
| 1182 | - CHARLIKE_HDR(131)
|
|
| 1183 | - CHARLIKE_HDR(132)
|
|
| 1184 | - CHARLIKE_HDR(133)
|
|
| 1185 | - CHARLIKE_HDR(134)
|
|
| 1186 | - CHARLIKE_HDR(135)
|
|
| 1187 | - CHARLIKE_HDR(136)
|
|
| 1188 | - CHARLIKE_HDR(137)
|
|
| 1189 | - CHARLIKE_HDR(138)
|
|
| 1190 | - CHARLIKE_HDR(139)
|
|
| 1191 | - CHARLIKE_HDR(140)
|
|
| 1192 | - CHARLIKE_HDR(141)
|
|
| 1193 | - CHARLIKE_HDR(142)
|
|
| 1194 | - CHARLIKE_HDR(143)
|
|
| 1195 | - CHARLIKE_HDR(144)
|
|
| 1196 | - CHARLIKE_HDR(145)
|
|
| 1197 | - CHARLIKE_HDR(146)
|
|
| 1198 | - CHARLIKE_HDR(147)
|
|
| 1199 | - CHARLIKE_HDR(148)
|
|
| 1200 | - CHARLIKE_HDR(149)
|
|
| 1201 | - CHARLIKE_HDR(150)
|
|
| 1202 | - CHARLIKE_HDR(151)
|
|
| 1203 | - CHARLIKE_HDR(152)
|
|
| 1204 | - CHARLIKE_HDR(153)
|
|
| 1205 | - CHARLIKE_HDR(154)
|
|
| 1206 | - CHARLIKE_HDR(155)
|
|
| 1207 | - CHARLIKE_HDR(156)
|
|
| 1208 | - CHARLIKE_HDR(157)
|
|
| 1209 | - CHARLIKE_HDR(158)
|
|
| 1210 | - CHARLIKE_HDR(159)
|
|
| 1211 | - CHARLIKE_HDR(160)
|
|
| 1212 | - CHARLIKE_HDR(161)
|
|
| 1213 | - CHARLIKE_HDR(162)
|
|
| 1214 | - CHARLIKE_HDR(163)
|
|
| 1215 | - CHARLIKE_HDR(164)
|
|
| 1216 | - CHARLIKE_HDR(165)
|
|
| 1217 | - CHARLIKE_HDR(166)
|
|
| 1218 | - CHARLIKE_HDR(167)
|
|
| 1219 | - CHARLIKE_HDR(168)
|
|
| 1220 | - CHARLIKE_HDR(169)
|
|
| 1221 | - CHARLIKE_HDR(170)
|
|
| 1222 | - CHARLIKE_HDR(171)
|
|
| 1223 | - CHARLIKE_HDR(172)
|
|
| 1224 | - CHARLIKE_HDR(173)
|
|
| 1225 | - CHARLIKE_HDR(174)
|
|
| 1226 | - CHARLIKE_HDR(175)
|
|
| 1227 | - CHARLIKE_HDR(176)
|
|
| 1228 | - CHARLIKE_HDR(177)
|
|
| 1229 | - CHARLIKE_HDR(178)
|
|
| 1230 | - CHARLIKE_HDR(179)
|
|
| 1231 | - CHARLIKE_HDR(180)
|
|
| 1232 | - CHARLIKE_HDR(181)
|
|
| 1233 | - CHARLIKE_HDR(182)
|
|
| 1234 | - CHARLIKE_HDR(183)
|
|
| 1235 | - CHARLIKE_HDR(184)
|
|
| 1236 | - CHARLIKE_HDR(185)
|
|
| 1237 | - CHARLIKE_HDR(186)
|
|
| 1238 | - CHARLIKE_HDR(187)
|
|
| 1239 | - CHARLIKE_HDR(188)
|
|
| 1240 | - CHARLIKE_HDR(189)
|
|
| 1241 | - CHARLIKE_HDR(190)
|
|
| 1242 | - CHARLIKE_HDR(191)
|
|
| 1243 | - CHARLIKE_HDR(192)
|
|
| 1244 | - CHARLIKE_HDR(193)
|
|
| 1245 | - CHARLIKE_HDR(194)
|
|
| 1246 | - CHARLIKE_HDR(195)
|
|
| 1247 | - CHARLIKE_HDR(196)
|
|
| 1248 | - CHARLIKE_HDR(197)
|
|
| 1249 | - CHARLIKE_HDR(198)
|
|
| 1250 | - CHARLIKE_HDR(199)
|
|
| 1251 | - CHARLIKE_HDR(200)
|
|
| 1252 | - CHARLIKE_HDR(201)
|
|
| 1253 | - CHARLIKE_HDR(202)
|
|
| 1254 | - CHARLIKE_HDR(203)
|
|
| 1255 | - CHARLIKE_HDR(204)
|
|
| 1256 | - CHARLIKE_HDR(205)
|
|
| 1257 | - CHARLIKE_HDR(206)
|
|
| 1258 | - CHARLIKE_HDR(207)
|
|
| 1259 | - CHARLIKE_HDR(208)
|
|
| 1260 | - CHARLIKE_HDR(209)
|
|
| 1261 | - CHARLIKE_HDR(210)
|
|
| 1262 | - CHARLIKE_HDR(211)
|
|
| 1263 | - CHARLIKE_HDR(212)
|
|
| 1264 | - CHARLIKE_HDR(213)
|
|
| 1265 | - CHARLIKE_HDR(214)
|
|
| 1266 | - CHARLIKE_HDR(215)
|
|
| 1267 | - CHARLIKE_HDR(216)
|
|
| 1268 | - CHARLIKE_HDR(217)
|
|
| 1269 | - CHARLIKE_HDR(218)
|
|
| 1270 | - CHARLIKE_HDR(219)
|
|
| 1271 | - CHARLIKE_HDR(220)
|
|
| 1272 | - CHARLIKE_HDR(221)
|
|
| 1273 | - CHARLIKE_HDR(222)
|
|
| 1274 | - CHARLIKE_HDR(223)
|
|
| 1275 | - CHARLIKE_HDR(224)
|
|
| 1276 | - CHARLIKE_HDR(225)
|
|
| 1277 | - CHARLIKE_HDR(226)
|
|
| 1278 | - CHARLIKE_HDR(227)
|
|
| 1279 | - CHARLIKE_HDR(228)
|
|
| 1280 | - CHARLIKE_HDR(229)
|
|
| 1281 | - CHARLIKE_HDR(230)
|
|
| 1282 | - CHARLIKE_HDR(231)
|
|
| 1283 | - CHARLIKE_HDR(232)
|
|
| 1284 | - CHARLIKE_HDR(233)
|
|
| 1285 | - CHARLIKE_HDR(234)
|
|
| 1286 | - CHARLIKE_HDR(235)
|
|
| 1287 | - CHARLIKE_HDR(236)
|
|
| 1288 | - CHARLIKE_HDR(237)
|
|
| 1289 | - CHARLIKE_HDR(238)
|
|
| 1290 | - CHARLIKE_HDR(239)
|
|
| 1291 | - CHARLIKE_HDR(240)
|
|
| 1292 | - CHARLIKE_HDR(241)
|
|
| 1293 | - CHARLIKE_HDR(242)
|
|
| 1294 | - CHARLIKE_HDR(243)
|
|
| 1295 | - CHARLIKE_HDR(244)
|
|
| 1296 | - CHARLIKE_HDR(245)
|
|
| 1297 | - CHARLIKE_HDR(246)
|
|
| 1298 | - CHARLIKE_HDR(247)
|
|
| 1299 | - CHARLIKE_HDR(248)
|
|
| 1300 | - CHARLIKE_HDR(249)
|
|
| 1301 | - CHARLIKE_HDR(250)
|
|
| 1302 | - CHARLIKE_HDR(251)
|
|
| 1303 | - CHARLIKE_HDR(252)
|
|
| 1304 | - CHARLIKE_HDR(253)
|
|
| 1305 | - CHARLIKE_HDR(254)
|
|
| 1306 | - CHARLIKE_HDR(255)
|
|
| 1307 | -}
|
|
| 1308 | - |
|
| 1309 | -section "data" {
|
|
| 1310 | - stg_INTLIKE_closure:
|
|
| 1311 | - INTLIKE_HDR(-16) /* MIN_INTLIKE == -16 */
|
|
| 1312 | - INTLIKE_HDR(-15)
|
|
| 1313 | - INTLIKE_HDR(-14)
|
|
| 1314 | - INTLIKE_HDR(-13)
|
|
| 1315 | - INTLIKE_HDR(-12)
|
|
| 1316 | - INTLIKE_HDR(-11)
|
|
| 1317 | - INTLIKE_HDR(-10)
|
|
| 1318 | - INTLIKE_HDR(-9)
|
|
| 1319 | - INTLIKE_HDR(-8)
|
|
| 1320 | - INTLIKE_HDR(-7)
|
|
| 1321 | - INTLIKE_HDR(-6)
|
|
| 1322 | - INTLIKE_HDR(-5)
|
|
| 1323 | - INTLIKE_HDR(-4)
|
|
| 1324 | - INTLIKE_HDR(-3)
|
|
| 1325 | - INTLIKE_HDR(-2)
|
|
| 1326 | - INTLIKE_HDR(-1)
|
|
| 1327 | - INTLIKE_HDR(0)
|
|
| 1328 | - INTLIKE_HDR(1)
|
|
| 1329 | - INTLIKE_HDR(2)
|
|
| 1330 | - INTLIKE_HDR(3)
|
|
| 1331 | - INTLIKE_HDR(4)
|
|
| 1332 | - INTLIKE_HDR(5)
|
|
| 1333 | - INTLIKE_HDR(6)
|
|
| 1334 | - INTLIKE_HDR(7)
|
|
| 1335 | - INTLIKE_HDR(8)
|
|
| 1336 | - INTLIKE_HDR(9)
|
|
| 1337 | - INTLIKE_HDR(10)
|
|
| 1338 | - INTLIKE_HDR(11)
|
|
| 1339 | - INTLIKE_HDR(12)
|
|
| 1340 | - INTLIKE_HDR(13)
|
|
| 1341 | - INTLIKE_HDR(14)
|
|
| 1342 | - INTLIKE_HDR(15)
|
|
| 1343 | - INTLIKE_HDR(16)
|
|
| 1344 | - INTLIKE_HDR(17)
|
|
| 1345 | - INTLIKE_HDR(18)
|
|
| 1346 | - INTLIKE_HDR(19)
|
|
| 1347 | - INTLIKE_HDR(20)
|
|
| 1348 | - INTLIKE_HDR(21)
|
|
| 1349 | - INTLIKE_HDR(22)
|
|
| 1350 | - INTLIKE_HDR(23)
|
|
| 1351 | - INTLIKE_HDR(24)
|
|
| 1352 | - INTLIKE_HDR(25)
|
|
| 1353 | - INTLIKE_HDR(26)
|
|
| 1354 | - INTLIKE_HDR(27)
|
|
| 1355 | - INTLIKE_HDR(28)
|
|
| 1356 | - INTLIKE_HDR(29)
|
|
| 1357 | - INTLIKE_HDR(30)
|
|
| 1358 | - INTLIKE_HDR(31)
|
|
| 1359 | - INTLIKE_HDR(32)
|
|
| 1360 | - INTLIKE_HDR(33)
|
|
| 1361 | - INTLIKE_HDR(34)
|
|
| 1362 | - INTLIKE_HDR(35)
|
|
| 1363 | - INTLIKE_HDR(36)
|
|
| 1364 | - INTLIKE_HDR(37)
|
|
| 1365 | - INTLIKE_HDR(38)
|
|
| 1366 | - INTLIKE_HDR(39)
|
|
| 1367 | - INTLIKE_HDR(40)
|
|
| 1368 | - INTLIKE_HDR(41)
|
|
| 1369 | - INTLIKE_HDR(42)
|
|
| 1370 | - INTLIKE_HDR(43)
|
|
| 1371 | - INTLIKE_HDR(44)
|
|
| 1372 | - INTLIKE_HDR(45)
|
|
| 1373 | - INTLIKE_HDR(46)
|
|
| 1374 | - INTLIKE_HDR(47)
|
|
| 1375 | - INTLIKE_HDR(48)
|
|
| 1376 | - INTLIKE_HDR(49)
|
|
| 1377 | - INTLIKE_HDR(50)
|
|
| 1378 | - INTLIKE_HDR(51)
|
|
| 1379 | - INTLIKE_HDR(52)
|
|
| 1380 | - INTLIKE_HDR(53)
|
|
| 1381 | - INTLIKE_HDR(54)
|
|
| 1382 | - INTLIKE_HDR(55)
|
|
| 1383 | - INTLIKE_HDR(56)
|
|
| 1384 | - INTLIKE_HDR(57)
|
|
| 1385 | - INTLIKE_HDR(58)
|
|
| 1386 | - INTLIKE_HDR(59)
|
|
| 1387 | - INTLIKE_HDR(60)
|
|
| 1388 | - INTLIKE_HDR(61)
|
|
| 1389 | - INTLIKE_HDR(62)
|
|
| 1390 | - INTLIKE_HDR(63)
|
|
| 1391 | - INTLIKE_HDR(64)
|
|
| 1392 | - INTLIKE_HDR(65)
|
|
| 1393 | - INTLIKE_HDR(66)
|
|
| 1394 | - INTLIKE_HDR(67)
|
|
| 1395 | - INTLIKE_HDR(68)
|
|
| 1396 | - INTLIKE_HDR(69)
|
|
| 1397 | - INTLIKE_HDR(70)
|
|
| 1398 | - INTLIKE_HDR(71)
|
|
| 1399 | - INTLIKE_HDR(72)
|
|
| 1400 | - INTLIKE_HDR(73)
|
|
| 1401 | - INTLIKE_HDR(74)
|
|
| 1402 | - INTLIKE_HDR(75)
|
|
| 1403 | - INTLIKE_HDR(76)
|
|
| 1404 | - INTLIKE_HDR(77)
|
|
| 1405 | - INTLIKE_HDR(78)
|
|
| 1406 | - INTLIKE_HDR(79)
|
|
| 1407 | - INTLIKE_HDR(80)
|
|
| 1408 | - INTLIKE_HDR(81)
|
|
| 1409 | - INTLIKE_HDR(82)
|
|
| 1410 | - INTLIKE_HDR(83)
|
|
| 1411 | - INTLIKE_HDR(84)
|
|
| 1412 | - INTLIKE_HDR(85)
|
|
| 1413 | - INTLIKE_HDR(86)
|
|
| 1414 | - INTLIKE_HDR(87)
|
|
| 1415 | - INTLIKE_HDR(88)
|
|
| 1416 | - INTLIKE_HDR(89)
|
|
| 1417 | - INTLIKE_HDR(90)
|
|
| 1418 | - INTLIKE_HDR(91)
|
|
| 1419 | - INTLIKE_HDR(92)
|
|
| 1420 | - INTLIKE_HDR(93)
|
|
| 1421 | - INTLIKE_HDR(94)
|
|
| 1422 | - INTLIKE_HDR(95)
|
|
| 1423 | - INTLIKE_HDR(96)
|
|
| 1424 | - INTLIKE_HDR(97)
|
|
| 1425 | - INTLIKE_HDR(98)
|
|
| 1426 | - INTLIKE_HDR(99)
|
|
| 1427 | - INTLIKE_HDR(100)
|
|
| 1428 | - INTLIKE_HDR(101)
|
|
| 1429 | - INTLIKE_HDR(102)
|
|
| 1430 | - INTLIKE_HDR(103)
|
|
| 1431 | - INTLIKE_HDR(104)
|
|
| 1432 | - INTLIKE_HDR(105)
|
|
| 1433 | - INTLIKE_HDR(106)
|
|
| 1434 | - INTLIKE_HDR(107)
|
|
| 1435 | - INTLIKE_HDR(108)
|
|
| 1436 | - INTLIKE_HDR(109)
|
|
| 1437 | - INTLIKE_HDR(110)
|
|
| 1438 | - INTLIKE_HDR(111)
|
|
| 1439 | - INTLIKE_HDR(112)
|
|
| 1440 | - INTLIKE_HDR(113)
|
|
| 1441 | - INTLIKE_HDR(114)
|
|
| 1442 | - INTLIKE_HDR(115)
|
|
| 1443 | - INTLIKE_HDR(116)
|
|
| 1444 | - INTLIKE_HDR(117)
|
|
| 1445 | - INTLIKE_HDR(118)
|
|
| 1446 | - INTLIKE_HDR(119)
|
|
| 1447 | - INTLIKE_HDR(120)
|
|
| 1448 | - INTLIKE_HDR(121)
|
|
| 1449 | - INTLIKE_HDR(122)
|
|
| 1450 | - INTLIKE_HDR(123)
|
|
| 1451 | - INTLIKE_HDR(124)
|
|
| 1452 | - INTLIKE_HDR(125)
|
|
| 1453 | - INTLIKE_HDR(126)
|
|
| 1454 | - INTLIKE_HDR(127)
|
|
| 1455 | - INTLIKE_HDR(128)
|
|
| 1456 | - INTLIKE_HDR(129)
|
|
| 1457 | - INTLIKE_HDR(130)
|
|
| 1458 | - INTLIKE_HDR(131)
|
|
| 1459 | - INTLIKE_HDR(132)
|
|
| 1460 | - INTLIKE_HDR(133)
|
|
| 1461 | - INTLIKE_HDR(134)
|
|
| 1462 | - INTLIKE_HDR(135)
|
|
| 1463 | - INTLIKE_HDR(136)
|
|
| 1464 | - INTLIKE_HDR(137)
|
|
| 1465 | - INTLIKE_HDR(138)
|
|
| 1466 | - INTLIKE_HDR(139)
|
|
| 1467 | - INTLIKE_HDR(140)
|
|
| 1468 | - INTLIKE_HDR(141)
|
|
| 1469 | - INTLIKE_HDR(142)
|
|
| 1470 | - INTLIKE_HDR(143)
|
|
| 1471 | - INTLIKE_HDR(144)
|
|
| 1472 | - INTLIKE_HDR(145)
|
|
| 1473 | - INTLIKE_HDR(146)
|
|
| 1474 | - INTLIKE_HDR(147)
|
|
| 1475 | - INTLIKE_HDR(148)
|
|
| 1476 | - INTLIKE_HDR(149)
|
|
| 1477 | - INTLIKE_HDR(150)
|
|
| 1478 | - INTLIKE_HDR(151)
|
|
| 1479 | - INTLIKE_HDR(152)
|
|
| 1480 | - INTLIKE_HDR(153)
|
|
| 1481 | - INTLIKE_HDR(154)
|
|
| 1482 | - INTLIKE_HDR(155)
|
|
| 1483 | - INTLIKE_HDR(156)
|
|
| 1484 | - INTLIKE_HDR(157)
|
|
| 1485 | - INTLIKE_HDR(158)
|
|
| 1486 | - INTLIKE_HDR(159)
|
|
| 1487 | - INTLIKE_HDR(160)
|
|
| 1488 | - INTLIKE_HDR(161)
|
|
| 1489 | - INTLIKE_HDR(162)
|
|
| 1490 | - INTLIKE_HDR(163)
|
|
| 1491 | - INTLIKE_HDR(164)
|
|
| 1492 | - INTLIKE_HDR(165)
|
|
| 1493 | - INTLIKE_HDR(166)
|
|
| 1494 | - INTLIKE_HDR(167)
|
|
| 1495 | - INTLIKE_HDR(168)
|
|
| 1496 | - INTLIKE_HDR(169)
|
|
| 1497 | - INTLIKE_HDR(170)
|
|
| 1498 | - INTLIKE_HDR(171)
|
|
| 1499 | - INTLIKE_HDR(172)
|
|
| 1500 | - INTLIKE_HDR(173)
|
|
| 1501 | - INTLIKE_HDR(174)
|
|
| 1502 | - INTLIKE_HDR(175)
|
|
| 1503 | - INTLIKE_HDR(176)
|
|
| 1504 | - INTLIKE_HDR(177)
|
|
| 1505 | - INTLIKE_HDR(178)
|
|
| 1506 | - INTLIKE_HDR(179)
|
|
| 1507 | - INTLIKE_HDR(180)
|
|
| 1508 | - INTLIKE_HDR(181)
|
|
| 1509 | - INTLIKE_HDR(182)
|
|
| 1510 | - INTLIKE_HDR(183)
|
|
| 1511 | - INTLIKE_HDR(184)
|
|
| 1512 | - INTLIKE_HDR(185)
|
|
| 1513 | - INTLIKE_HDR(186)
|
|
| 1514 | - INTLIKE_HDR(187)
|
|
| 1515 | - INTLIKE_HDR(188)
|
|
| 1516 | - INTLIKE_HDR(189)
|
|
| 1517 | - INTLIKE_HDR(190)
|
|
| 1518 | - INTLIKE_HDR(191)
|
|
| 1519 | - INTLIKE_HDR(192)
|
|
| 1520 | - INTLIKE_HDR(193)
|
|
| 1521 | - INTLIKE_HDR(194)
|
|
| 1522 | - INTLIKE_HDR(195)
|
|
| 1523 | - INTLIKE_HDR(196)
|
|
| 1524 | - INTLIKE_HDR(197)
|
|
| 1525 | - INTLIKE_HDR(198)
|
|
| 1526 | - INTLIKE_HDR(199)
|
|
| 1527 | - INTLIKE_HDR(200)
|
|
| 1528 | - INTLIKE_HDR(201)
|
|
| 1529 | - INTLIKE_HDR(202)
|
|
| 1530 | - INTLIKE_HDR(203)
|
|
| 1531 | - INTLIKE_HDR(204)
|
|
| 1532 | - INTLIKE_HDR(205)
|
|
| 1533 | - INTLIKE_HDR(206)
|
|
| 1534 | - INTLIKE_HDR(207)
|
|
| 1535 | - INTLIKE_HDR(208)
|
|
| 1536 | - INTLIKE_HDR(209)
|
|
| 1537 | - INTLIKE_HDR(210)
|
|
| 1538 | - INTLIKE_HDR(211)
|
|
| 1539 | - INTLIKE_HDR(212)
|
|
| 1540 | - INTLIKE_HDR(213)
|
|
| 1541 | - INTLIKE_HDR(214)
|
|
| 1542 | - INTLIKE_HDR(215)
|
|
| 1543 | - INTLIKE_HDR(216)
|
|
| 1544 | - INTLIKE_HDR(217)
|
|
| 1545 | - INTLIKE_HDR(218)
|
|
| 1546 | - INTLIKE_HDR(219)
|
|
| 1547 | - INTLIKE_HDR(220)
|
|
| 1548 | - INTLIKE_HDR(221)
|
|
| 1549 | - INTLIKE_HDR(222)
|
|
| 1550 | - INTLIKE_HDR(223)
|
|
| 1551 | - INTLIKE_HDR(224)
|
|
| 1552 | - INTLIKE_HDR(225)
|
|
| 1553 | - INTLIKE_HDR(226)
|
|
| 1554 | - INTLIKE_HDR(227)
|
|
| 1555 | - INTLIKE_HDR(228)
|
|
| 1556 | - INTLIKE_HDR(229)
|
|
| 1557 | - INTLIKE_HDR(230)
|
|
| 1558 | - INTLIKE_HDR(231)
|
|
| 1559 | - INTLIKE_HDR(232)
|
|
| 1560 | - INTLIKE_HDR(233)
|
|
| 1561 | - INTLIKE_HDR(234)
|
|
| 1562 | - INTLIKE_HDR(235)
|
|
| 1563 | - INTLIKE_HDR(236)
|
|
| 1564 | - INTLIKE_HDR(237)
|
|
| 1565 | - INTLIKE_HDR(238)
|
|
| 1566 | - INTLIKE_HDR(239)
|
|
| 1567 | - INTLIKE_HDR(240)
|
|
| 1568 | - INTLIKE_HDR(241)
|
|
| 1569 | - INTLIKE_HDR(242)
|
|
| 1570 | - INTLIKE_HDR(243)
|
|
| 1571 | - INTLIKE_HDR(244)
|
|
| 1572 | - INTLIKE_HDR(245)
|
|
| 1573 | - INTLIKE_HDR(246)
|
|
| 1574 | - INTLIKE_HDR(247)
|
|
| 1575 | - INTLIKE_HDR(248)
|
|
| 1576 | - INTLIKE_HDR(249)
|
|
| 1577 | - INTLIKE_HDR(250)
|
|
| 1578 | - INTLIKE_HDR(251)
|
|
| 1579 | - INTLIKE_HDR(252)
|
|
| 1580 | - INTLIKE_HDR(253)
|
|
| 1581 | - INTLIKE_HDR(254)
|
|
| 1582 | - INTLIKE_HDR(255) /* MAX_INTLIKE == 255
|
|
| 1583 | - See #16961 for why 255 */
|
|
| 1584 | -} |
| ... | ... | @@ -13,8 +13,6 @@ |
| 13 | 13 | #include "Cmm.h"
|
| 14 | 14 | #include "Updates.h"
|
| 15 | 15 | |
| 16 | -import CLOSURE ghczminternal_GHCziInternalziCString_unpackCStringzh_info;
|
|
| 17 | -import CLOSURE ghczminternal_GHCziInternalziCString_unpackCStringUtf8zh_info;
|
|
| 18 | 16 | #if !defined(UnregisterisedCompiler)
|
| 19 | 17 | import CLOSURE STK_CHK_ctr;
|
| 20 | 18 | import CLOSURE stg_bh_upd_frame_info;
|
| ... | ... | @@ -348,7 +346,7 @@ stg_do_unpack_cstring(P_ node, P_ newCAF_ret) { |
| 348 | 346 | W_ str;
|
| 349 | 347 | str = StgThunk_payload(node, 2);
|
| 350 | 348 | push (UPDATE_FRAME_FIELDS(,,stg_bh_upd_frame_info, CCCS, 0, newCAF_ret)) {
|
| 351 | - jump %ENTRY_CODE(ghczminternal_GHCziInternalziCString_unpackCStringzh_info)(node, str);
|
|
| 349 | + jump %ENTRY_CODE(HsIface_unpackCStringzh_info(W_[ghc_hs_iface]))(node, str);
|
|
| 352 | 350 | }
|
| 353 | 351 | }
|
| 354 | 352 | |
| ... | ... | @@ -372,7 +370,7 @@ stg_do_unpack_cstring_utf8(P_ node, P_ newCAF_ret) { |
| 372 | 370 | W_ str;
|
| 373 | 371 | str = StgThunk_payload(node, 2);
|
| 374 | 372 | push (UPDATE_FRAME_FIELDS(,,stg_bh_upd_frame_info, CCCS, 0, newCAF_ret)) {
|
| 375 | - jump %ENTRY_CODE(ghczminternal_GHCziInternalziCString_unpackCStringUtf8zh_info)(node, str);
|
|
| 373 | + jump %ENTRY_CODE(HsIface_unpackCStringUtf8zh_info(W_[ghc_hs_iface]))(node, str);
|
|
| 376 | 374 | }
|
| 377 | 375 | }
|
| 378 | 376 |
| ... | ... | @@ -229,6 +229,7 @@ void _warnFail(const char *filename, unsigned int linenum); |
| 229 | 229 | #include "rts/storage/ClosureTypes.h"
|
| 230 | 230 | #include "rts/storage/TSO.h"
|
| 231 | 231 | #include "stg/MiscClosures.h" /* InfoTables, closures etc. defined in the RTS */
|
| 232 | + |
|
| 232 | 233 | #include "rts/storage/Block.h"
|
| 233 | 234 | #include "rts/storage/ClosureMacros.h"
|
| 234 | 235 | #include "rts/storage/MBlock.h"
|
| ... | ... | @@ -18,6 +18,7 @@ extern "C" { |
| 18 | 18 | #include "HsFFI.h"
|
| 19 | 19 | #include "rts/Time.h"
|
| 20 | 20 | #include "rts/Types.h"
|
| 21 | +#include "rts/RtsToHsIface.h"
|
|
| 21 | 22 | |
| 22 | 23 | /*
|
| 23 | 24 | * Running the scheduler
|
| ... | ... | @@ -584,11 +585,6 @@ void rts_done (void); |
| 584 | 585 | // Note that RtsAPI.h is also included by foreign export stubs in
|
| 585 | 586 | // the base package itself.
|
| 586 | 587 | //
|
| 587 | -extern StgClosure ghczminternal_GHCziInternalziTopHandler_runIO_closure;
|
|
| 588 | -extern StgClosure ghczminternal_GHCziInternalziTopHandler_runNonIO_closure;
|
|
| 589 | - |
|
| 590 | -#define runIO_closure (&(ghczminternal_GHCziInternalziTopHandler_runIO_closure))
|
|
| 591 | -#define runNonIO_closure (&(ghczminternal_GHCziInternalziTopHandler_runNonIO_closure))
|
|
| 592 | 588 | |
| 593 | 589 | /* ------------------------------------------------------------------------ */
|
| 594 | 590 |
| ... | ... | @@ -57,11 +57,12 @@ |
| 57 | 57 | #define MAX_SPEC_CONSTR_SIZE 2
|
| 58 | 58 | |
| 59 | 59 | /* Range of built-in table of static small int-like and char-like closures.
|
| 60 | + * Range is inclusive of both minimum and maximum.
|
|
| 60 | 61 | *
|
| 61 | 62 | * NB. This corresponds with the number of actual INTLIKE/CHARLIKE
|
| 62 | 63 | * closures defined in rts/StgMiscClosures.cmm.
|
| 63 | 64 | */
|
| 64 | -#define MAX_INTLIKE 255
|
|
| 65 | +#define MAX_INTLIKE 255 /* See #16961 for why 255 */
|
|
| 65 | 66 | #define MIN_INTLIKE (-16)
|
| 66 | 67 | |
| 67 | 68 | #define MAX_CHARLIKE 255
|
| 1 | +/*
|
|
| 2 | + * (c) The GHC Team, 2025-2026
|
|
| 3 | + *
|
|
| 4 | + * RTS/ghc-internal interface
|
|
| 5 | + *
|
|
| 6 | + * See Note [RTS/ghc-internal interface].
|
|
| 7 | + */
|
|
| 8 | + |
|
| 9 | +typedef struct {
|
|
| 10 | + StgClosure *processRemoteCompletion_closure; // GHC.Internal.Event.Windows.processRemoteCompletion_closure
|
|
| 11 | + StgClosure *runIO_closure; // GHC.Internal.TopHandler.runIO_closure
|
|
| 12 | + StgClosure *runNonIO_closure; // GHC.Internal.TopHandler.runNonIO_closure
|
|
| 13 | + StgClosure *Z0T_closure; // GHC.Internal.Tuple.Z0T_closure
|
|
| 14 | + StgClosure *True_closure; // GHC.Internal.Types.True_closure
|
|
| 15 | + StgClosure *False_closure; // GHC.Internal.Types.False_closure
|
|
| 16 | + StgClosure *unpackCString_closure; // GHC.Internal.Pack.unpackCString_closure
|
|
| 17 | + StgClosure *runFinalizzerBatch_closure; // GHC.Internal.Weak.Finalizze.runFinalizzerBatch_closure
|
|
| 18 | + StgClosure *stackOverflow_closure; // GHC.Internal.IO.Exception.stackOverflow_closure
|
|
| 19 | + StgClosure *heapOverflow_closure; // GHC.Internal.IO.Exception.heapOverflow_closure
|
|
| 20 | + StgClosure *allocationLimitExceeded_closure; // GHC.Internal.IO.Exception.allocationLimitExceeded_closure
|
|
| 21 | + StgClosure *blockedIndefinitelyOnMVar_closure; // GHC.Internal.IO.Exception.blockedIndefinitelyOnMVar_closure
|
|
| 22 | + StgClosure *blockedIndefinitelyOnSTM_closure; // GHC.Internal.IO.Exception.blockedIndefinitelyOnSTM_closure
|
|
| 23 | + StgClosure *cannotCompactFunction_closure; // GHC.Internal.IO.Exception.cannotCompactFunction_closure
|
|
| 24 | + StgClosure *cannotCompactPinned_closure; // GHC.Internal.IO.Exception.cannotCompactPinned_closure
|
|
| 25 | + StgClosure *cannotCompactMutable_closure; // GHC.Internal.IO.Exception.cannotCompactMutable_closure
|
|
| 26 | + StgClosure *nonTermination_closure; // GHC.Internal.Control.Exception.Base.nonTermination_closure
|
|
| 27 | + StgClosure *nestedAtomically_closure; // GHC.Internal.Control.Exception.Base.nestedAtomically_closure
|
|
| 28 | + StgClosure *noMatchingContinuationPrompt_closure; // GHC.Internal.Control.Exception.Base.noMatchingContinuationPrompt_closure
|
|
| 29 | + StgClosure *blockedOnBadFD_closure; // GHC.Internal.Event.Thread.blockedOnBadFD_closure
|
|
| 30 | + StgClosure *runSparks_closure; // GHC.Internal.Conc.Sync.runSparks_closure
|
|
| 31 | + StgClosure *ensureIOManagerIsRunning_closure; // GHC.Internal.Conc.IO.ensureIOManagerIsRunning_closure
|
|
| 32 | + StgClosure *interruptIOManager_closure; // GHC.Internal.Conc.IO.interruptIOManager_closure
|
|
| 33 | + StgClosure *ioManagerCapabilitiesChanged_closure; // GHC.Internal.Conc.IO.ioManagerCapabilitiesChanged_closure
|
|
| 34 | + StgClosure *runHandlersPtr_closure; // GHC.Internal.Conc.Signal.runHandlersPtr_closure
|
|
| 35 | + StgClosure *flushStdHandles_closure; // GHC.Internal.TopHandler.flushStdHandles_closure
|
|
| 36 | + StgClosure *runMainIO_closure; // GHC.Internal.TopHandler.runMainIO_closure
|
|
| 37 | + StgInfoTable *Czh_con_info; // GHC.Internal.Types.Czh_con_info
|
|
| 38 | + StgInfoTable *Izh_con_info; // GHC.Internal.Types.Izh_con_info
|
|
| 39 | + StgInfoTable *Fzh_con_info; // GHC.Internal.Types.Fzh_con_info
|
|
| 40 | + StgInfoTable *Dzh_con_info; // GHC.Internal.Types.Dzh_con_info
|
|
| 41 | + StgInfoTable *Wzh_con_info; // GHC.Internal.Types.Wzh_con_info
|
|
| 42 | + StgClosure *absentSumFieldError_closure; // GHC.Internal.Prim.Panic.absentSumFieldError_closure
|
|
| 43 | + StgClosure *runAllocationLimitHandler_closure; // GHC.Internal.AllocationLimitHandler.runAllocationLimitHandler_closure
|
|
| 44 | + StgInfoTable *Ptr_con_info; // GHC.Internal.Ptr.Ptr_con_info
|
|
| 45 | + StgInfoTable *FunPtr_con_info; // GHC.Internal.Ptr.FunPtr_con_info
|
|
| 46 | + StgInfoTable *I8zh_con_info; // GHC.Internal.Int.I8zh_con_info
|
|
| 47 | + StgInfoTable *I16zh_con_info; // GHC.Internal.Int.I16zh_con_info
|
|
| 48 | + StgInfoTable *I32zh_con_info; // GHC.Internal.Int.I32zh_con_info
|
|
| 49 | + StgInfoTable *I64zh_con_info; // GHC.Internal.Int.I64zh_con_info
|
|
| 50 | + StgInfoTable *W8zh_con_info; // GHC.Internal.Word.W8zh_con_info
|
|
| 51 | + StgInfoTable *W16zh_con_info; // GHC.Internal.Word.W16zh_con_info
|
|
| 52 | + StgInfoTable *W32zh_con_info; // GHC.Internal.Word.W32zh_con_info
|
|
| 53 | + StgInfoTable *W64zh_con_info; // GHC.Internal.Word.W64zh_con_info
|
|
| 54 | + StgInfoTable *StablePtr_con_info; // GHC.Internal.Stable.StablePtr_con_info
|
|
| 55 | + StgClosure *StackSnapshot_closure; // GHC.Internal.Stack.CloneStack.StackSnapshot_closure
|
|
| 56 | + StgClosure *divZZeroException_closure; // GHC.Internal.Exception.Type.divZeroException_closure
|
|
| 57 | + StgClosure *underflowException_closure; // GHC.Internal.Exception.Type.underflowException_closure
|
|
| 58 | + StgClosure *overflowException_closure; // GHC.Internal.Exception.Type.overflowException_closure
|
|
| 59 | + StgClosure *unpackCStringzh_closure; // GHC.Internal.CString.unpackCStringzh_closure
|
|
| 60 | + StgInfoTable *unpackCStringzh_info; // GHC.Internal.CString.unpackCStringzh_info
|
|
| 61 | + StgInfoTable *unpackCStringUtf8zh_info; // GHC.Internal.CString.unpackCStringUtf8zh_info
|
|
| 62 | +} HsIface;
|
|
| 63 | + |
|
| 64 | +extern const HsIface *ghc_hs_iface; |
| ... | ... | @@ -277,8 +277,8 @@ RTS_ENTRY(stg_NO_FINALIZER); |
| 277 | 277 | extern StgWordArray stg_CHARLIKE_closure;
|
| 278 | 278 | extern StgWordArray stg_INTLIKE_closure;
|
| 279 | 279 | #else
|
| 280 | -extern StgIntCharlikeClosure stg_CHARLIKE_closure[];
|
|
| 281 | -extern StgIntCharlikeClosure stg_INTLIKE_closure[];
|
|
| 280 | +extern StgIntCharlikeClosure stg_CHARLIKE_closure[MAX_CHARLIKE - MIN_CHARLIKE + 1];
|
|
| 281 | +extern StgIntCharlikeClosure stg_INTLIKE_closure[MAX_INTLIKE - MIN_INTLIKE + 1];
|
|
| 282 | 282 | #endif
|
| 283 | 283 | |
| 284 | 284 | /* StgStartup */
|
| ... | ... | @@ -222,7 +222,7 @@ ioManagerDie (void) |
| 222 | 222 | void
|
| 223 | 223 | ioManagerStartCap (Capability **cap)
|
| 224 | 224 | {
|
| 225 | - rts_evalIO(cap,&ghczminternal_GHCziInternalziConcziIO_ensureIOManagerIsRunning_closure,NULL);
|
|
| 225 | + rts_evalIO(cap,ensureIOManagerIsRunning_closure,NULL);
|
|
| 226 | 226 | }
|
| 227 | 227 | |
| 228 | 228 | void
|
| ... | ... | @@ -493,7 +493,7 @@ startSignalHandlers(Capability *cap) |
| 493 | 493 | RtsFlags.GcFlags.initialStkSize,
|
| 494 | 494 | rts_apply(cap,
|
| 495 | 495 | rts_apply(cap,
|
| 496 | - &ghczminternal_GHCziInternalziConcziSignal_runHandlersPtr_closure,
|
|
| 496 | + runHandlersPtr_closure,
|
|
| 497 | 497 | rts_mkPtr(cap, info)),
|
| 498 | 498 | rts_mkInt(cap, info->si_signo)));
|
| 499 | 499 | scheduleThread(cap, t);
|
| ... | ... | @@ -334,6 +334,7 @@ library |
| 334 | 334 | rts/storage/InfoTables.h
|
| 335 | 335 | rts/storage/MBlock.h
|
| 336 | 336 | rts/storage/TSO.h
|
| 337 | + rts/RtsToHsIface.h
|
|
| 337 | 338 | stg/MachRegs.h
|
| 338 | 339 | stg/MachRegs/arm32.h
|
| 339 | 340 | stg/MachRegs/arm64.h
|
| ... | ... | @@ -403,6 +404,7 @@ library |
| 403 | 404 | adjustor/AdjustorPool.c
|
| 404 | 405 | ExecPage.c
|
| 405 | 406 | Arena.c
|
| 407 | + BuiltinClosures.c
|
|
| 406 | 408 | Capability.c
|
| 407 | 409 | CheckUnload.c
|
| 408 | 410 | CheckVectorSupport.c
|
| ... | ... | @@ -448,6 +450,7 @@ library |
| 448 | 450 | RtsStartup.c
|
| 449 | 451 | RtsSymbolInfo.c
|
| 450 | 452 | RtsSymbols.c
|
| 453 | + RtsToHsIface.c
|
|
| 451 | 454 | RtsUtils.c
|
| 452 | 455 | STM.c
|
| 453 | 456 | Schedule.c
|
| ... | ... | @@ -23,8 +23,8 @@ int __main_argc_argv(int argc, char *argv[]) { |
| 23 | 23 | hs_init_ghc(&argc, &argv, __conf);
|
| 24 | 24 | // See Note [threadDelay on wasm] for details.
|
| 25 | 25 | rts_JSFFI_flag = HS_BOOL_TRUE;
|
| 26 | - getStablePtr((StgPtr)&ghczminternal_GHCziInternalziWasmziPrimziImports_raiseJSException_closure);
|
|
| 27 | - rts_threadDelay_impl = getStablePtr((StgPtr)&ghczminternal_GHCziInternalziWasmziPrimziConcziInternal_threadDelay_closure);
|
|
| 26 | + getStablePtr((StgPtr)ghc_hs_iface->raiseJSException_closure);
|
|
| 27 | + rts_threadDelay_impl = getStablePtr((StgPtr)ghc_hs_iface->threadDelay_closure);
|
|
| 28 | 28 | return 0;
|
| 29 | 29 | }
|
| 30 | 30 | |
| ... | ... | @@ -112,7 +112,7 @@ HaskellObj rts_mkJSVal(Capability *cap, HsJSVal v) { |
| 112 | 112 | SET_HDR(w, &stg_WEAK_info, CCS_SYSTEM);
|
| 113 | 113 | w->cfinalizers = (StgClosure *)cfin;
|
| 114 | 114 | w->key = p;
|
| 115 | - w->value = Unit_closure;
|
|
| 115 | + w->value = ghc_hs_iface->Z0T_closure;
|
|
| 116 | 116 | w->finalizer = &stg_NO_FINALIZER_closure;
|
| 117 | 117 | w->link = cap->weak_ptr_list_hd;
|
| 118 | 118 | cap->weak_ptr_list_hd = w;
|
| ... | ... | @@ -123,7 +123,7 @@ HaskellObj rts_mkJSVal(Capability *cap, HsJSVal v) { |
| 123 | 123 | p->payload[0] = (HaskellObj)w;
|
| 124 | 124 | |
| 125 | 125 | HaskellObj box = (HaskellObj)allocate(cap, CONSTR_sizeW(1, 0));
|
| 126 | - SET_HDR(box, &ghczminternal_GHCziInternalziWasmziPrimziTypes_JSVal_con_info, CCS_SYSTEM);
|
|
| 126 | + SET_HDR(box, ghc_hs_iface->JSVal_con_info, CCS_SYSTEM);
|
|
| 127 | 127 | box->payload[0] = p;
|
| 128 | 128 | |
| 129 | 129 | return TAG_CLOSURE(1, box);
|
| ... | ... | @@ -139,7 +139,7 @@ STATIC_INLINE HsJSVal rts_getJSValzh(HaskellObj p) { |
| 139 | 139 | |
| 140 | 140 | HsJSVal rts_getJSVal(HaskellObj);
|
| 141 | 141 | HsJSVal rts_getJSVal(HaskellObj box) {
|
| 142 | - ASSERT(UNTAG_CLOSURE(box)->header.info == &ghczminternal_GHCziInternalziWasmziPrimziTypes_JSVal_con_info);
|
|
| 142 | + ASSERT(UNTAG_CLOSURE(box)->header.info == ghc_hs_iface->JSVal_con_info);
|
|
| 143 | 143 | return rts_getJSValzh(UNTAG_CLOSURE(box)->payload[0]);
|
| 144 | 144 | }
|
| 145 | 145 | |
| ... | ... | @@ -188,7 +188,7 @@ void rts_schedulerLoop(void) { |
| 188 | 188 | __attribute__((export_name("rts_promiseResolveUnit")))
|
| 189 | 189 | void rts_promiseResolveUnit(HsStablePtr);
|
| 190 | 190 | void rts_promiseResolveUnit(HsStablePtr sp)
|
| 191 | - mk_rtsPromiseCallback(TAG_CLOSURE(1, Unit_closure))
|
|
| 191 | + mk_rtsPromiseCallback(TAG_CLOSURE(1, ghc_hs_iface->Z0T_closure))
|
|
| 192 | 192 | |
| 193 | 193 | mk_rtsPromiseResolve(JSVal)
|
| 194 | 194 | mk_rtsPromiseResolve(Char)
|
| ... | ... | @@ -212,7 +212,7 @@ mk_rtsPromiseResolve(Bool) |
| 212 | 212 | __attribute__((export_name("rts_promiseReject")))
|
| 213 | 213 | void rts_promiseReject(HsStablePtr, HsJSVal);
|
| 214 | 214 | void rts_promiseReject(HsStablePtr sp, HsJSVal js_err)
|
| 215 | - mk_rtsPromiseCallback(rts_apply(cap, &ghczminternal_GHCziInternalziWasmziPrimziImports_raiseJSException_closure, rts_mkJSVal(cap, js_err)))
|
|
| 215 | + mk_rtsPromiseCallback(rts_apply(cap, ghc_hs_iface->raiseJSException_closure, rts_mkJSVal(cap, js_err)))
|
|
| 216 | 216 | |
| 217 | 217 | __attribute__((export_name("rts_promiseThrowTo")))
|
| 218 | 218 | void rts_promiseThrowTo(HsStablePtr, HsJSVal);
|
| ... | ... | @@ -229,7 +229,7 @@ void rts_promiseThrowTo(HsStablePtr sp, HsJSVal js_err) { |
| 229 | 229 | cap, tso,
|
| 230 | 230 | rts_apply(
|
| 231 | 231 | cap,
|
| 232 | - &ghczminternal_GHCziInternalziWasmziPrimziImports_raiseJSException_closure,
|
|
| 232 | + ghc_hs_iface->raiseJSException_closure,
|
|
| 233 | 233 | rts_mkJSVal(cap, js_err)));
|
| 234 | 234 | tryWakeupThread(cap, tso);
|
| 235 | 235 | rts_schedulerLoop();
|
| ... | ... | @@ -667,6 +667,59 @@ wanteds os = concat |
| 667 | 667 | ,structField C "StgAsyncIOResult" "errCode"]
|
| 668 | 668 | else []
|
| 669 | 669 | |
| 670 | + -- struct HsIface
|
|
| 671 | + ,structField C "HsIface" "processRemoteCompletion_closure"
|
|
| 672 | + ,structField C "HsIface" "runIO_closure"
|
|
| 673 | + ,structField C "HsIface" "runNonIO_closure"
|
|
| 674 | + ,structField C "HsIface" "Z0T_closure"
|
|
| 675 | + ,structField C "HsIface" "True_closure"
|
|
| 676 | + ,structField C "HsIface" "False_closure"
|
|
| 677 | + ,structField C "HsIface" "unpackCString_closure"
|
|
| 678 | + ,structField C "HsIface" "runFinalizzerBatch_closure"
|
|
| 679 | + ,structField C "HsIface" "stackOverflow_closure"
|
|
| 680 | + ,structField C "HsIface" "heapOverflow_closure"
|
|
| 681 | + ,structField C "HsIface" "allocationLimitExceeded_closure"
|
|
| 682 | + ,structField C "HsIface" "blockedIndefinitelyOnMVar_closure"
|
|
| 683 | + ,structField C "HsIface" "blockedIndefinitelyOnSTM_closure"
|
|
| 684 | + ,structField C "HsIface" "cannotCompactFunction_closure"
|
|
| 685 | + ,structField C "HsIface" "cannotCompactPinned_closure"
|
|
| 686 | + ,structField C "HsIface" "cannotCompactMutable_closure"
|
|
| 687 | + ,structField C "HsIface" "nonTermination_closure"
|
|
| 688 | + ,structField C "HsIface" "nestedAtomically_closure"
|
|
| 689 | + ,structField C "HsIface" "noMatchingContinuationPrompt_closure"
|
|
| 690 | + ,structField C "HsIface" "blockedOnBadFD_closure"
|
|
| 691 | + ,structField C "HsIface" "runSparks_closure"
|
|
| 692 | + ,structField C "HsIface" "ensureIOManagerIsRunning_closure"
|
|
| 693 | + ,structField C "HsIface" "interruptIOManager_closure"
|
|
| 694 | + ,structField C "HsIface" "ioManagerCapabilitiesChanged_closure"
|
|
| 695 | + ,structField C "HsIface" "runHandlersPtr_closure"
|
|
| 696 | + ,structField C "HsIface" "flushStdHandles_closure"
|
|
| 697 | + ,structField C "HsIface" "runMainIO_closure"
|
|
| 698 | + ,structField C "HsIface" "Czh_con_info"
|
|
| 699 | + ,structField C "HsIface" "Izh_con_info"
|
|
| 700 | + ,structField C "HsIface" "Fzh_con_info"
|
|
| 701 | + ,structField C "HsIface" "Dzh_con_info"
|
|
| 702 | + ,structField C "HsIface" "Wzh_con_info"
|
|
| 703 | + ,structField C "HsIface" "runAllocationLimitHandler_closure"
|
|
| 704 | + ,structField C "HsIface" "Ptr_con_info"
|
|
| 705 | + ,structField C "HsIface" "FunPtr_con_info"
|
|
| 706 | + ,structField C "HsIface" "I8zh_con_info"
|
|
| 707 | + ,structField C "HsIface" "I16zh_con_info"
|
|
| 708 | + ,structField C "HsIface" "I32zh_con_info"
|
|
| 709 | + ,structField C "HsIface" "I64zh_con_info"
|
|
| 710 | + ,structField C "HsIface" "W8zh_con_info"
|
|
| 711 | + ,structField C "HsIface" "W16zh_con_info"
|
|
| 712 | + ,structField C "HsIface" "W32zh_con_info"
|
|
| 713 | + ,structField C "HsIface" "W64zh_con_info"
|
|
| 714 | + ,structField C "HsIface" "StablePtr_con_info"
|
|
| 715 | + ,structField C "HsIface" "StackSnapshot_closure"
|
|
| 716 | + ,structField C "HsIface" "divZZeroException_closure"
|
|
| 717 | + ,structField C "HsIface" "underflowException_closure"
|
|
| 718 | + ,structField C "HsIface" "overflowException_closure"
|
|
| 719 | + ,structField C "HsIface" "unpackCStringzh_closure"
|
|
| 720 | + ,structField C "HsIface" "unpackCStringzh_info"
|
|
| 721 | + ,structField C "HsIface" "unpackCStringUtf8zh_info"
|
|
| 722 | + |
|
| 670 | 723 | -- pre-compiled thunk types
|
| 671 | 724 | ,constantWord Haskell "MAX_SPEC_SELECTEE_SIZE" "MAX_SPEC_SELECTEE_SIZE"
|
| 672 | 725 | ,constantWord Haskell "MAX_SPEC_AP_SIZE" "MAX_SPEC_AP_SIZE"
|