diff options
| author | Cliff Click <cliffc@acm.org> | 2026-10-26 18:42:59 -0700 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2026-10-26 18:42:59 -0700 |
| commit | f78d97c60047627164012fb10053c75ccf0ca7dd (patch) | |
| tree | 68aa886cba99ec342f6518b5bf69fe6cab158b90 | |
| parent | b3ec548422f6ec63f40e17cdca72f86927aa4f4e (diff) | |
| download | Simple-f78d97c60047627164012fb10053c75ccf0ca7dd.tar.gz Simple-f78d97c60047627164012fb10053c75ccf0ca7dd.zip | |
Child class call parents <clinit>main
| -rw-r--r-- | chapter28b/src/main/java/com/seaofnodes/simple/Parser.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java b/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java index 9df7fd18..b9cd9658 100644 --- a/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java +++ b/chapter28b/src/main/java/com/seaofnodes/simple/Parser.java @@ -305,9 +305,18 @@ public class Parser { } } - // The initializer owns its run-once flag store. Parent initialization - // is a structural requirement, executed before this body by CLInit lowering. + // Each initializer establishes its parent before setting its own + // run-once flag. Keep this in the body so every execution strategy + // shares the same ordering, including direct entry into a child. if( fun.isClz() ) { + if( _ref._par!=null ) { + String pname = addClzPrefix(_ref._par._cname); + TypeStruct parent = (TypeStruct)TYPES.get(pname); + if( parent==null ) parent=TypeStruct.make(pname,true); + Node ptr = con(TypeMemPtr.make((byte)2,parent,true)).keep(); + classInit(loc,ptr); + ptr.unkeep(); + } Node self = fun.parm(2); Field flag = ((TypeMemPtr)self._type)._obj.field("$init"); Node prior = mem().keep(); |
