OmniSciDB  a47db9e897
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResultSetReductionInterpreterStubs.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "NvidiaKernel.h"
21 #include "ResultSetReductionJIT.h"
22 
23 // Generates wrappers of runtime functions with fixed signature which can be used from the
24 // interpreter.
26  public:
27  // output_handle is ReductionInterpreter::EvalValue*, inputs_handle is a
28  // std::vector<ReductionInterpreter::EvalValue>*.
29  using Stub = ReductionInterpreter::EvalValue (*)(void* output_handle,
30  const void* inputs_handle);
31  using InputsType = std::vector<ReductionInterpreter::EvalValue>;
32 
33  static Stub generateStub(const std::string& name,
34  const std::vector<Type>& arg_types,
35  const Type ret_type,
36  const bool is_external);
37 
38  static void clearCache();
39 
40  private:
41  // Cache of the stubs. Keys are the runtime function names.
43  static std::mutex s_stubs_cache_mutex;
44 };
45 
46 bool is_integer_type(const Type type);
47 bool is_pointer_type(const Type type);
std::vector< ReductionInterpreter::EvalValue > InputsType
static std::mutex s_stubs_cache_mutex
static Stub generateStub(const std::string &name, const std::vector< Type > &arg_types, const Type ret_type, const bool is_external)
ReductionInterpreter::EvalValue(*)(void *output_handle, const void *inputs_handle) Stub
bool is_pointer_type(const Type type)
bool is_integer_type(const Type type)