Skip to content

Use ISO-8859-1 for glue bytecode packing - #124

Merged
mcculls merged 1 commit into
mainfrom
ygree/simplify-glue-encoding
Sep 28, 2026
Merged

mcculls merged 1 commit into
mainfrom
ygree/simplify-glue-encoding

Conversation

@ygree

@ygree ygree commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

This removes the padding requirement, avoids the pseudo-UTF-16BE/custom-decoding concern, and slightly reduces the compiled runtime footprint, even though the generated Java source gets larger.

Motivation

ISO-8859-1 gives a direct byte-to-char mapping, so glue decoding becomes a simple packed.getBytes(ISO_8859_1) with no even-length padding requirement and no surrogate edge cases.

Additional Notes

The source gets larger:
Raw generated DefineClassGlue.java is larger: 12,278 B -> 17,268 B.

Everything that is compiled or packaged got smaller:
ClassInjector$MethodPatch.class: 8,031 B -> 7,749 B
class-inject runtime jar: 8,836 B -> 7,894 B
utils jar: 31,030 B -> 30,914 B
even compressed class-inject sources jar got smaller: 7,007 B -> 6,248 B, because octal escapes compress well.

One caveat: on Java 8, the in-memory String object for the packed glue may be larger with Latin-1 because Java 8 stores strings as char[], so twice as many chars means roughly twice the string backing storage. On Java 9+ compact strings likely make it similar or smaller. But this is a tiny, transient-ish class-injection path, while the shipped class/jar footprint is smaller.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@ygree ygree self-assigned this Sep 26, 2026
@ygree
ygree requested a review from a team as a code owner September 26, 2026 01:14
@ygree
ygree requested review from jandro996 and removed request for a team September 26, 2026 01:14
@mcculls
mcculls requested review from mcculls and removed request for jandro996 September 26, 2026 08:07

@mcculls mcculls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, for the glue we're generating this does indeed make more sense

@ygree
ygree force-pushed the ygree/simplify-glue-encoding branch from c07f1ab to b39c68f Compare September 28, 2026 16:16
@mcculls
mcculls merged commit 0c59b9e into main Sep 28, 2026
6 checks passed
@mcculls
mcculls deleted the ygree/simplify-glue-encoding branch September 28, 2026 16:36
@github-actions github-actions Bot added this to the 0.1.0 milestone Sep 28, 2026
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.

2 participants