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

Reply via email to