Thanks Attila, I had forgotten cached AST is not just a performance feature.
I uploaded a new webrev. It pretty much follows your suggestions, except I used a slightly different approach to conditional serialization of cachedAst - I left the field transient and serialize it explicitly if it is an instance of SerializedAst, otherwise write out null. I also added a test case for split stored functions. http://cr.openjdk.java.net/~hannesw/8170977/webrev.01/ Hannes > Am 22.12.2016 um 16:48 schrieb Attila Szegedi <szege...@gmail.com>: > > Hm… cachedAst is essential for split functions; specifically if it contains a > SerializedAst, then its "byte[] serializedAst" field is essential. If > cachedAst is lost, we can reparse an unsplit function from source, but we > can’t reparse fragments of split functions. > > I’d suggest instead of making cachedAst transient, we should: > 1. make SerializedAst Serializable, and have SerializedAst.cachedAst within > it transient (reference objects aren’t serializable, and we can afford to > lose it anyway). > 2. introduce RecompilableScriptFunctionData.writeObject and make sure that if > serializedAst contains a reference (instead of a SerializedAst object) then > we don’t attempt to serialize it — write null instead (this can be > accomplished by just setting serializedAst = null, and maybe re-setting it > back to what it was after defaultWriteObject) > 3. make sure there’s a null check on SerializedAst.cachedAst read in > getCachedAst() (as now it can actually be null on deserialization, it was an > invariant that it was never null before) > > Attila. > >> On 22 Dec 2016, at 16:18, Hannes Wallnöfer <hannes.wallnoe...@oracle.com> >> wrote: >> >> Please review: >> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8166187 >> Webrev: http://cr.openjdk.java.net/~hannesw/8166187/webrev/ >> >> It was actually the combination of having a non-serialisable AST reference >> and not initialising the transient fields of nested functions that caused >> this error. >> >> Thanks, >> Hannes >