Skip to content

Commit

Permalink
fix(verifier): correctly pull out edge kinds and cache empty vnames/s…
Browse files Browse the repository at this point in the history
…ymbols (#4769)
  • Loading branch information
zrlk committed Dec 3, 2020
1 parent dd6d7c9 commit 5d627e8
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions kythe/cxx/verifier/souffle_entrysteam_support.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ class KytheEntryStreamReadStream : public souffle::ReadStream {
Note that this is an experimental feature and this declaration may change.
)");
}
empty_symbol_ = symbolTable.unsafeLookup("");
std::array<souffle::RamDomain, 5> fields = {empty_symbol_, empty_symbol_,
empty_symbol_, empty_symbol_,
empty_symbol_};
empty_vname_ = record_table.pack(fields.data(), fields.size());
}

protected:
Expand All @@ -109,10 +114,17 @@ Note that this is an experimental feature and this declaration may change.
souffle::RamDomain vname[kVNameElements];
CopyVName(entry.source(), vname);
tuple[kSourceEntry] = recordTable.pack(vname, kVNameElements);
tuple[kKindEntry] = symbolTable.unsafeLookup(entry.fact_name());
CopyVName(entry.target(), vname);
tuple[kTargetEntry] = recordTable.pack(vname, kVNameElements);
tuple[kValueEntry] = symbolTable.unsafeLookup(entry.fact_value());
if (entry.has_target()) {
tuple[kKindEntry] = symbolTable.unsafeLookup(entry.edge_kind());
CopyVName(entry.target(), vname);
tuple[kTargetEntry] = recordTable.pack(vname, kVNameElements);
tuple[kValueEntry] = empty_symbol_;
} else {
tuple[kKindEntry] = symbolTable.unsafeLookup(entry.fact_name());
tuple[kTargetEntry] = empty_vname_;
tuple[kValueEntry] = symbolTable.unsafeLookup(entry.fact_value());
}

return tuple;
}

Expand All @@ -129,6 +141,10 @@ Note that this is an experimental feature and this declaration may change.
google::protobuf::io::FileInputStream raw_input_;
/// True when the relation we're reading has the expected type.
bool relation_ok_ = false;
/// The empty symbol.
souffle::RamDomain empty_symbol_;
/// An empty VName.
souffle::RamDomain empty_vname_;
};

class KytheEntryStreamReadFactory : public souffle::ReadStreamFactory {
Expand Down

0 comments on commit 5d627e8

Please sign in to comment.