ghc-9.6.6: The GHC API
Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file LICENSE)
MaintainerSylvain Henry <sylvain.henry@iohk.io> Jeffrey Young <jeffrey.young@iohk.io> Luite Stegeman <luite.stegeman@iohk.io> Josh Meredith <josh.meredith@iohk.io>
Stabilityexperimental Serialization/deserialization of binary .o files for the JavaScript backend The .o files contain dependency information and generated code. All strings are mapped to a central string table, which helps reduce file size and gives us efficient hash consing on read Binary intermediate JavaScript object files: serialized [Text] -> ([ClosureInfo], JStat) blocks file layout: - magic "GHCJSOBJ" - compiler version tag - module name - offsets of string table - dependencies - offset of the index - unit infos - index - string table
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.StgToJS.Object

Description

 
Synopsis

Documentation

putObject Source #

Arguments

:: BinHandle 
-> ModuleName

module

-> Deps

dependencies

-> [ObjUnit]

linkable units and their symbols

-> IO () 

Given a handle to a Binary payload, add the module, mod_name, its dependencies, deps, and its linkable units to the payload.

getObjectBody :: BinHandle -> ModuleName -> IO Object Source #

Parse object body. Must be called after a sucessful getObjectHeader

getObject :: BinHandle -> IO (Maybe Object) Source #

Parse object

readObject :: FilePath -> IO (Maybe Object) Source #

Read object from file

The object is still in memory after this (see objHandle).

getObjectUnits :: Object -> (Word -> IndexEntry -> Bool) -> IO [ObjUnit] Source #

Get units in the object file, using the given filtering function

readObjectUnits :: FilePath -> (Word -> IndexEntry -> Bool) -> IO [ObjUnit] Source #

Read units in the object file, using the given filtering function

readObjectDeps :: FilePath -> IO (Maybe Deps) Source #

Reads only the part necessary to get the dependencies

isGlobalUnit :: Int -> Bool Source #

we use the convention that the first unit (0) is a module-global unit that's always included when something from the module is loaded. everything in a module implicitly depends on the global block. the global unit itself can't have dependencies

isJsObjectFile :: FilePath -> IO Bool Source #

Test if the object file is a JS object

data Object Source #

An object file

Constructors

Object 

Fields

data IndexEntry Source #

Constructors

IndexEntry 

Fields

Instances

Instances details
Binary IndexEntry Source # 
Instance details

Defined in GHC.StgToJS.Object

data Deps Source #

dependencies for a single module

Constructors

Deps 

Fields

Instances

Instances details
Binary Deps Source # 
Instance details

Defined in GHC.StgToJS.Object

Outputable Deps Source # 
Instance details

Defined in GHC.StgToJS.Object

Methods

ppr :: Deps -> SDoc Source #

data BlockDeps Source #

Constructors

BlockDeps 

Fields

  • blockBlockDeps :: [Int]

    dependencies on blocks in this object

  • blockFunDeps :: [ExportedFun]

    dependencies on exported symbols in other objects , blockForeignExported :: [ExpFun] , blockForeignImported :: [ForeignRef]

Instances

Instances details
Binary BlockDeps Source # 
Instance details

Defined in GHC.StgToJS.Object

data DepsLocation Source #

Where are the dependencies

Constructors

ObjectFile FilePath

In an object file at path

ArchiveFile FilePath

In a Ar file at path

InMemory String Object

In memory

Instances

Instances details
Outputable DepsLocation Source # 
Instance details

Defined in GHC.StgToJS.Object

data ExportedFun Source #

Exported Functions

Constructors

ExportedFun 

Fields

Orphan instances

Binary Ident Source # 
Instance details

Binary JExpr Source # 
Instance details

Binary JOp Source # 
Instance details

Methods

put_ :: BinHandle -> JOp -> IO () Source #

put :: BinHandle -> JOp -> IO (Bin JOp) Source #

get :: BinHandle -> IO JOp Source #

Binary JStat Source # 
Instance details

Binary JUOp Source # 
Instance details

Binary JVal Source # 
Instance details

Binary SaneDouble Source # 
Instance details

Binary CILayout Source # 
Instance details

Binary CIRegs Source # 
Instance details

Binary CIStatic Source # 
Instance details

Binary CIType Source # 
Instance details

Binary ClosureInfo Source # 
Instance details

Binary ExpFun Source # 
Instance details

Binary ForeignJSRef Source # 
Instance details

Binary JSFFIType Source # 
Instance details

Binary StaticArg Source # 
Instance details

Binary StaticInfo Source # 
Instance details

Binary StaticLit Source # 
Instance details

Binary StaticUnboxed Source # 
Instance details

Binary StaticVal Source # 
Instance details

Binary VarType Source # 
Instance details