Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
697ffc1a
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
697ffc1a
编写于
8月 03, 2016
作者:
S
Shreedhar Hardikar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix cpplint errors
上级
d0ef76db
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
16 deletion
+32
-16
src/backend/codegen/codegen_wrapper.cc
src/backend/codegen/codegen_wrapper.cc
+4
-1
src/backend/codegen/exec_eval_expr_codegen.cc
src/backend/codegen/exec_eval_expr_codegen.cc
+2
-1
src/backend/codegen/exec_variable_list_codegen.cc
src/backend/codegen/exec_variable_list_codegen.cc
+2
-1
src/backend/codegen/include/codegen/slot_getattr_codegen.h
src/backend/codegen/include/codegen/slot_getattr_codegen.h
+6
-4
src/backend/codegen/slot_getattr_codegen.cc
src/backend/codegen/slot_getattr_codegen.cc
+12
-6
src/backend/codegen/tests/codegen_framework_unittest.cc
src/backend/codegen/tests/codegen_framework_unittest.cc
+6
-3
未找到文件。
src/backend/codegen/codegen_wrapper.cc
浏览文件 @
697ffc1a
...
...
@@ -130,7 +130,10 @@ ClassType* CodegenEnroll(FuncType regular_func_ptr,
}
ClassType
*
generator
=
new
ClassType
(
manager
,
regular_func_ptr
,
ptr_to_chosen_func_ptr
,
std
::
forward
<
Args
>
(
args
)...);
manager
,
regular_func_ptr
,
ptr_to_chosen_func_ptr
,
std
::
forward
<
Args
>
(
args
)...);
bool
is_enrolled
=
manager
->
EnrollCodeGenerator
(
CodegenFuncLifespan_Parameter_Invariant
,
generator
);
assert
(
is_enrolled
);
...
...
src/backend/codegen/exec_eval_expr_codegen.cc
浏览文件 @
697ffc1a
...
...
@@ -126,7 +126,8 @@ bool ExecEvalExprCodegen::GenerateExecEvalExpr(
"slot_getattr"
);
}
else
{
slot_getattr_codegen_
->
GenerateCode
(
codegen_utils
);
gen_info_
.
llvm_slot_getattr_func
=
slot_getattr_codegen_
->
GetGeneratedFunction
();
gen_info_
.
llvm_slot_getattr_func
=
slot_getattr_codegen_
->
GetGeneratedFunction
();
}
llvm
::
Function
*
exec_eval_expr_func
=
CreateFunction
<
ExecEvalExprFn
>
(
...
...
src/backend/codegen/exec_variable_list_codegen.cc
浏览文件 @
697ffc1a
...
...
@@ -148,7 +148,8 @@ bool ExecVariableListCodegen::GenerateExecVariableList(
// Generate slot_getattr for attributes all the way to max_attr
assert
(
nullptr
!=
slot_getattr_codegen_
);
slot_getattr_codegen_
->
GenerateCode
(
codegen_utils
);
llvm
::
Function
*
slot_getattr_func
=
slot_getattr_codegen_
->
GetGeneratedFunction
();
llvm
::
Function
*
slot_getattr_func
=
slot_getattr_codegen_
->
GetGeneratedFunction
();
// In case the above generation failed, no point in continuing since that was
// the most crucial part of ExecVariableList code generation.
...
...
src/backend/codegen/include/codegen/slot_getattr_codegen.h
浏览文件 @
697ffc1a
...
...
@@ -148,7 +148,8 @@ class SlotGetAttrCodegen : public BaseCodegen<SlotGetAttrFn> {
int
max_attr_
;
// Primary function to be generated and populated
llvm
::
Function
*
llvm_function_
;
// A dummy function pointer that can be swapped by the BaseCodegen implementation
// A dummy function pointer that can be swapped by the BaseCodegen
// implementation
SlotGetAttrFn
dummy_func_
;
static
constexpr
char
kSlotGetAttrPrefix
[]
=
"slot_getattr"
;
...
...
@@ -165,9 +166,10 @@ class SlotGetAttrCodegen : public BaseCodegen<SlotGetAttrFn> {
*
* Map of the form: { manager -> { slot -> slot_getattr_codegen } }
*/
typedef
std
::
unordered_map
<
TupleTableSlot
*
,
SlotGetAttrCodegen
*>
SlotGetAttrCodegenCache
;
static
std
::
unordered_map
<
gpcodegen
::
CodegenManager
*
,
SlotGetAttrCodegenCache
>
codegen_cache_by_manager
;
typedef
std
::
unordered_map
<
TupleTableSlot
*
,
SlotGetAttrCodegen
*>
SlotGetAttrCodegenCache
;
static
std
::
unordered_map
<
gpcodegen
::
CodegenManager
*
,
SlotGetAttrCodegenCache
>
codegen_cache_by_manager
;
};
/** @} */
...
...
src/backend/codegen/slot_getattr_codegen.cc
浏览文件 @
697ffc1a
...
...
@@ -56,8 +56,9 @@ constexpr char SlotGetAttrCodegen::kSlotGetAttrPrefix[];
// attributes is varlen.
extern
const
int
codegen_varlen_tolerance
;
std
::
unordered_map
<
gpcodegen
::
CodegenManager
*
,
SlotGetAttrCodegen
::
SlotGetAttrCodegenCache
>
SlotGetAttrCodegen
::
codegen_cache_by_manager
;
std
::
unordered_map
<
gpcodegen
::
CodegenManager
*
,
SlotGetAttrCodegen
::
SlotGetAttrCodegenCache
>
SlotGetAttrCodegen
::
codegen_cache_by_manager
;
SlotGetAttrCodegen
*
SlotGetAttrCodegen
::
GetCodegenInstance
(
gpcodegen
::
CodegenManager
*
manager
,
...
...
@@ -88,7 +89,9 @@ SlotGetAttrCodegen* SlotGetAttrCodegen::GetCodegenInstance(
void
SlotGetAttrCodegen
::
RemoveSelfFromCache
()
{
CodegenManager
*
manager
=
this
->
manager
();
assert
(
manager
!=
nullptr
&&
codegen_cache_by_manager
.
find
(
manager
)
!=
codegen_cache_by_manager
.
end
());
assert
(
manager
!=
nullptr
&&
codegen_cache_by_manager
.
find
(
manager
)
!=
codegen_cache_by_manager
.
end
());
std
::
unordered_map
<
TupleTableSlot
*
,
SlotGetAttrCodegen
*>&
cache_map
=
codegen_cache_by_manager
[
manager
];
auto
it
=
codegen_cache_by_manager
[
manager
].
find
(
slot_
);
...
...
@@ -110,7 +113,8 @@ SlotGetAttrCodegen::~SlotGetAttrCodegen() {
bool
SlotGetAttrCodegen
::
GenerateCodeInternal
(
gpcodegen
::
GpCodegenUtils
*
codegen_utils
)
{
// This function may be called multiple times, but it should generate code only once
// This function may be called multiple times, but it should generate code
// only once
if
(
IsGenerated
())
{
return
true
;
}
...
...
@@ -119,9 +123,11 @@ bool SlotGetAttrCodegen::GenerateCodeInternal(
std
::
string
function_name
=
GetUniqueFuncName
()
+
"_"
+
std
::
to_string
(
reinterpret_cast
<
uint64_t
>
(
slot_
))
+
"_"
+
std
::
to_string
(
max_attr_
);
llvm
::
Function
*
function
=
CreateFunction
<
SlotGetAttrFn
>
(
codegen_utils
,
function_name
);
llvm
::
Function
*
function
=
CreateFunction
<
SlotGetAttrFn
>
(
codegen_utils
,
function_name
);
bool
isGenerated
=
GenerateSlotGetAttr
(
codegen_utils
,
slot_
,
max_attr_
,
function
);
bool
isGenerated
=
GenerateSlotGetAttr
(
codegen_utils
,
slot_
,
max_attr_
,
function
);
if
(
isGenerated
)
{
elog
(
DEBUG1
,
"slot_getattr was generated successfully!"
);
...
...
src/backend/codegen/tests/codegen_framework_unittest.cc
浏览文件 @
697ffc1a
...
...
@@ -342,7 +342,8 @@ class CodegenManagerTest : public ::testing::Test {
template
<
typename
ClassType
,
typename
FuncType
>
void
EnrollCodegen
(
FuncType
reg_func
,
FuncType
*
ptr_to_chosen_func
)
{
ClassType
*
code_gen
=
new
ClassType
(
manager_
.
get
(),
reg_func
,
ptr_to_chosen_func
);
ClassType
*
code_gen
=
new
ClassType
(
manager_
.
get
(),
reg_func
,
ptr_to_chosen_func
);
ASSERT_TRUE
(
reg_func
==
*
ptr_to_chosen_func
);
ASSERT_TRUE
(
manager_
->
EnrollCodeGenerator
(
CodegenFuncLifespan_Parameter_Invariant
,
...
...
@@ -355,12 +356,14 @@ class CodegenManagerTest : public ::testing::Test {
const
std
::
vector
<
CppType
>&
values
)
{
DatumCastFn
<
Datum
,
CppType
>
CppToDatumCgFn
=
CppToDatumReg
;
CppToDatumCastGenerator
<
CppType
>*
cpp_datum_gen
=
new
CppToDatumCastGenerator
<
CppType
>
(
manager_
.
get
(),
CppToDatumReg
,
&
CppToDatumCgFn
);
new
CppToDatumCastGenerator
<
CppType
>
(
manager_
.
get
(),
CppToDatumReg
,
&
CppToDatumCgFn
);
DatumCastFn
<
CppType
,
Datum
>
DatumToCppCgFn
=
DatumToCppReg
;
DatumToCppCastGenerator
<
CppType
>*
datum_cpp_gen
=
new
DatumToCppCastGenerator
<
CppType
>
(
manager_
.
get
(),
DatumToCppReg
,
&
DatumToCppCgFn
);
new
DatumToCppCastGenerator
<
CppType
>
(
manager_
.
get
(),
DatumToCppReg
,
&
DatumToCppCgFn
);
ASSERT_TRUE
(
manager_
->
EnrollCodeGenerator
(
CodegenFuncLifespan_Parameter_Invariant
,
cpp_datum_gen
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录