diff options
| author | Cliff Click <cliffc@acm.org> | 2026-11-11 11:49:04 -0800 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-11-12 13:48:30 -0800 |
| commit | f4bac750504ae2d21068a87b6a6bf4a733476993 (patch) | |
| tree | 644741a31d045d17f9456f07078a2fca2bb21412 /chapter31/src/main/java/com/seaofnodes | |
| parent | a269fa7e8aea51b4fbdd2f2c6c24e84ef26f9ca4 (diff) | |
| download | Simple-f4bac750504ae2d21068a87b6a6bf4a733476993.tar.gz Simple-f4bac750504ae2d21068a87b6a6bf4a733476993.zip | |
First cut graphics
Diffstat (limited to 'chapter31/src/main/java/com/seaofnodes')
| -rw-r--r-- | chapter31/src/main/java/com/seaofnodes/simple/codegen/Serialize.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chapter31/src/main/java/com/seaofnodes/simple/codegen/Serialize.java b/chapter31/src/main/java/com/seaofnodes/simple/codegen/Serialize.java index ae4ecb74..79bebe1f 100644 --- a/chapter31/src/main/java/com/seaofnodes/simple/codegen/Serialize.java +++ b/chapter31/src/main/java/com/seaofnodes/simple/codegen/Serialize.java @@ -417,7 +417,7 @@ public class Serialize { assert elf._clz._name==strs[1/*skip null ptr*/]; for( Type type : types ) if( type instanceof TypeStruct ts ) - Parser.TYPES.put(ts._name,ts); + installType(ts); for( Type type : types ) { if( !(type instanceof TypeStruct ts) || !TypeStruct.startsClzPrefix(ts._name) ) continue; @@ -429,7 +429,7 @@ public class Serialize { elf._pubTypes = new TypeStruct[npubTypes]; for( int i=0; i<npubTypes; i++ ) { TypeStruct ts = elf._pubTypes[i] = (TypeStruct)types[pubTypeIds[i]]; - Parser.TYPES.put(ts._name,ts); + installType(ts); } elf._functions = new FunctionSummary[bais.packed4()]; for( int i = 0; i<elf._functions.length; i++ ) { @@ -444,6 +444,14 @@ public class Serialize { return elf._types = new TypeRead(types,strs,fileAliases,fileFidxs,fileRpcs); } + private static void installType(TypeStruct ts) { + // TYPES names the mutable array declaration. Read-only arrays in + // imported signatures keep their own types, but must not replace that + // declaration: closeOver looks up its mutable variant by name. + if( ts.isAry() ) ts = ts.replace(ts.field("[]").makeFrom(false)); + Parser.TYPES.put(ts._name,ts); + } + static void readAll( CodeGen code, ElfReader elf, GlobalBits aliases, GlobalBits fidxs, GlobalBits rpcs ) { BAOS bais = elf._bais; TypeRead tread = readTypes(code, elf, aliases, fidxs, rpcs); |
