| Copyright | (c) Christian Gram Kalhauge 2017 |
|---|---|
| License | MIT |
| Maintainer | kalhuage@cs.ucla.edu |
| Safe Haskell | None |
| Language | Haskell2010 |
Language.JVM.Constant
Contents
Description
This module contains the Constant type and the ConstantPool. These
are essential for accessing data in the class-file.
- data Constant r
- = CString !SizedByteString16
- | CInteger !Int32
- | CFloat !Float
- | CLong !Int64
- | CDouble !Double
- | CClassRef !(Ref Text r)
- | CStringRef !(Ref ByteString r)
- | CFieldRef !(InClass FieldId r)
- | CMethodRef !(InClass MethodId r)
- | CInterfaceMethodRef !(InClass MethodId r)
- | CNameAndType !(Ref Text r) !(Ref Text r)
- | CMethodHandle !(MethodHandle r)
- | CMethodType !(Ref MethodDescriptor r)
- | CInvokeDynamic !(InvokeDynamic r)
- constantSize :: Constant r -> Int
- typeToStr :: Constant r -> String
- class Referenceable a where
- data JValue
- newtype ClassName = ClassName {}
- data InClass a r = InClass {
- inClassName :: !(Ref ClassName r)
- inClassId :: !(Ref a r)
- type AbsMethodId = InClass MethodId
- type AbsFieldId = InClass FieldId
- newtype AbsInterfaceMethodId r = AbsInterfaceMethodId {}
- data AbsVariableMethodId r
- = VInterfaceMethodId !(AbsInterfaceMethodId r)
- | VMethodId !(AbsMethodId r)
- newtype MethodId = MethodId (NameAndType MethodDescriptor)
- newtype FieldId = FieldId (NameAndType FieldDescriptor)
- data NameAndType a = NameAndType {
- ntName :: Text
- ntDescriptor :: a
- data MethodDescriptor
- data FieldDescriptor
- data MethodHandle r
- = MHField !(MethodHandleField r)
- | MHMethod !(MethodHandleMethod r)
- | MHInterface !(MethodHandleInterface r)
- data MethodHandleField r = MethodHandleField {}
- data MethodHandleMethod r
- data MethodHandleInterface r = MethodHandleInterface {}
- data MethodHandleFieldKind
- data InvokeDynamic r = InvokeDynamic {
- invokeDynamicAttrIndex :: !Word16
- invokeDynamicMethod :: !(Ref MethodId r)
- data High
- data Low
Documentation
A constant is a multi word item in the ConstantPool. Each of
the constructors are pretty much self-explanatory from the types.
Constructors
| CString !SizedByteString16 | |
| CInteger !Int32 | |
| CFloat !Float | |
| CLong !Int64 | |
| CDouble !Double | |
| CClassRef !(Ref Text r) | |
| CStringRef !(Ref ByteString r) | |
| CFieldRef !(InClass FieldId r) | |
| CMethodRef !(InClass MethodId r) | |
| CInterfaceMethodRef !(InClass MethodId r) | |
| CNameAndType !(Ref Text r) !(Ref Text r) | |
| CMethodHandle !(MethodHandle r) | |
| CMethodType !(Ref MethodDescriptor r) | |
| CInvokeDynamic !(InvokeDynamic r) |
Instances
| Staged Constant Source # | |
| Eq (Constant High) Source # | |
| Eq (Constant Low) Source # | |
| Ord (Constant Low) Source # | |
| Show (Constant High) Source # | |
| Show (Constant Low) Source # | |
| Generic (Constant High) Source # | |
| Generic (Constant Low) Source # | |
| Binary (Constant Low) Source # | |
| NFData (Constant High) Source # | |
| NFData (Constant Low) Source # | |
| Referenceable (Constant High) Source # | |
| type Rep (Constant High) Source # | |
| type Rep (Constant Low) Source # | |
constantSize :: Constant r -> Int Source #
Some of the Constants take up more space in the constant pool than other.
Notice that String and MethodType is not of size
32, but is still awarded value 1. This is due to an
inconsistency
in JVM.
class Referenceable a where Source #
Referenceable is something that can exist in the constant pool.
Instances
A constant pool value in java
Special constants
A class name
Constructors
| ClassName | |
Fields | |
Anything pointing inside a class
Instances
type AbsMethodId = InClass MethodId Source #
A method id in a class.
type AbsFieldId = InClass FieldId Source #
A field id in a class
newtype AbsInterfaceMethodId r Source #
An interface method, which is a class in a method.
Constructors
| AbsInterfaceMethodId | |
Fields | |
Instances
data AbsVariableMethodId r Source #
In some cases we can both point to interface methods and regular methods.
Constructors
| VInterfaceMethodId !(AbsInterfaceMethodId r) | |
| VMethodId !(AbsMethodId r) |
Instances
Constructors
| MethodId (NameAndType MethodDescriptor) |
Instances
| Eq MethodId Source # | |
| Ord MethodId Source # | |
| Show MethodId Source # | |
| IsString MethodId Source # | |
| Generic MethodId Source # | |
| NFData MethodId Source # | |
| Referenceable MethodId Source # | |
| Eq (InClass MethodId High) Source # | |
| Eq (InClass MethodId Low) Source # | |
| Ord (InClass MethodId Low) Source # | |
| Show (InClass MethodId High) Source # | |
| Show (InClass MethodId Low) Source # | |
| Generic (InClass MethodId High) Source # | |
| Generic (InClass MethodId Low) Source # | |
| Binary (InClass MethodId Low) Source # | |
| NFData (InClass MethodId High) Source # | |
| NFData (InClass MethodId Low) Source # | |
| Referenceable (InClass MethodId High) Source # | |
| type Rep MethodId Source # | |
| type Rep (InClass MethodId High) Source # | |
| type Rep (InClass MethodId Low) Source # | |
Constructors
| FieldId (NameAndType FieldDescriptor) |
Instances
| Eq FieldId Source # | |
| Ord FieldId Source # | |
| Show FieldId Source # | |
| IsString FieldId Source # | |
| Generic FieldId Source # | |
| NFData FieldId Source # | |
| Referenceable FieldId Source # | |
| Eq (InClass FieldId High) Source # | |
| Eq (InClass FieldId Low) Source # | |
| Ord (InClass FieldId Low) Source # | |
| Show (InClass FieldId High) Source # | |
| Show (InClass FieldId Low) Source # | |
| Generic (InClass FieldId High) Source # | |
| Generic (InClass FieldId Low) Source # | |
| Binary (InClass FieldId Low) Source # | |
| NFData (InClass FieldId High) Source # | |
| NFData (InClass FieldId Low) Source # | |
| Referenceable (InClass FieldId High) Source # | |
| type Rep FieldId Source # | |
| type Rep (InClass FieldId High) Source # | |
| type Rep (InClass FieldId Low) Source # | |
data NameAndType a Source #
A name and a type
Constructors
| NameAndType | |
Fields
| |
Instances
| Eq a => Eq (NameAndType a) Source # | |
| Ord a => Ord (NameAndType a) Source # | |
| Show a => Show (NameAndType a) Source # | |
| TypeParse t => IsString (NameAndType t) Source # | |
| Generic (NameAndType a) Source # | |
| NFData a => NFData (NameAndType a) Source # | |
| TypeParse t => TypeParse (NameAndType t) Source # | |
| TypeParse a => Referenceable (NameAndType a) Source # | |
| type Rep (NameAndType a) Source # | |
data MethodDescriptor Source #
Method Descriptor
Instances
data MethodHandle r Source #
The union type over the different method handles.
Constructors
| MHField !(MethodHandleField r) | |
| MHMethod !(MethodHandleMethod r) | |
| MHInterface !(MethodHandleInterface r) |
Instances
| Staged MethodHandle Source # | |
| Eq (MethodHandle High) Source # | |
| Eq (MethodHandle Low) Source # | |
| Ord (MethodHandle Low) Source # | |
| Show (MethodHandle High) Source # | |
| Show (MethodHandle Low) Source # | |
| Generic (MethodHandle High) Source # | |
| Generic (MethodHandle Low) Source # | |
| Binary (MethodHandle Low) Source # | |
| NFData (MethodHandle High) Source # | |
| NFData (MethodHandle Low) Source # | |
| Referenceable (MethodHandle High) Source # | |
| type Rep (MethodHandle High) Source # | |
| type Rep (MethodHandle Low) Source # | |
data MethodHandleField r Source #
Constructors
| MethodHandleField | |
Fields | |
Instances
data MethodHandleMethod r Source #
Constructors
| MHInvokeVirtual !(DeepRef AbsMethodId r) | |
| MHInvokeStatic !(DeepRef AbsVariableMethodId r) | Since version 52.0 |
| MHInvokeSpecial !(DeepRef AbsVariableMethodId r) | Since version 52.0 |
| MHNewInvokeSpecial !(DeepRef AbsMethodId r) |
Instances
data MethodHandleInterface r Source #
Constructors
| MethodHandleInterface | |
Fields | |
Instances
data MethodHandleFieldKind Source #
Constructors
| MHGetField | |
| MHGetStatic | |
| MHPutField | |
| MHPutStatic |
data InvokeDynamic r Source #
Constructors
| InvokeDynamic | |
Fields
| |
Instances
| Staged InvokeDynamic Source # | |
| Eq (InvokeDynamic High) Source # | |
| Eq (InvokeDynamic Low) Source # | |
| Ord (InvokeDynamic Low) Source # | |
| Show (InvokeDynamic High) Source # | |
| Show (InvokeDynamic Low) Source # | |
| Generic (InvokeDynamic High) Source # | |
| Generic (InvokeDynamic Low) Source # | |
| Binary (InvokeDynamic Low) Source # | |
| NFData (InvokeDynamic High) Source # | |
| NFData (InvokeDynamic Low) Source # | |
| Referenceable (InvokeDynamic High) Source # | |
| type Rep (InvokeDynamic High) Source # | |
| type Rep (InvokeDynamic Low) Source # | |
re-exports
Any data structure in the High stage, is easier to read.
Instances
Any data structure that is in the low stage should be serializable using the binary library.
Instances