ghc-9.8.0.20230919: 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 HaskellNone
LanguageHaskell2010

GHC.StgToJS.Object

Description

 
Synopsis

Documentation

putObject Source #

Arguments

:: BinHandle 
-> ModuleName

module

-> BlockInfo

block infos

-> [ObjBlock]

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).

getObjectBlocks :: Object -> BlockIds -> IO [ObjBlock] Source #

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

readObjectBlocks :: FilePath -> BlockIds -> IO [ObjBlock] Source #

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

readObjectBlockInfo :: FilePath -> IO (Maybe BlockInfo) Source #

Reads only the part necessary to get the block info

isGlobalBlock :: BlockId -> Bool Source #

we use the convention that the first block (0) is a module-global block that's always included when something from the module is loaded. everything in a module implicitly depends on the global block. The global block 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 LocatedBlockInfo Source #

Constructors

LocatedBlockInfo 

Fields

data BlockInfo Source #

Information about blocks (linkable units)

Constructors

BlockInfo 

Fields

Instances

Instances details
Binary BlockInfo Source # 
Instance details

Defined in GHC.StgToJS.Object

Outputable BlockInfo Source # 
Instance details

Defined in GHC.StgToJS.Object

Methods

ppr :: BlockInfo -> SDoc Source #

data BlockDeps Source #

Constructors

BlockDeps 

Fields

Instances

Instances details
Binary BlockDeps Source # 
Instance details

Defined in GHC.StgToJS.Object

data BlockLocation Source #

Where are the blocks

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 BlockLocation Source # 
Instance details

Defined in GHC.StgToJS.Object

data BlockRef Source #

A BlockRef is a pair of a module and the index of the block in the object file

Constructors

BlockRef 

Fields

Instances

Instances details
Eq BlockRef Source # 
Instance details

Defined in GHC.StgToJS.Object

Ord BlockRef Source # 
Instance details

Defined in GHC.StgToJS.Object

data ExportedFun Source #

Exported Functions

Constructors

ExportedFun 

Fields

Orphan instances

Binary AOp Source # 
Instance details

Methods

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

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

get :: BinHandle -> IO AOp Source #

Binary JExpr Source # 
Instance details

Binary JStat Source # 
Instance details

Binary JVal Source # 
Instance details

Binary Op Source # 
Instance details

Methods

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

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

get :: BinHandle -> IO Op Source #

Binary UOp Source # 
Instance details

Methods

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

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

get :: BinHandle -> IO UOp Source #

Binary Ident 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