Skip to content

perf: slim embedded JDK metadata and gate full JDK bytecode bundle behind javajive_full_jdk (v0.8.2) - #34

Merged
VillanCh merged 1 commit into
mainfrom
perf/slim-jdk-assets-buildtag
Nov 20, 2026
Merged

VillanCh merged 1 commit into
mainfrom
perf/slim-jdk-assets-buildtag

Conversation

@VillanCh

Copy link
Copy Markdown
Contributor

Summary

Reduces JavaJive's default embedded asset footprint from 8.55 MiB → 132 KiB (-8.42 MiB raw & zip 1:1 savings for downstream consumers such as yaklang):

  1. Strip runtime-unused provenance hashes from jdk_metadata_catalog.json.zst (891 KiB → 132 KiB, -759 KiB)
    • tools/compressjdk now projects only runtime fields (schema, release, classes, throwable_hierarchy, reference_hierarchy) into jdk_metadata_catalog.json.zst.
    • All 6 JDK profiles (8/9/11/16/17/21) remain 100% intact with zero functional loss; offline provenance hashes stay in jdk_metadata_catalog.json as the reviewed source of truth and are verified by tests.
  2. Gate the 7.7 MiB jdk_constructor_code.bundle.zst behind -tags javajive_full_jdk
    • Default builds (!javajive_full_jdk) omit jdk_constructor_code.bundle.zst (0 bytes embedded), keeping HasEmbeddedJDKConstructorBundle() == false while retaining the full ~132 KiB JDK invocation/hierarchy catalog and explicit declaration resolvers.
    • Opt-in builds (-tags javajive_full_jdk) embed the full 7.7 MiB constructor bytecode bundle (HasEmbeddedJDKConstructorBundle() == true) for strict offline javac round-trip proofs.
    • Documented in README.md, README.zh-CN.md, and classparser/jdk_metadata_catalog.md.
  3. Version & CI
    • Bumped javajive.Version to 0.8.2 and exported javajive.HasEmbeddedJDKConstructorBundle().
    • Updated CI workflow to verify both default slim builds and -tags javajive_full_jdk builds & bundle integrity tests.

Verification

  • CGO_ENABLED=0 go build ./cmd/javajive: 21 MiB (default) vs 29 MiB (-tags javajive_full_jdk)
  • go run ./tools/requiredci -check / -run contract / -run corpus: PASS
  • go test -tags javajive_full_jdk ./classparser -run '^(TestJDKCompressedCatalogMatchesSource|TestJDKCompressedConstructorCodeMatchesSource|TestAdversarialPlatformConstructorCodeIdentityAndEffectProof|TestAdversarialPlatformIndexedDeclarationsRetainOriginalBytecode)$': PASS

@VillanCh
VillanCh merged commit 3b0b545 into main Nov 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant