Module JBasicsLow

module JBasicsLow: sig .. end

Low level manipulations on basic types.


type method_handle_kind = [ `GetField
| `GetStatic
| `InvokeInterface
| `InvokeSpecial
| `InvokeStatic
| `InvokeVirtual
| `NewInvokeSpecial
| `PutField
| `PutStatic ]

Method handle type.

type ldc_value = [ `Class of JBasics.object_type
| `Float of float
| `Int of int32
| `MethodHandle of JBasics.method_handle
| `MethodType of JBasics.method_descriptor
| `String of JBasics.jstr ]
type ioc_method = [ `Class of JBasics.object_type * JBasics.method_signature
| `Interface of JBasics.class_name * JBasics.method_signature ]

Constant Pool.

Converting to constant pool elements:

val bootstrap_argument_to_const : JBasics.bootstrap_argument -> JBasics.constant
val method_handle_to_const : JBasics.method_handle -> method_handle_kind * JBasics.constant
val constant_attribute_to_const : JClass.constant_attribute -> JBasics.constant

Getting a constant from the constant pool:

val get_constant : JBasics.constant array -> int -> JBasics.constant
val get_constant_ldc_value : JBasics.constant array -> int -> ldc_value
val get_object_type : JBasics.constant array -> int -> JBasics.object_type
val get_class : JBasics.constant array -> int -> JBasics.class_name
val get_string : JBasics.constant array -> int -> string
val get_field : JBasics.constant array -> int -> JBasics.class_name * JBasics.field_signature
val get_method : JBasics.constant array ->
int -> JBasics.object_type * JBasics.method_signature
val get_interface_method : JBasics.constant array ->
int -> JBasics.class_name * JBasics.method_signature
val get_method_or_interface_method : JBasics.constant array -> int -> ioc_method
val get_method_handle : JBasics.constant array -> int -> JBasics.method_handle
val get_bootstrap_argument : JBasics.constant array -> int -> JBasics.bootstrap_argument
val get_constant_attribute : JBasics.constant array -> int -> JClass.constant_attribute

Same thing, reading the index in a channel:

val get_class_ui16 : JBasics.constant array -> JLib.IO.input -> JBasics.class_name
val get_string_ui16 : JBasics.constant array -> JLib.IO.input -> string
val get_method_handle_ui16 : JBasics.constant array -> JLib.IO.input -> JBasics.method_handle
val get_bootstrap_argument_ui16 : JBasics.constant array -> JLib.IO.input -> JBasics.bootstrap_argument

Getting an index for a constant:

val constant_to_int : JBasics.constant JLib.DynArray.t -> JBasics.constant -> int

Return the index of a constant, adding it to the constant pool if necessary.

val ldc_value_to_int : JBasics.constant JLib.DynArray.t -> ldc_value -> int
val object_type_to_int : JBasics.constant JLib.DynArray.t -> JBasics.object_type -> int
val class_to_int : JBasics.constant JLib.DynArray.t -> JBasics.class_name -> int
val field_to_int : JBasics.constant JLib.DynArray.t ->
JBasics.class_name * JBasics.field_signature -> int
val method_to_int : JBasics.constant JLib.DynArray.t ->
JBasics.object_type * JBasics.method_signature -> int
val interface_method_to_int : JBasics.constant JLib.DynArray.t ->
JBasics.class_name * JBasics.method_signature -> int
val string_to_int : JBasics.constant JLib.DynArray.t -> string -> int
val method_handle_kind_to_int : method_handle_kind -> int
val name_and_type_to_int : JBasics.constant JLib.DynArray.t -> string * JBasics.descriptor -> int
val bootstrap_method_to_int : JBasics.bootstrap_method JLib.DynArray.t -> JBasics.bootstrap_method -> int

Return the index of a bootstrap method in the bootstrap method table, adding it if necessary.

Same thing, but writes the index to a channel.

val write_constant : 'a JLib.IO.output ->
JBasics.constant JLib.DynArray.t -> JBasics.constant -> unit
val write_object_type : 'a JLib.IO.output ->
JBasics.constant JLib.DynArray.t -> JBasics.object_type -> unit
val write_class : 'a JLib.IO.output ->
JBasics.constant JLib.DynArray.t -> JBasics.class_name -> unit
val write_string : 'a JLib.IO.output -> JBasics.constant JLib.DynArray.t -> string -> unit
val write_name_and_type : 'a JLib.IO.output ->
JBasics.constant JLib.DynArray.t -> string * JBasics.descriptor -> unit
val write_bootstrap_argument : 'a JLib.IO.output ->
JBasics.constant JLib.DynArray.t -> JBasics.bootstrap_argument -> unit
val write_constant_attribute : 'a JLib.IO.output ->
JBasics.constant JLib.DynArray.t -> JClass.constant_attribute -> unit

Usefull writing functions.

val write_ui8 : 'a JLib.IO.output -> int -> unit
val write_i8 : 'a JLib.IO.output -> int -> unit
val write_string_with_length : ('a JLib.IO.output -> int -> unit) -> 'a JLib.IO.output -> string -> unit
val write_with_length : ('a JLib.IO.output -> int -> unit) ->
'a JLib.IO.output -> (string JLib.IO.output -> unit) -> unit
val write_with_size : ('a JLib.IO.output -> int -> unit) ->
'a JLib.IO.output -> ('c -> unit) -> 'c list -> unit