Skip to content

Commit d21c9bb

Browse files
jbachorikclaude
andcommitted
docs: update architecture and distribution plan documentation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 25fc948 commit d21c9bb

2 files changed

Lines changed: 22 additions & 29 deletions

File tree

docs/architecture/MaskedJarArchitecture.md

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,17 @@ The previous multi-JAR approach (`btrace-agent.jar`, `btrace-boot.jar`, `btrace-
2222

2323
```
2424
btrace.jar (~2.9 MB)
25-
├── org/openjdk/btrace/boot/*.class # Entry point (Loader, MaskedClassLoader, MaskedJarUtils)
26-
├── org/openjdk/btrace/core/*.class # Bootstrap: core API (~42 classes)
27-
├── org/openjdk/btrace/core/extensions/*.class # Bootstrap: extension API
28-
├── org/openjdk/btrace/core/types/*.class # Bootstrap: type definitions
29-
├── org/openjdk/btrace/core/jfr/*.class # Bootstrap: JFR integration
30-
├── org/openjdk/btrace/runtime/*.class # Bootstrap: runtime support
31-
├── org/openjdk/btrace/libs/org/slf4j/** # Bootstrap: relocated SLF4J
32-
├── META-INF/btrace/agent/*.classdata # Masked: agent classes
25+
├── org/openjdk/btrace/boot/*.class # Entry point (Loader, MaskedClassLoader, MaskedJarUtils)
26+
├── org/openjdk/btrace/indy/IndyDispatcher.class # Bootstrap: INVOKEDYNAMIC dispatch
27+
├── org/openjdk/btrace/runtime/LinkingFlag.class # Bootstrap: re-entrancy guard
28+
├── org/openjdk/btrace/core/HandlerRepository.class # Bootstrap: handler resolution interface
29+
├── META-INF/btrace/agent/*.classdata # Masked: agent classes + BTrace runtime API + probe anchor
3330
├── META-INF/btrace/client/*.classdata # Masked: client classes
34-
├── META-INF/btrace/shared/*.classdata # Masked: shared classes (ASM, protocol, etc.)
31+
├── META-INF/btrace/shared/*.classdata # Masked: shared classes (ASM, protocol, annotations, SLF4J)
3532
└── META-INF/MANIFEST.MF
3633
```
3734

38-
**Bootstrap classes** (~112 total): Only the core API, runtime support, and SLF4J logging are stored as regular `.class` files. These are visible to the bootstrap classloader because the manifest declares `Boot-Class-Path: .`.
35+
**Bootstrap classes** (~4 total): Only the classes required by the INVOKEDYNAMIC dispatch mechanism are stored as regular `.class` files. These are visible to the bootstrap classloader because the manifest declares `Boot-Class-Path: .`.
3936

4037
**Masked classes** (~1600+): Agent, client, and shared classes are stored as `.classdata` files under `META-INF/btrace/`. The JVM's class loading ignores these files entirely. They are loaded on demand by `MaskedClassLoader`.
4138

@@ -76,7 +73,7 @@ Each mode creates a `MaskedClassLoader` for the appropriate section (agent or cl
7673

7774
**Agent mode classloader hierarchy:**
7875
```
79-
Bootstrap CL (core API, runtime, Loader)
76+
Bootstrap CL (IndyDispatcher, LinkingFlag, HandlerRepository, AnyType, Loader)
8077
└── MaskedClassLoader[agent] (parent=null)
8178
Loads from: META-INF/btrace/agent/*.classdata
8279
Fallback: META-INF/btrace/shared/*.classdata
@@ -86,7 +83,7 @@ Using `null` as the parent ensures bootstrap-visible classes (like `BTraceRuntim
8683

8784
**Client mode classloader hierarchy:**
8885
```
89-
Bootstrap CL (core API, runtime, Loader)
86+
Bootstrap CL (IndyDispatcher, LinkingFlag, HandlerRepository, AnyType, Loader)
9087
└── System CL
9188
└── MaskedClassLoader[client] (parent=System CL)
9289
Loads from: META-INF/btrace/client/*.classdata
@@ -114,16 +111,12 @@ Utility class for detecting masked JARs. A JAR is identified as masked by the pr
114111
A build-only module that defines which classes belong in the bootstrap section via a `bootIncludes` filter closure. This filter is used by the `btraceJar` task in `btrace-dist/build.gradle` to separate classes into `.class` (bootstrap) vs `.classdata` (masked) during JAR assembly.
115112

116113
**Bootstrap inclusion criteria:**
117-
- `org/openjdk/btrace/core/` — core API (excluding Messages)
118-
- `org/openjdk/btrace/runtime/` — runtime support
119-
- `org/openjdk/btrace/core/extensions/` — extension API
120-
- `org/openjdk/btrace/libs/org/slf4j/` — relocated SLF4J (logging from bootstrap code)
121-
122-
**Explicitly excluded from bootstrap:**
123-
- ASM classes (loaded via shared section)
124-
- JCTools queues (loaded via shared section)
125-
- Communication protocol classes
126-
- Annotation and handler classes
114+
- `org/openjdk/btrace/indy/``IndyDispatcher`: bootstrap method for all INVOKEDYNAMIC probe/runtime dispatch
115+
- `org/openjdk/btrace/runtime/LinkingFlag` — re-entrancy guard used by `IndyDispatcher` and `LinkerInstrumentor`
116+
- `org/openjdk/btrace/core/HandlerRepository.class` — interface referenced directly by `IndyDispatcher`
117+
- `org/openjdk/btrace/core/types/AnyType` (+ inner classes) — `GETSTATIC AnyType.VOID` emitted into instrumented target classes
118+
119+
All other BTrace classes live in the masked sections (agent, client, or shared).
127120

128121
## Build Process
129122

docs/plans/DistributionRestructuring.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Plan: InvokeDynamic Isolation (Distribution Phase 3)
22

3-
**Status:** Not Started
3+
**Status:** Complete
44
**Target:** v3.x (long-term)
55
**Prerequisites:** Masked JAR architecture (completed, see [MaskedJarArchitecture.md](../architecture/MaskedJarArchitecture.md))
66

@@ -43,12 +43,12 @@ btrace-bootstrap-minimal.jar (~50 KB)
4343

4444
## Implementation Outline
4545

46-
1. Create `IndyDispatcher` bootstrap class with `CallSite` factory methods
47-
2. Modify `Instrumentor` to emit `INVOKEDYNAMIC` instead of `INVOKESTATIC` for BTrace runtime calls
48-
3. Move runtime API out of bootstrap into agent-isolated classloader
49-
4. Update `MaskedClassLoader` to serve as the isolated runtime CL
50-
5. Remove bootstrap classes except `IndyDispatcher`
51-
6. Comprehensive testing: all instrumentation tests must pass with new dispatch
46+
1. ~~Create `IndyDispatcher` bootstrap class with `CallSite` factory methods~~ ✓ Done
47+
2. ~~Modify `Instrumentor` to emit `INVOKEDYNAMIC` instead of `INVOKESTATIC` for BTrace runtime calls~~ ✓ Done
48+
3. ~~Move runtime API out of bootstrap into agent-isolated classloader~~ ✓ Done
49+
4. ~~Update `MaskedClassLoader` to serve as the isolated runtime CL~~ ✓ Done (already IS agent CL)
50+
5. ~~Remove bootstrap classes except IndyDispatcher, LinkingFlag, HandlerRepository~~ ✓ Done
51+
6. ~~Comprehensive testing: all instrumentation tests must pass with new dispatch~~ ✓ Done (938 unit tests + BTraceFunctionalTests pass; 5 remaining failures are Docker/JBang infrastructure)
5252

5353
## References
5454

0 commit comments

Comments
 (0)