[code-reflection] RFR: Adjusted tests to use execution of a method and implementation of the execution model cache

Adam Sotona asotona at openjdk.org
Fri Feb 28 07:55:06 UTC 2025


On Thu, 27 Feb 2025 19:17:00 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> Adjusted tests to use execution of a method and implementation of the execution model cache.
>
> cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxRuntime.java line 60:
> 
>> 58:     record CachedModel(byte[] protoModel, int[] operandsMapping) {}
>> 59: 
>> 60:     private static final WeakHashMap<Class<?>, CachedModel> MODEL_CACHE = WeakHashMap.newWeakHashMap(10);
> 
> Using `ClassValue` is another option.

Unfortunately `ClassValue` does not support computation if absent (if more than just the bare class is needed). Maybe if compute returns null and the cached value is added later...?

-------------

PR Review Comment: https://git.openjdk.org/babylon/pull/331#discussion_r1974959775


More information about the babylon-dev mailing list