From 415b59f4fefb31e6592957e748cbb016b9825f8d Mon Sep 17 00:00:00 2001 From: Jarrett Revels Date: Wed, 18 Apr 2018 16:44:42 -0400 Subject: [PATCH] partially fix InferenceResult cache lookup verification --- base/compiler/inferenceresult.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base/compiler/inferenceresult.jl b/base/compiler/inferenceresult.jl index da363644b7ec1f..25850ccac75a5f 100644 --- a/base/compiler/inferenceresult.jl +++ b/base/compiler/inferenceresult.jl @@ -104,12 +104,16 @@ end function cache_lookup(code::MethodInstance, argtypes::Vector{Any}, cache::Vector{InferenceResult}) method = code.def::Method + nargs = method.nargs::Int for cache_code in cache # try to search cache first cache_args = cache_code.args - if cache_code.linfo === code && length(cache_args) == length(argtypes) + if cache_code.linfo === code && length(cache_args) === nargs cache_match = true - for i in 1:length(argtypes) + # TODO: Figure out easy + correct way to also verify `cache_code.vargs` and + # `cache_args[nargs]` without redundantly computing `vararg_type_vec` and + # `vararg_type` (from `get_argtypes` implementation above) + for i in 1:(nargs - 1) a = argtypes[i] ca = cache_args[i] # verify that all Const argument types match between the call and cache