parameters: (typingctx, d, key, hashval)
return_statement: return sig, codegen
docstring: Wrap numba_dict_lookup
  
      Returns 2-tuple of (intp, ?value_type)
docstring_summary: Wrap numba_dict_lookup
docstring_tokens: Wrap numba_dict_lookup
function: def _dict_lookup(typingctx, d, key, hashval):
      """Wrap numba_dict_lookup
  
      Returns 2-tuple of (intp, ?value_type)
      """
      resty = types.Tuple([types.intp, types.Optional(d.value_type)])
      sig = resty(d, key, hashval)
  
      def codegen(context, builder, sig, args):
          fnty = ir.FunctionType(
              ll_ssize_t,
              [ll_dict_type, ll_bytes, ll_hash, ll_bytes],
          )
          [td, tkey, thashval] = sig.args
          [d, key, hashval] = args
          fn = builder.module.get_or_insert_function(fnty,
                                                     name='numba_dict_lookup')
  
          dm_key = context.data_model_manager[tkey]
          dm_val = context.data_model_manager[td.value_type]
  
          data_key = dm_key.as_data(builder, key)
          ptr_key = cgutils.alloca_once_value(builder, data_key)
  
          ll_val = context.get_data_type(td.value_type)
          ptr_val = cgutils.alloca_once(builder, ll_val)
  
          dp = _container_get_data(context, builder, td, d)
          ix = builder.call(
              fn,
              [
                  dp,
                  _as_bytes(builder, ptr_key),
                  hashval,
                  _as_bytes(builder, ptr_val),
              ],
          )
          # Load value if output is available
          found = builder.icmp_signed('>', ix, ix.type(int(DKIX.EMPTY)))
  
          out = context.make_optional_none(builder, td.value_type)
          pout = cgutils.alloca_once_value(builder, out)
  
          with builder.if_then(found):
              val = dm_val.load_from_data_pointer(builder, ptr_val)
              context.nrt.incref(builder, td.value_type, val)
              loaded = context.make_optional_value(builder, td.value_type, val)
              builder.store(loaded, pout)
  
          out = builder.load(pout)
          return context.make_tuple(builder, resty, [ix, out])
  
      return sig, codegen
function_tokens: def _dict_lookup ( typingctx , d , key , hashval ) : resty = types . Tuple ( [ types . intp , types . Optional ( d . value_type ) ] ) sig = resty ( d , key , hashval ) def codegen ( context , builder , sig , args ) : fnty = ir . FunctionType ( ll_ssize_t , [ ll_dict_type , ll_bytes , ll_hash , ll_bytes ] , ) [ td , tkey , thashval ] = sig . args [ d , key , hashval ] = args fn = builder . module . get_or_insert_function ( fnty , name = 'numba_dict_lookup' ) dm_key = context . data_model_manager [ tkey ] dm_val = context . data_model_manager [ td . value_type ] data_key = dm_key . as_data ( builder , key ) ptr_key = cgutils . alloca_once_value ( builder , data_key ) ll_val = context . get_data_type ( td . value_type ) ptr_val = cgutils . alloca_once ( builder , ll_val ) dp = _container_get_data ( context , builder , td , d ) ix = builder . call ( fn , [ dp , _as_bytes ( builder , ptr_key ) , hashval , _as_bytes ( builder , ptr_val ) , ] , ) # Load value if output is available found = builder . icmp_signed ( '>' , ix , ix . type ( int ( DKIX . EMPTY ) ) ) out = context . make_optional_none ( builder , td . value_type ) pout = cgutils . alloca_once_value ( builder , out ) with builder . if_then ( found ) : val = dm_val . load_from_data_pointer ( builder , ptr_val ) context . nrt . incref ( builder , td . value_type , val ) loaded = context . make_optional_value ( builder , td . value_type , val ) builder . store ( loaded , pout ) out = builder . load ( pout ) return context . make_tuple ( builder , resty , [ ix , out ] ) return sig , codegen