Sebastian Graf
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- title: Call 2023-03-22 tags: S+S, Semantics --- # GHC ## Threshold arity (#23113) * `threshold_arity` (in `dmdAnalRhsSig`) * For join points may be less than the `idArity` (or I suppose greater than if we for some reason the `idArity` is totally out bogus). * For non-join points is equal to `idArity` (see `thresholdArity`). * In `dmdAnalRhsSig`, the `final_rhs_dmds` will be at least as long as the `threshold_arity`. For join points it could be longer if `let_dmd` had a lot of call demands. ``` join j x = blah in e ``` in a context of `C(C(C(Top)))`. * So in `splitFun` * For join points, the length of `wrap_dmds` may be * less that `idArity`. e.g. ``` join j x = \pqr. blah in ...(jump j 1)... (jump j 2)... ``` Here idArity is 4, but join-arity is 1. * more han `idArity`. eg ``` f (join j x = blah in e) ``` where `f` has a demand `C(C(C(Top)))` on its arg. * For non-join-points, should be equal. Care with: * `take threshold_arity` in finaliseArgBoxities. Why? * `mkDmdSigForArity` * Why do this at all? * When trimming, we keep the same `div`; looks wrong. Reason for trimming. Worker-wrapper is driven by dmd sig; and w/w makes wrapper have arity N where N=length wrap_dmds; in effect, does eta-expansion. ``` f (join j x = blah in e) -- where f has a C1(C1(top)) demand on it its arg ``` Then it would be OK to eta expand and w/w to ``` f (let $wj x' p q' = let x = I# x'; q = I# q' in blah in join j x = \ p q. case x of I# x' -> case q of I# q' -> $wj x' p q' ``` Semantically sound, but $wj is not a join point -- bad. Conclusion: length `wrap_dmds` = threshold_arity, including for join points. So that we w/w for threshold_arity. f x y = x+y Analyse with C(CS(top)) DmdTy [strict, strict] top Trim in mkDmdSigFor Arity DmdTy [strict] top seems wrong. But maybe not-wrong for join points?? ``` f (join $wj x' p q = let x = I# x'; q = I# q' in blah in join j x = \ p q. case x of I# x' -> jump $wj x' p q ``` ## Eta expansion of arguments (#23083) https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10088 * Note [No crap in eta-expanded code] and Note [Eta expansion for join points] ==> don't eta expand join point heads in Prep * `case patError @() of {}` lowering to ``patError @() `cast` co :: () ~ Int# -> Int#`` and `mightBeFunTy` guessing in the Backend * Seems to be a general problem of -XEmptyCase lowering. ``` f :: Bool -> Int# -> Int# f True = patError @() of {} f False = \x. x ``` CorePrep: ``` f :: Bool -> Int# -> Int# f True = patError @() `cast` co :: () ~ Int# -> Int# f False = \x. x ``` eta: ``` f :: Bool -> Int# -> Int# f True eta = (patError @() `cast` co :: () ~ Int# -> Int#) eta f False eta = eta ``` and that does trigger an assertion on line 1031 of StgToCmm.Expr ``` EnterIt -> assert (null args) $ -- Discarding arguments emitEnter fun ``` ## (#23145) https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10152 # Semantics http://siek.blogspot.com/2017/06/revisiting-well-typed-programs-cannot.html ## Introduction * Move Related Work to Related Work * Is divergence really that important to people? * Bring simple usage analysis (perhaps *instead* of absence anlsyis, or recovering latter as special case) ## Maximality Non-retreating trace that is maximal ## Domain Theory Thinking a lot about Domain Theory. Continuity of S proves challenging withtout baking maximality of traces (or bot) into the domain ## Stateless semantics Working on stepwise abstraction to stateful semantics # Discussion **Balanced** = first two bullets A balanced trace can end up with a state that is deeper than k1. Maybe "non-retreating". **Maximally balanced** = pi is balanced and either pi is infinite or (if pi is finite) there is no sigma' st (pi:sigma') is balanced. SG: **claim**: for any finite, non-stuck maximally balanced trace, final stack is k1. Of course you have to define "non-stuck". S[[e]] (e, env, heap, k) map (add k) (S[[e]] (e,env, heap, [])) S[[e]] (env, heap) = ...

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully