提交 58eda293 编写于 作者: N Nikos Armenatzoglou

Fix wrong virtual tuple check in codegened slot_getattr

The code that we generate for slot_getattr is not correct.
In particular, to check if a tuple is virtual, we have to implement the code below:
if (TupHasVirtualTuple(slot) && slot->PRIVATE_tts_nvalid >= attnum)

In the codegened slot_getattr, we had not implemented the
second condition, i.e., slot->PRIVATE_tts_nvalid >= attnum.

In this commit, we generate code for the second condition.
上级 eb5a665a
......@@ -250,16 +250,22 @@ bool SlotGetAttrCodegen::GenerateSlotGetAttr(
// -------------------------
irb->SetInsertPoint(virtual_tuple_check_block);
// (slot->PRIVATE_tts_flags & TTS_VIRTUAL) != 0
llvm::Value* llvm_slot_PRIVATE_tts_flags_ptr =
codegen_utils->GetPointerToMember(
llvm_slot, &TupleTableSlot::PRIVATE_tts_flags);
llvm::Value* llvm_tuple_is_virtual = irb->CreateICmpNE(
// (slot->PRIVATE_tts_flags & TTS_VIRTUAL) != 0 (= TupHasVirtualTuple(slot))
llvm::Value* llvm_tuple_is_virtual_1 = irb->CreateICmpNE(
irb->CreateAnd(
irb->CreateLoad(llvm_slot_PRIVATE_tts_flags_ptr),
codegen_utils->GetConstant(TTS_VIRTUAL)),
codegen_utils->GetConstant(0));
// slot->PRIVATE_tts_nvalid >= attnum
llvm::Value* llvm_tuple_is_virtual_2 = irb->
CreateICmpSGE(irb->CreateLoad(llvm_slot_PRIVATE_tts_nvalid_ptr),
llvm_attnum_arg);
// TupHasVirtualTuple(slot) && slot->PRIVATE_tts_nvalid >= attnum
llvm::Value* llvm_tuple_is_virtual = irb->CreateAnd(llvm_tuple_is_virtual_1,
llvm_tuple_is_virtual_2);
// If it is indeed a virtual tuple, we must have already deformed this tuple,
// so go straight to returning the contained values
irb->CreateCondBr(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册