Use slot_getattr wrapper function for regular version.(#1194)

Slot_getattr in header file cause to have different pointer.
This cause issue when we register as external function. LLVM
expect the name of the external function to be unique for
each pointer. In order to fix it, we introduced wrapper function
in codegen_wrapper.cc and use that instead of slot_getattr.
上级 613e9fbb
......@@ -102,6 +102,11 @@ void SetActiveCodeGeneratorManager(void* manager) {
ActiveCodeGeneratorManager = manager;
}
Datum
slot_getattr_regular(TupleTableSlot *slot, int attnum, bool *isnull) {
return slot_getattr(slot, attnum, isnull);
}
void* ExecVariableListCodegenEnroll(
ExecVariableListFn regular_func_ptr,
ExecVariableListFn* ptr_to_chosen_func_ptr,
......
......@@ -123,8 +123,8 @@ bool ExecEvalExprCodegen::GenerateExecEvalExpr(
if (nullptr == slot_getattr_codegen_ ||
false == slot_getattr_codegen_->GenerateCode(codegen_utils)) {
gen_info_.llvm_slot_getattr_func =
codegen_utils->GetOrRegisterExternalFunction(slot_getattr,
"slot_getattr");
codegen_utils->GetOrRegisterExternalFunction(slot_getattr_regular,
"slot_getattr_regular");
} else {
gen_info_.llvm_slot_getattr_func =
slot_getattr_codegen_->GetGeneratedFunction();
......
......@@ -81,13 +81,12 @@ class CodegenManager {
FuncType regular_func_ptr,
FuncType* ptr_to_chosen_func_ptr,
Args&&... args) { // NOLINT(build/c++11)
assert(nullptr != regular_func_ptr);
assert(nullptr != ptr_to_chosen_func_ptr);
assert(nullptr != regular_func_ptr);
assert(nullptr != ptr_to_chosen_func_ptr);
bool can_enroll =
// manager may be NULL if ExecInitNode/ExecProcNode weren't previously
// called. This happens e.g during gpinitsystem.
// called. This happens e.g during gpinitsystem.
(nullptr != manager) &&
codegen && // if codegen guc is false
// if generator is disabled
......
......@@ -104,7 +104,8 @@ class SlotGetAttrCodegen : public BaseCodegen<SlotGetAttrFn> {
SlotGetAttrCodegen(gpcodegen::CodegenManager* manager,
TupleTableSlot* slot,
int max_attr)
: BaseCodegen(manager, kSlotGetAttrPrefix, slot_getattr, &dummy_func_),
: BaseCodegen(
manager, kSlotGetAttrPrefix, slot_getattr_regular, &dummy_func_),
slot_(slot),
max_attr_(max_attr),
llvm_function_(nullptr) {
......
......@@ -685,8 +685,8 @@ bool SlotGetAttrCodegen::GenerateSlotGetAttr(
llvm_error);
codegen_utils->CreateFallback<SlotGetAttrFn>(
codegen_utils->GetOrRegisterExternalFunction(slot_getattr,
"slot_getattr"),
codegen_utils->GetOrRegisterExternalFunction(slot_getattr_regular,
"slot_getattr_regular"),
slot_getattr_func);
return true;
}
......@@ -161,6 +161,12 @@ GetActiveCodeGeneratorManager();
void
SetActiveCodeGeneratorManager(void* manager);
/*
* Wrapper function for slot_getattr.
*/
Datum
slot_getattr_regular(struct TupleTableSlot *slot, int attnum, bool *isnull);
/*
* returns the pointer to the ExecVariableList
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册