| Copyright | (c) Christian Gram Kalhauge 2018 |
|---|---|
| License | MIT |
| Maintainer | kalhuage@cs.ucla.edu |
| Safe Haskell | None |
| Language | Haskell2010 |
Language.JVM.ConstantPool
Contents
Description
This module contains the ConstantPool data structure and multiple
other types, and classes.
Synopsis
- newtype ConstantPool r = ConstantPool {
- unConstantPool :: IntMap (Constant r)
- access :: Index -> ConstantPool r -> Either PoolAccessError (Constant r)
- growPool :: forall b. (ConstantPool High -> Constant Low -> Either b (Constant High)) -> ConstantPool Low -> (ConstantPool High, [(b, (Index, Constant Low))])
- poolCount :: ConstantPool r -> Int
- nextIndex :: ConstantPool r -> Index
- listConstants :: ConstantPool r -> [(Index, Constant r)]
- fromConstants :: Foldable f => f (Constant r) -> ConstantPool r
- empty :: ConstantPool r
- data PoolAccessError = PoolAccessError {
- paErrorRef :: !Word16
- paErrorMsg :: String
- type Index = Word16
Constant Pool
The ConstantPool contains all the constants, and is accessible using the
Lookup methods.
newtype ConstantPool r Source #
A ConstantPool is just an IntMap. A IntMap is used, because constants are
accessed using their byte-offset, and sometimes the offset depends on the constant
size. See constantSize.
Constructors
| ConstantPool | |
Fields
| |
Instances
access :: Index -> ConstantPool r -> Either PoolAccessError (Constant r) Source #
Access a constant in the constant pool
growPool :: forall b. (ConstantPool High -> Constant Low -> Either b (Constant High)) -> ConstantPool Low -> (ConstantPool High, [(b, (Index, Constant Low))]) Source #
poolCount :: ConstantPool r -> Int Source #
nextIndex :: ConstantPool r -> Index Source #
listConstants :: ConstantPool r -> [(Index, Constant r)] Source #
fromConstants :: Foldable f => f (Constant r) -> ConstantPool r Source #
empty :: ConstantPool r Source #
Creates an empty constant pool
data PoolAccessError Source #
A pool access error
Constructors
| PoolAccessError | |
Fields
| |