void TableScanTranslator::ScanConsumer::FilterRowsByVisibility(
    CodeGen &codegen, llvm::Value *tid_start, llvm::Value *tid_end,
    Vector &selection_vector) const {
  // Get the pointer to TransactionRuntime::PerformRead(...)
  auto *txn_perform_read =
      TransactionRuntimeProxy::_PerformVectorizedRead::GetFunction(codegen);

  llvm::Value *txn = translator_.GetCompilationContext().GetTransactionPtr();
  llvm::Value *raw_sel_vec = selection_vector.GetVectorPtr();

  // Invoke the function
  llvm::Value *out_idx =
      codegen.CallFunc(txn_perform_read,
                       {txn, tile_group_ptr_, tid_start, tid_end, raw_sel_vec});
  selection_vector.SetNumElements(out_idx);
}
Beispiel #2
0
// Append the given tuple into the sorter instance
void Sorter::Append(CodeGen &codegen, llvm::Value *sorter_ptr,
                    const std::vector<codegen::Value> &tuple) const {
  // First, call Sorter::StoreInputTuple() to get a handle to a contiguous
  // chunk of free space large enough to materialize a single tuple.
  auto *store_func = SorterProxy::_StoreInputTuple::GetFunction(codegen);
  auto *space = codegen.CallFunc(store_func, {sorter_ptr});

  // Now, individually store the attributes of the tuple into the free space
  UpdateableStorage::NullBitmap null_bitmap{codegen, storage_format_, space};
  for (uint32_t col_id = 0; col_id < tuple.size(); col_id++) {
    if (!null_bitmap.IsNullable(col_id)) {
      storage_format_.SetValueSkipNull(codegen, space, col_id, tuple[col_id]);
    } else {
      storage_format_.SetValue(codegen, space, col_id, tuple[col_id],
                               null_bitmap);
    }
  }
  null_bitmap.WriteBack(codegen);
}
Beispiel #3
0
// Just make a call to util::Sorter::Sort(...). This actually sorts the data
// that has been inserted into the sorter instance.
void Sorter::Sort(CodeGen &codegen, llvm::Value *sorter_ptr) const {
  auto *sort_func = SorterProxy::_Sort::GetFunction(codegen);
  codegen.CallFunc(sort_func, {sorter_ptr});
}
Beispiel #4
0
// Just make a call to util::Sorter::Init(...)
void Sorter::Init(CodeGen &codegen, llvm::Value *sorter_ptr,
                  llvm::Value *comparison_func) const {
  auto *tuple_size = codegen.Const32(storage_format_.GetStorageSize());
  codegen.CallFunc(SorterProxy::_Init::GetFunction(codegen),
                   {sorter_ptr, comparison_func, tuple_size});
}
Beispiel #5
0
// Just make a call to util::Sorter::Destroy(...)
void Sorter::Destroy(CodeGen &codegen, llvm::Value *sorter_ptr) const {
  codegen.CallFunc(SorterProxy::_Destroy::GetFunction(codegen), {sorter_ptr});
}