| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
H2JVM.Instruction
Description
High level representation of a JVM instruction, with type-safe arguments and no stack manipulation needed.
This is not a 1-1 mapping to the actual instructions, use H2JVM.Internal.Raw.Instruction for that.
Instead, this includes some conveniences like the Label instruction to avoid manually dealing with jump offsets.
Synopsis
- type Instruction = Instruction' Label
- data Instruction' label
- = ALoad U2
- | AStore U2
- | AReturn
- | AConstNull
- | Dup
- | IAnd
- | If (IfCond label)
- | Instanceof ClassInfoType
- | InvokeStatic ClassInfoType Text MethodDescriptor
- | InvokeInterface ClassInfoType Text MethodDescriptor
- | InvokeVirtual ClassInfoType Text MethodDescriptor
- | InvokeDynamic BootstrapMethod Text MethodDescriptor
- | InvokeSpecial ClassInfoType Text MethodDescriptor
- | IOr
- | ILoad U2
- | IStore U2
- | Label label
- | LDC LDCEntry
- | PutStatic ClassInfoType Text FieldType
- | GetField ClassInfoType Text FieldType
- | GetStatic ClassInfoType Text FieldType
- | PutField ClassInfoType Text FieldType
- | Goto label
- | CheckCast ClassInfoType
- | Return
- | IReturn
- | IConst0
- | IConst1
- | New ClassInfoType
- | ArrayLength
- | AALoad
- | IfICmp (IfCond label)
- | IAdd
- | ISub
- | IMul
- | IDiv
- data LDCEntry
- data IfCond label
- jumpTarget :: Instruction' label -> Maybe label
- ldcEntryToFieldType :: LDCEntry -> FieldType
Documentation
type Instruction = Instruction' Label Source #
An instruction whose labels are the Label type.
This is probably the type you want.
data Instruction' label Source #
An instruction with a polymorphic label type.
Constructors
Instances
A value that can be loaded by the LDC instruction.
Constructors
| LDCInt JVMInt | Load an integer constant. |
| LDCFloat Float | Load a float constant. |
| LDCString Text | Load a string constant. |
| LDCClass ClassInfoType | Load a Class object. |
Instances
| Data LDCEntry Source # | |||||
Defined in H2JVM.Instruction Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LDCEntry -> c LDCEntry # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LDCEntry # toConstr :: LDCEntry -> Constr # dataTypeOf :: LDCEntry -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LDCEntry) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LDCEntry) # gmapT :: (forall b. Data b => b -> b) -> LDCEntry -> LDCEntry # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LDCEntry -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LDCEntry -> r # gmapQ :: (forall d. Data d => d -> u) -> LDCEntry -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LDCEntry -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LDCEntry -> m LDCEntry # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LDCEntry -> m LDCEntry # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LDCEntry -> m LDCEntry # | |||||
| Generic LDCEntry Source # | |||||
Defined in H2JVM.Instruction Associated Types
| |||||
| Show LDCEntry Source # | |||||
| Eq LDCEntry Source # | |||||
| Ord LDCEntry Source # | |||||
Defined in H2JVM.Instruction | |||||
| Pretty LDCEntry Source # | |||||
| type Rep LDCEntry Source # | |||||
Defined in H2JVM.Instruction type Rep LDCEntry = D1 ('MetaData "LDCEntry" "H2JVM.Instruction" "h2jvm-0.1.0.0-LWhbtWHvrTPFtGJV7ONYMS" 'False) ((C1 ('MetaCons "LDCInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 JVMInt)) :+: C1 ('MetaCons "LDCFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float))) :+: (C1 ('MetaCons "LDCString" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "LDCClass" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ClassInfoType)))) | |||||
A condition of an if instruction.
Instances
| Functor IfCond Source # | |||||
| Foldable IfCond Source # | |||||
Defined in H2JVM.Instruction Methods fold :: Monoid m => IfCond m -> m # foldMap :: Monoid m => (a -> m) -> IfCond a -> m # foldMap' :: Monoid m => (a -> m) -> IfCond a -> m # foldr :: (a -> b -> b) -> b -> IfCond a -> b # foldr' :: (a -> b -> b) -> b -> IfCond a -> b # foldl :: (b -> a -> b) -> b -> IfCond a -> b # foldl' :: (b -> a -> b) -> b -> IfCond a -> b # foldr1 :: (a -> a -> a) -> IfCond a -> a # foldl1 :: (a -> a -> a) -> IfCond a -> a # elem :: Eq a => a -> IfCond a -> Bool # maximum :: Ord a => IfCond a -> a # minimum :: Ord a => IfCond a -> a # | |||||
| Traversable IfCond Source # | |||||
| Data label => Data (IfCond label) Source # | |||||
Defined in H2JVM.Instruction Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IfCond label -> c (IfCond label) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (IfCond label) # toConstr :: IfCond label -> Constr # dataTypeOf :: IfCond label -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (IfCond label)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (IfCond label)) # gmapT :: (forall b. Data b => b -> b) -> IfCond label -> IfCond label # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IfCond label -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IfCond label -> r # gmapQ :: (forall d. Data d => d -> u) -> IfCond label -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> IfCond label -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IfCond label -> m (IfCond label) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IfCond label -> m (IfCond label) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IfCond label -> m (IfCond label) # | |||||
| Generic (IfCond label) Source # | |||||
Defined in H2JVM.Instruction Associated Types
| |||||
| Show label => Show (IfCond label) Source # | |||||
| Eq label => Eq (IfCond label) Source # | |||||
| Ord label => Ord (IfCond label) Source # | |||||
Defined in H2JVM.Instruction | |||||
| Pretty label => Pretty (IfCond label) Source # | |||||
| type Rep (IfCond label) Source # | |||||
Defined in H2JVM.Instruction type Rep (IfCond label) = D1 ('MetaData "IfCond" "H2JVM.Instruction" "h2jvm-0.1.0.0-LWhbtWHvrTPFtGJV7ONYMS" 'False) ((C1 ('MetaCons "IfEq" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 label)) :+: (C1 ('MetaCons "IfNe" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 label)) :+: C1 ('MetaCons "IfLt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 label)))) :+: (C1 ('MetaCons "IfGe" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 label)) :+: (C1 ('MetaCons "IfGt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 label)) :+: C1 ('MetaCons "IfLe" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 label))))) | |||||
jumpTarget :: Instruction' label -> Maybe label Source #
The jump target of an instruction, if it is a jump instruction.
ldcEntryToFieldType :: LDCEntry -> FieldType Source #
Convert an 'LDCEntry to a 'FieldType.