---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 23 Edition"
java_version: 23
chapter: "Chapter 4. The class File Format"
section: "4.4.10"
heading: "4.4.10. The CONSTANT_Dynamic_info and CONSTANT_InvokeDynamic_info Structures"
parent: "4.4. The Constant Pool"
source: https://docs.oracle.com/javase/specs/jvms/se23/html/jvms-4.html#jvms-4.4.10
id: "4.4.10"
url: https://jvm.obfuscated.software/jvms/se23/4.4.10.html
raw: https://jvm.obfuscated.software/jvms/se23/4.4.10.md
---

# 4.4.10. The `CONSTANT_Dynamic_info` and `CONSTANT_InvokeDynamic_info` Structures

Most structures in the `constant_pool` table represent entities directly, by combining names, descriptors, and values recorded statically in the table. In contrast, the `CONSTANT_Dynamic_info` and `CONSTANT_InvokeDynamic_info` structures represent entities indirectly, by pointing to code which computes an entity dynamically. The code, called a *bootstrap method*, is invoked by the Java Virtual Machine during resolution of symbolic references derived from these structures ([§5.1](5.1.md), [§5.4.3.6](5.4.3.6.md)). Each structure specifies a bootstrap method as well as an auxiliary name and type that characterize the entity to be computed. In more detail:

- The `CONSTANT_Dynamic_info` structure is used to represent a *dynamically-computed constant*, an arbitrary value that is produced by invocation of a bootstrap method in the course of an *ldc* instruction ([§*ldc*](6.5.ldc.md)), among others. The auxiliary type specified by the structure constrains the type of the dynamically-computed constant.
- The `CONSTANT_InvokeDynamic_info` structure is used to represent a *dynamically-computed call site*, an instance of `java.lang.invoke.CallSite` that is produced by invocation of a bootstrap method in the course of an *invokedynamic* instruction ([§*invokedynamic*](6.5.invokedynamic.md)). The auxiliary type specified by the structure constrains the method type of the dynamically-computed call site.

```
CONSTANT_Dynamic_info {
    u1 tag;
    u2 bootstrap_method_attr_index;
    u2 name_and_type_index;
}

CONSTANT_InvokeDynamic_info {
    u1 tag;
    u2 bootstrap_method_attr_index;
    u2 name_and_type_index;
}
```

The items of these structures are as follows:

- **tag**

  The `tag` item of a `CONSTANT_Dynamic_info` structure has the value `CONSTANT_Dynamic` (17).

  The `tag` item of a `CONSTANT_InvokeDynamic_info` structure has the value `CONSTANT_InvokeDynamic` (18).

- **bootstrap_method_attr_index**

  The value of the `bootstrap_method_attr_index` item must be a valid index into the `bootstrap_methods` array of the bootstrap method table of this `class` file ([§4.7.23](4.7.23.md)).

  `CONSTANT_Dynamic_info` structures are unique in that they are syntactically allowed to refer to themselves via the bootstrap method table. Rather than mandating that such cycles are detected when classes are loaded (a potentially expensive check), we permit cycles initially but mandate a failure at resolution ([§5.4.3.6](5.4.3.6.md)).

- **name_and_type_index**

  The value of the `name_and_type_index` item must be a valid index into the `constant_pool` table. The `constant_pool` entry at that index must be a `CONSTANT_NameAndType_info` structure ([§4.4.6](4.4.6.md)). This `constant_pool` entry indicates a name and descriptor.

  In a `CONSTANT_Dynamic_info` structure, the indicated descriptor must be a field descriptor ([§4.3.2](4.3.2.md)).

  In a `CONSTANT_InvokeDynamic_info` structure, the indicated descriptor must be a method descriptor ([§4.3.3](4.3.3.md)).
