Replace the stub implementation of invalidation with the proper
implementation. A ReadPathCache is added to each global so that it can
keep tracks of what target are associated to which read paths.
FunctionMetadata was being deserialized every time they were
inspected. This commit introduces a cache structure to prevent this
excessive deserializations.