[code-reflection] RFR: [hat] Enable padding in the codegen as an option for the iFace types and Schemas
Juan Fumero
jfumero at openjdk.org
Wed Aug 27 13:18:45 UTC 2025
This PR extends the C99 code generator to allow the generation of padding if this option is specified in the Hat Data Type Schema.
For instance:
Schema<F32Array> schema = Schema.of(F32Array.class, f32Array->f32Array
.arrayLen("length").pad(12).array("array"));
Generates this C99 struct:
typedef struct F32Array_s{
int length;
char pad$ZArmN[12]; // pad$ + 5 random letter to avoid accidental collision with other members of the buffer type
float array[1];
}F32Array_t;
This change is required to enable efficient local memory: See https://github.com/openjdk/babylon/pull/531
-------------
Commit messages:
- [hat] Disable padding for F32Array
- [hat] Enable padding for iFace schemas in the C99 codegen
Changes: https://git.openjdk.org/babylon/pull/534/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=534&range=00
Stats: 29 lines in 2 files changed: 27 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/babylon/pull/534.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/534/head:pull/534
PR: https://git.openjdk.org/babylon/pull/534
More information about the babylon-dev
mailing list