summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sbe/vm
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@mongodb.com>2023-02-03 18:09:28 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-03 19:52:33 +0000
commit56616080c12298229fc6e3cc71ace4c85ac973f4 (patch)
tree2eec3256ce8903a95085ee65dd7e5a0894cd739b /src/mongo/db/exec/sbe/vm
parentd5e1315e25a60019434fa2379a2168c29b5cd93a (diff)
downloadmongo-56616080c12298229fc6e3cc71ace4c85ac973f4.tar.gz
SERVER-71798 Expand the set of queries eligible for SBE in the 6.3 release
Diffstat (limited to 'src/mongo/db/exec/sbe/vm')
-rw-r--r--src/mongo/db/exec/sbe/vm/vm.cpp42
-rw-r--r--src/mongo/db/exec/sbe/vm/vm.h6
-rw-r--r--src/mongo/db/exec/sbe/vm/vm_printer.cpp36
3 files changed, 0 insertions, 84 deletions
diff --git a/src/mongo/db/exec/sbe/vm/vm.cpp b/src/mongo/db/exec/sbe/vm/vm.cpp
index 3a8e48daf0a..35dab757964 100644
--- a/src/mongo/db/exec/sbe/vm/vm.cpp
+++ b/src/mongo/db/exec/sbe/vm/vm.cpp
@@ -166,7 +166,6 @@ int Instruction::stackOffset[Instruction::Tags::lastInstruction] = {
-1, // fail
- 0, // applyClassicMatcher
0, // dateTruncImm
};
@@ -482,18 +481,6 @@ void CodeFragment::appendNumericConvert(value::TypeTags targetTag) {
adjustStackSimple(i);
}
-void CodeFragment::appendApplyClassicMatcher(const MatchExpression* matcher) {
- Instruction i;
- i.tag = Instruction::applyClassicMatcher;
-
- auto offset = allocateSpace(sizeof(Instruction) + sizeof(matcher));
-
- offset += writeToMemory(offset, i);
- offset += writeToMemory(offset, matcher);
-
- adjustStackSimple(i);
-}
-
void CodeFragment::appendSub(Instruction::Parameter lhs, Instruction::Parameter rhs) {
appendSimpleInstruction(Instruction::sub, lhs, rhs);
}
@@ -5750,28 +5737,6 @@ MONGO_COMPILER_NORETURN void ByteCode::runFailInstruction() {
uasserted(code, message);
}
-
-void ByteCode::runClassicMatcher(const MatchExpression* matcher) {
- auto [ownedObj, tagObj, valObj] = getFromStack(0);
-
- BSONObj bsonObjForMatching;
- if (tagObj == value::TypeTags::Object) {
- BSONObjBuilder builder;
- sbe::bson::convertToBsonObj(builder, sbe::value::getObjectView(valObj));
- bsonObjForMatching = builder.obj();
- } else if (tagObj == value::TypeTags::bsonObject) {
- auto bson = value::getRawPointerView(valObj);
- bsonObjForMatching = BSONObj(bson);
- } else {
- MONGO_UNREACHABLE_TASSERT(6681402);
- }
-
- bool res = matcher->matchesBSON(bsonObjForMatching);
- if (ownedObj) {
- value::releaseValue(tagObj, valObj);
- }
- topStack(false, value::TypeTags::Boolean, value::bitcastFrom<bool>(res));
-}
template <typename T>
void ByteCode::runTagCheck(const uint8_t*& pcPointer, T&& predicate) {
auto [popParam, offsetParam] = decodeParam(pcPointer);
@@ -6782,13 +6747,6 @@ void ByteCode::runInternal(const CodeFragment* code, int64_t position) {
runFailInstruction();
break;
}
- case Instruction::applyClassicMatcher: {
- const auto* matcher = readFromMemory<const MatchExpression*>(pcPointer);
- pcPointer += sizeof(matcher);
-
- runClassicMatcher(matcher);
- break;
- }
case Instruction::dateTruncImm: {
auto unit = readFromMemory<TimeUnit>(pcPointer);
pcPointer += sizeof(unit);
diff --git a/src/mongo/db/exec/sbe/vm/vm.h b/src/mongo/db/exec/sbe/vm/vm.h
index b6ee6d2dc75..7034e1fabfe 100644
--- a/src/mongo/db/exec/sbe/vm/vm.h
+++ b/src/mongo/db/exec/sbe/vm/vm.h
@@ -349,8 +349,6 @@ struct Instruction {
fail,
- applyClassicMatcher, // Instruction which calls into the classic engine MatchExpression.
-
dateTruncImm,
lastInstruction // this is just a marker used to calculate number of instructions
@@ -577,8 +575,6 @@ struct Instruction {
return "allocStack";
case fail:
return "fail";
- case applyClassicMatcher:
- return "applyClassicMatcher";
case dateTruncImm:
return "dateTruncImm";
default:
@@ -890,7 +886,6 @@ public:
void appendAllocStack(uint32_t size);
void appendFail();
void appendNumericConvert(value::TypeTags targetTag);
- void appendApplyClassicMatcher(const MatchExpression*);
// For printing from an interactive debugger.
std::string toString() const;
@@ -999,7 +994,6 @@ private:
void runLambdaInternal(const CodeFragment* code, int64_t position);
MONGO_COMPILER_NORETURN void runFailInstruction();
- void runClassicMatcher(const MatchExpression* matcher);
template <typename T>
void runTagCheck(const uint8_t*& pcPointer, T&& predicate);
diff --git a/src/mongo/db/exec/sbe/vm/vm_printer.cpp b/src/mongo/db/exec/sbe/vm/vm_printer.cpp
index 8ac6fe532c2..85c59dc9957 100644
--- a/src/mongo/db/exec/sbe/vm/vm_printer.cpp
+++ b/src/mongo/db/exec/sbe/vm/vm_printer.cpp
@@ -49,10 +49,6 @@ struct CodeFragmentFormatter<CodeFragmentPrinter::PrintFormat::Debug> {
return SlotAccessorFmt{accessor};
}
- auto matchExpression(const MatchExpression* matcher) {
- return MatchExpressionFmt{matcher};
- }
-
struct PcPointerFmt {
const uint8_t* pcPointer;
};
@@ -60,10 +56,6 @@ struct CodeFragmentFormatter<CodeFragmentPrinter::PrintFormat::Debug> {
struct SlotAccessorFmt {
value::SlotAccessor* accessor;
};
-
- struct MatchExpressionFmt {
- const MatchExpression* matcher;
- };
};
template <typename charT, typename traits>
@@ -80,13 +72,6 @@ std::basic_ostream<charT, traits>& operator<<(
return os << static_cast<const void*>(a.accessor);
}
-template <typename charT, typename traits>
-std::basic_ostream<charT, traits>& operator<<(
- std::basic_ostream<charT, traits>& os,
- const CodeFragmentFormatter<CodeFragmentPrinter::PrintFormat::Debug>::MatchExpressionFmt& a) {
- return os << static_cast<const void*>(a.matcher);
-}
-
template <>
struct CodeFragmentFormatter<CodeFragmentPrinter::PrintFormat::Stable> {
CodeFragmentFormatter(const CodeFragment& code) : code(code) {}
@@ -99,10 +84,6 @@ struct CodeFragmentFormatter<CodeFragmentPrinter::PrintFormat::Stable> {
return SlotAccessorFmt{accessor};
}
- auto matchExpression(const MatchExpression* matcher) {
- return MatchExpressionFmt{matcher};
- }
-
struct PcPointerFmt {
const uint8_t* pcPointer;
const uint8_t* pcBegin;
@@ -112,10 +93,6 @@ struct CodeFragmentFormatter<CodeFragmentPrinter::PrintFormat::Stable> {
value::SlotAccessor* accessor;
};
- struct MatchExpressionFmt {
- const MatchExpression* matcher;
- };
-
const CodeFragment& code;
};
@@ -137,13 +114,6 @@ std::basic_ostream<charT, traits>& operator<<(
return os << "<accessor>";
}
-template <typename charT, typename traits>
-std::basic_ostream<charT, traits>& operator<<(
- std::basic_ostream<charT, traits>& os,
- const CodeFragmentFormatter<CodeFragmentPrinter::PrintFormat::Stable>::MatchExpressionFmt& a) {
- return os << "<matchExpression>";
-}
-
template <typename Formatter>
class CodeFragmentPrinterImpl {
public:
@@ -328,12 +298,6 @@ public:
os << "accessor: " << _formatter.slotAccessor(accessor);
break;
}
- case Instruction::applyClassicMatcher: {
- const auto* matcher = readFromMemory<const MatchExpression*>(pcPointer);
- pcPointer += sizeof(matcher);
- os << "matcher: " << _formatter.matchExpression(matcher);
- break;
- }
case Instruction::numConvert: {
auto tag = readFromMemory<value::TypeTags>(pcPointer);
pcPointer += sizeof(tag);