invalidate

fun invalidate(reason: L2Chunk.InvalidationReason)

Something that this L2Chunk depended on has changed. This must have been because it was optimized in a way that relied on some aspect of the available definitions (e.g., monomorphic inlining), so we need to invalidate the chunk now, so that an attempt to invoke it or return into it will be detected and converted into using the unoptimizedChunk. Also remove this chunk from the contingent set of each object on which it was depending.

This can only happen when L2 execution is suspended, due to a method changing (TODOMvG - we'll have to consider dependent nearly-constant variables changing at some point). The invalidationLock must be acquired by the caller to ensure safe manipulation of the dependency information.

Note that all we do here is clear the valid flag and update the dependency information. It's up to any re-entry points within this optimized code to determine that invalidation has happened, using the default chunk.

Parameters

reason

The InvalidationReason that indicates why this invalidation is happening.