[code-reflection] Integrated: [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:51:05 UTC 2025


On Wed, 27 Aug 2025 13:10:25 GMT, Juan Fumero <jfumero at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: cad3fdf3
Author:    Juan Fumero <jfumero at openjdk.org>
Committer: Gary Frost <gfrost at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/cad3fdf3d76bee4d6e9f34f66cce5b6524fd6c16
Stats:     29 lines in 2 files changed: 27 ins; 0 del; 2 mod

[hat] Enable padding in the codegen as an option for the iFace types and Schemas

-------------

PR: https://git.openjdk.org/babylon/pull/534


More information about the babylon-dev mailing list