Copyright | (c) Christian Gram Kalhauge 2017 |
---|---|
License | MIT |
Maintainer | kalhuage@cs.ucla.edu |
Safe Haskell | None |
Language | Haskell2010 |
This module contains the Constant
type and the ConstantPool
. These
are essential for accessing data in the class-file.
Synopsis
- 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 -> Index
- 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 {}
- 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
- = MHInvokeVirtual !(DeepRef AbsMethodId r)
- | MHInvokeStatic !(DeepRef AbsMethodId r)
- | MHInvokeSpecial !(DeepRef AbsMethodId r)
- | MHNewInvokeSpecial !(DeepRef AbsMethodId 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.
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
constantSize :: Constant r -> Index Source #
Some of the Constant
s 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
VInteger Int32 | |
VLong Int64 | |
VFloat Float | |
VDouble Double | |
VString ByteString | |
VClass ClassName | |
VMethodType MethodDescriptor | |
VMethodHandle (MethodHandle High) |
Instances
Special constants
A class name
Instances
Eq ClassName Source # | |
Ord ClassName Source # | |
Defined in Language.JVM.Type | |
Show ClassName Source # | |
IsString ClassName Source # | |
Defined in Language.JVM.Type fromString :: String -> ClassName # | |
Generic ClassName Source # | |
NFData ClassName Source # | |
Defined in Language.JVM.Type | |
TypeParse ClassName Source # | |
Referenceable ClassName Source # | |
type Rep ClassName Source # | |
Defined in Language.JVM.Type |
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.
Instances
Instances
Instances
data NameAndType a Source #
A name and a type
NameAndType | |
|
Instances
data MethodDescriptor Source #
Method Descriptor
Instances
data FieldDescriptor Source #
Field Descriptor
Instances
data MethodHandle r Source #
The union type over the different method handles.
MHField !(MethodHandleField r) | |
MHMethod !(MethodHandleMethod r) | |
MHInterface !(MethodHandleInterface r) |
Instances
data MethodHandleField r Source #
Instances
data MethodHandleMethod r Source #
MHInvokeVirtual !(DeepRef AbsMethodId r) | |
MHInvokeStatic !(DeepRef AbsMethodId r) | Since version 52.0 |
MHInvokeSpecial !(DeepRef AbsMethodId r) | Since version 52.0 |
MHNewInvokeSpecial !(DeepRef AbsMethodId r) |
Instances
data MethodHandleInterface r Source #
Instances
data MethodHandleFieldKind Source #
Instances
data InvokeDynamic r Source #
Instances
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.