Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,269
    • Issues 4,269
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 413
    • Merge Requests 413
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Wiki
    • Commentary
    • Rts
  • memory ordering

Last edited by Takenobu Tani Jun 10, 2019
Page history New page

memory ordering

Memory ordering

This page describes the memory ordering design in GHC.

Please update this page freely.

Background

There are various architectures about memory ordering (see here). GHC needs to correspond to each sort.

  • Strong memory ordering:

    • X86, SPARC in TSO mode
  • Weak memory ordering:

    • ARM, PowerPC

On weakly ordering machines, store-store and load-load instructions may be also reordered. So we need appropriate memory barriers.

Heap memory barriers

Here is the design note about heap memory barriers in GHC:

  • Note [Heap memory barriers] in includes/stg/SMP.h

Related merge request and mails are here:

  • !1128 (merged) (originally !734 (closed))
  • Cmm Memory Model (Understanding #15449) at ghc-devs ML.

Related documents and articles

Here are some useful resources:

  • The JSR-133 Cookbook for Compiler Writers
  • LINUX KERNEL MEMORY BARRIERS
  • Memory ordering
  • LLVM Language Reference Manual, ‘cmpxchg’ Instruction
Clone repository

GHC Home
GHC User's Guide

Joining In

Newcomers info
Mailing Lists & IRC
The GHC Team

Documentation

GHC Status Info
Working conventions
Building Guide
Debugging
Commentary

Wiki

Title Index
Recent Changes