Skip to content

Commit 595285a

Browse files
Merge pull request #10690 from adrian-prantl/less-signposts
[LLDB] Remove high-firing scoped timers from the Swift plugin
2 parents 0062dc6 + 3d2f03a commit 595285a

9 files changed

+2
-123
lines changed

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ class LLDBExprNameLookup : public LLDBNameLookup {
239239
bool lookupAdditions(swift::DeclBaseName Name, swift::DeclContext *DC,
240240
swift::SourceLoc Loc, bool IsTypeLookup,
241241
ResultVector &RV) override {
242-
LLDB_SCOPED_TIMER();
243242
assert(SwiftASTContext::GetSwiftASTContext(&DC->getASTContext()) ==
244243
m_this_context);
245244
static unsigned counter = 0;
@@ -402,8 +401,6 @@ class LLDBREPLNameLookup : public LLDBNameLookup {
402401
bool lookupAdditions(swift::DeclBaseName Name, swift::DeclContext *DC,
403402
swift::SourceLoc Loc, bool IsTypeLookup,
404403
ResultVector &RV) override {
405-
LLDB_SCOPED_TIMER();
406-
407404
assert(SwiftASTContext::GetSwiftASTContext(&DC->getASTContext()) ==
408405
m_this_context);
409406
static unsigned counter = 0;
@@ -462,7 +459,6 @@ class LLDBREPLNameLookup : public LLDBNameLookup {
462459
static CompilerType GetSwiftTypeForVariableValueObject(
463460
lldb::ValueObjectSP valobj_sp, lldb::StackFrameSP &stack_frame_sp,
464461
SwiftLanguageRuntime *runtime, lldb::BindGenericTypes bind_generic_types) {
465-
LLDB_SCOPED_TIMER();
466462
// Check that the passed ValueObject is valid.
467463
if (!valobj_sp || valobj_sp->GetError().Fail())
468464
return {};
@@ -490,7 +486,6 @@ CompilerType SwiftExpressionParser::ResolveVariable(
490486
lldb::VariableSP variable_sp, lldb::StackFrameSP &stack_frame_sp,
491487
SwiftLanguageRuntime *runtime, lldb::DynamicValueType use_dynamic,
492488
lldb::BindGenericTypes bind_generic_types) {
493-
LLDB_SCOPED_TIMER();
494489
lldb::ValueObjectSP valobj_sp =
495490
stack_frame_sp->GetValueObjectForFrameVariable(variable_sp,
496491
lldb::eNoDynamicValues);
@@ -555,8 +550,6 @@ AddRequiredAliases(Block *block, lldb::StackFrameSP &stack_frame_sp,
555550
SwiftASTManipulator &manipulator,
556551
lldb::DynamicValueType use_dynamic,
557552
lldb::BindGenericTypes bind_generic_types) {
558-
LLDB_SCOPED_TIMER();
559-
560553
// Alias builtin types, since we can't use them directly in source code.
561554
auto builtin_ptr_t = swift_ast_context.GetBuiltinRawPointerType();
562555
auto alias = manipulator.MakeTypealias(
@@ -737,8 +730,6 @@ static void ResolveSpecialNames(
737730
llvm::SmallVectorImpl<swift::Identifier> &special_names,
738731
llvm::SmallVectorImpl<SwiftASTManipulator::VariableInfo> &local_variables) {
739732
Log *log = GetLog(LLDBLog::Expressions);
740-
LLDB_SCOPED_TIMER();
741-
742733
if (!sc.target_sp)
743734
return;
744735

@@ -939,7 +930,6 @@ MaterializeVariable(SwiftASTManipulatorBase::VariableInfo &variable,
939930
lldb::StackFrameWP &stack_frame_wp,
940931
DiagnosticManager &diagnostic_manager, Log *log,
941932
bool repl) {
942-
LLDB_SCOPED_TIMER();
943933
uint64_t offset = 0;
944934
bool needs_init = false;
945935

@@ -1283,9 +1273,6 @@ SwiftExpressionParser::ParseAndImport(
12831273
SwiftExpressionParser::SILVariableMap &variable_map, unsigned &buffer_id,
12841274
DiagnosticManager &diagnostic_manager) {
12851275
Log *log = GetLog(LLDBLog::Expressions);
1286-
LLDB_SCOPED_TIMER();
1287-
1288-
12891276
bool repl = m_options.GetREPLEnabled();
12901277
bool playground = m_options.GetPlaygroundTransformEnabled();
12911278
// If we are using the playground, hand import the necessary
@@ -1747,8 +1734,6 @@ SwiftExpressionParser::Parse(DiagnosticManager &diagnostic_manager,
17471734
SwiftExpressionParser::SILVariableMap variable_map;
17481735
using ParseResult = SwiftExpressionParser::ParseResult;
17491736
Log *log = GetLog(LLDBLog::Expressions);
1750-
LLDB_SCOPED_TIMER();
1751-
17521737
// Get a scoped diagnostics consumer for all diagnostics produced by
17531738
// this expression.
17541739
auto expr_diagnostics = m_swift_ast_ctx.getScopedDiagnosticConsumer();
@@ -2228,7 +2213,6 @@ SwiftExpressionParser::Parse(DiagnosticManager &diagnostic_manager,
22282213
static bool FindFunctionInModule(ConstString &mangled_name,
22292214
llvm::Module *module, const char *orig_name,
22302215
bool exact) {
2231-
LLDB_SCOPED_TIMER();
22322216
swift::Demangle::Context demangle_ctx;
22332217
for (llvm::Module::iterator fi = module->getFunctionList().begin(),
22342218
fe = module->getFunctionList().end();
@@ -2282,7 +2266,6 @@ Status SwiftExpressionParser::DoPrepareForExecution(
22822266
lldb::addr_t &func_addr, lldb::addr_t &func_end,
22832267
lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx,
22842268
bool &can_interpret, ExecutionPolicy execution_policy) {
2285-
LLDB_SCOPED_TIMER();
22862269
Status err;
22872270
Log *log = GetLog(LLDBLog::Expressions);
22882271

@@ -2340,7 +2323,6 @@ Status SwiftExpressionParser::DoPrepareForExecution(
23402323

23412324
bool SwiftExpressionParser::RewriteExpression(
23422325
DiagnosticManager &diagnostic_manager) {
2343-
LLDB_SCOPED_TIMER();
23442326
// There isn't a Swift equivalent to clang::Rewriter, so we'll just
23452327
// use that.
23462328
Log *log = GetLog(LLDBLog::Expressions);

lldb/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ findSwiftSelf(StackFrame &frame, lldb::VariableSP self_var_sp) {
185185
void SwiftUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) {
186186
Log *log = GetLog(LLDBLog::Expressions);
187187
LLDB_LOG(log, "SwiftUserExpression::ScanContext()");
188-
LLDB_SCOPED_TIMER();
189188

190189
m_target = exe_ctx.GetTargetPtr();
191190
if (!m_target) {
@@ -304,8 +303,6 @@ static llvm::Error AddVariableInfo(
304303
llvm::SmallVectorImpl<SwiftASTManipulator::VariableInfo> &local_variables,
305304
lldb::DynamicValueType use_dynamic,
306305
lldb::BindGenericTypes bind_generic_types) {
307-
LLDB_SCOPED_TIMER();
308-
309306
StringRef name = variable_sp->GetUnqualifiedName().GetStringRef();
310307
const char *name_cstr = name.data();
311308
assert(StringRef(name_cstr) == name && "missing null terminator");
@@ -495,7 +492,6 @@ static llvm::Error RegisterAllVariables(
495492
llvm::SmallVectorImpl<SwiftASTManipulator::VariableInfo> &local_variables,
496493
lldb::DynamicValueType use_dynamic,
497494
lldb::BindGenericTypes bind_generic_types) {
498-
LLDB_SCOPED_TIMER();
499495
SwiftLanguageRuntime *language_runtime = nullptr;
500496

501497
if (stack_frame_sp)
@@ -703,8 +699,6 @@ bool SwiftUserExpression::Parse(DiagnosticManager &diagnostic_manager,
703699
bool keep_result_in_memory,
704700
bool generate_debug_info) {
705701
Log *log = GetLog(LLDBLog::Expressions);
706-
LLDB_SCOPED_TIMER();
707-
708702
Status err;
709703

710704
auto error = [&](const char *error_msg, const char *detail = nullptr) {
@@ -981,7 +975,6 @@ bool SwiftUserExpression::AddArguments(ExecutionContext &exe_ctx,
981975

982976
lldb::ExpressionVariableSP SwiftUserExpression::GetResultAfterDematerialization(
983977
ExecutionContextScope *exe_scope) {
984-
LLDB_SCOPED_TIMER();
985978
lldb::ExpressionVariableSP in_result_sp = m_result_delegate.GetVariable();
986979
lldb::ExpressionVariableSP in_error_sp = m_error_delegate.GetVariable();
987980

lldb/source/Plugins/Language/Swift/SwiftFormatters.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ static bool makeStringGutsSummary(
145145
const TypeSummaryOptions &summary_options,
146146
StringPrinter::ReadStringAndDumpToStreamOptions read_options,
147147
std::optional<StringSlice> slice = std::nullopt) {
148-
LLDB_SCOPED_TIMER();
149-
150148
static ConstString g__object("_object");
151149
static ConstString g__storage("_storage");
152150
static ConstString g__value("_value");
@@ -518,8 +516,6 @@ bool lldb_private::formatters::swift::StaticString_SummaryProvider(
518516
ValueObject &valobj, Stream &stream,
519517
const TypeSummaryOptions &summary_options,
520518
StringPrinter::ReadStringAndDumpToStreamOptions read_options) {
521-
LLDB_SCOPED_TIMER();
522-
523519
static ConstString g__startPtrOrData("_startPtrOrData");
524520
static ConstString g__byteSize("_utf8CodeUnitCount");
525521
static ConstString g__flags("_flags");
@@ -574,7 +570,6 @@ bool lldb_private::formatters::swift::SwiftSharedString_SummaryProvider_2(
574570
ValueObject &valobj, Stream &stream,
575571
const TypeSummaryOptions &summary_options,
576572
StringPrinter::ReadStringAndDumpToStreamOptions read_options) {
577-
LLDB_SCOPED_TIMER();
578573
ProcessSP process(valobj.GetProcessSP());
579574
if (!process)
580575
return false;
@@ -603,7 +598,6 @@ bool lldb_private::formatters::swift::SwiftSharedString_SummaryProvider_2(
603598

604599
bool lldb_private::formatters::swift::SwiftStringStorage_SummaryProvider(
605600
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
606-
LLDB_SCOPED_TIMER();
607601
ProcessSP process(valobj.GetProcessSP());
608602
if (!process)
609603
return false;
@@ -675,7 +669,6 @@ bool lldb_private::formatters::swift::DarwinBoolean_SummaryProvider(
675669
static bool RangeFamily_SummaryProvider(ValueObject &valobj, Stream &stream,
676670
const TypeSummaryOptions &options,
677671
bool isHalfOpen) {
678-
LLDB_SCOPED_TIMER();
679672
static ConstString g_lowerBound("lowerBound");
680673
static ConstString g_upperBound("upperBound");
681674

@@ -1610,7 +1603,6 @@ lldb_private::formatters::swift::ActorSyntheticFrontEndCreator(
16101603

16111604
bool lldb_private::formatters::swift::ObjC_Selector_SummaryProvider(
16121605
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
1613-
LLDB_SCOPED_TIMER();
16141606
static ConstString g_ptr("ptr");
16151607
static ConstString g__rawValue("_rawValue");
16161608

@@ -1757,7 +1749,6 @@ bool PrintTypePreservingNSNumber(DataBufferSP buffer_sp, ProcessSP process_sp,
17571749

17581750
bool lldb_private::formatters::swift::TypePreservingNSNumber_SummaryProvider(
17591751
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
1760-
LLDB_SCOPED_TIMER();
17611752
lldb::addr_t ptr_value(valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS));
17621753
if (ptr_value == LLDB_INVALID_ADDRESS)
17631754
return false;
@@ -2040,8 +2031,6 @@ void PrintMatrix(Stream &stream,
20402031

20412032
bool lldb_private::formatters::swift::SIMDVector_SummaryProvider(
20422033
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
2043-
LLDB_SCOPED_TIMER();
2044-
20452034
// SIMD vector contains an inner member `_storage` which is an opaque
20462035
// container. Given SIMD is always in the form SIMDX<Type> where X is a
20472036
// positive integer, we can calculate the number of elements and the
@@ -2115,8 +2104,6 @@ bool lldb_private::formatters::swift::SIMDVector_SummaryProvider(
21152104

21162105
bool lldb_private::formatters::swift::LegacySIMD_SummaryProvider(
21172106
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
2118-
LLDB_SCOPED_TIMER();
2119-
21202107
Status error;
21212108
ProcessSP process_sp(valobj.GetProcessSP());
21222109
if (!process_sp)
@@ -2201,8 +2188,6 @@ bool lldb_private::formatters::swift::LegacySIMD_SummaryProvider(
22012188

22022189
bool lldb_private::formatters::swift::GLKit_SummaryProvider(
22032190
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
2204-
LLDB_SCOPED_TIMER();
2205-
22062191
// Get the type name without the "GLKit." prefix.
22072192
ConstString full_type_name = valobj.GetTypeName();
22082193
llvm::StringRef type_name = full_type_name.GetStringRef();

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,7 +2733,6 @@ UnwindPlanSP
27332733
SwiftLanguageRuntime::GetRuntimeUnwindPlan(ProcessSP process_sp,
27342734
RegisterContext *regctx,
27352735
bool &behaves_like_zeroth_frame) {
2736-
LLDB_SCOPED_TIMER();
27372736
auto log_expected = [](llvm::Error error) {
27382737
Log *log = GetLog(LLDBLog::Unwind);
27392738
LLDB_LOG_ERROR(log, std::move(error), "{0}");
@@ -2838,8 +2837,6 @@ SwiftLanguageRuntime::GetRuntimeUnwindPlan(ProcessSP process_sp,
28382837
UnwindPlanSP SwiftLanguageRuntime::GetFollowAsyncContextUnwindPlan(
28392838
ProcessSP process_sp, RegisterContext *regctx, ArchSpec &arch,
28402839
bool &behaves_like_zeroth_frame) {
2841-
LLDB_SCOPED_TIMER();
2842-
28432840
UnwindPlan::RowSP row(new UnwindPlan::Row);
28442841
const int32_t ptr_size = 8;
28452842
row->SetOffset(0);

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ SwiftLanguageRuntime::GetMemberVariableOffsetRemoteMirrors(
547547
std::optional<uint64_t> SwiftLanguageRuntime::GetMemberVariableOffset(
548548
CompilerType instance_type, ValueObject *instance,
549549
llvm::StringRef member_name, Status *error) {
550-
LLDB_SCOPED_TIMER();
551550
std::optional<uint64_t> offset;
552551

553552
if (!instance_type.IsValid())
@@ -1581,7 +1580,6 @@ SwiftLanguageRuntime::GetNumFields(CompilerType type,
15811580
llvm::Expected<uint32_t> SwiftLanguageRuntime::GetNumChildren(
15821581
CompilerType type, ExecutionContextScope *exe_scope,
15831582
bool include_superclass, bool include_clang_types) {
1584-
LLDB_SCOPED_TIMER();
15851583
SwiftRuntimeTypeVisitor visitor(*this, type, exe_scope, !include_superclass,
15861584
include_clang_types);
15871585
return visitor.CountChildren();
@@ -1620,7 +1618,6 @@ std::pair<SwiftLanguageRuntime::LookupResult, std::optional<size_t>>
16201618
SwiftLanguageRuntime::GetIndexOfChildMemberWithName(
16211619
CompilerType type, llvm::StringRef name, ExecutionContext *exe_ctx,
16221620
bool omit_empty_base_classes, std::vector<uint32_t> &child_indexes) {
1623-
LLDB_SCOPED_TIMER();
16241621
SwiftRuntimeTypeVisitor visitor(*this, type, exe_ctx, false, false, true);
16251622
bool found = false;
16261623
unsigned i = 0, last_depth = 0;
@@ -2547,7 +2544,6 @@ void SwiftLanguageRuntime::ForEachGenericParameter(
25472544
CompilerType SwiftLanguageRuntime::BindGenericTypeParameters(
25482545
CompilerType unbound_type,
25492546
std::function<CompilerType(unsigned, unsigned)> type_resolver) {
2550-
LLDB_SCOPED_TIMER();
25512547
using namespace swift::Demangle;
25522548

25532549
auto ts =
@@ -2633,7 +2629,6 @@ llvm::Expected<CompilerType>
26332629
SwiftLanguageRuntime::BindGenericTypeParameters(StackFrame &stack_frame,
26342630
TypeSystemSwiftTypeRef &ts,
26352631
ConstString mangled_name) {
2636-
LLDB_SCOPED_TIMER();
26372632
using namespace swift::Demangle;
26382633

26392634
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
@@ -3161,7 +3156,6 @@ bool SwiftLanguageRuntime::GetDynamicTypeAndAddress(
31613156
if (use_dynamic == lldb::eNoDynamicValues)
31623157
return false;
31633158

3164-
LLDB_SCOPED_TIMER();
31653159
CompilerType val_type(in_value.GetCompilerType());
31663160
Value::ValueType static_value_type = Value::ValueType::Invalid;
31673161

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeRemoteAST.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ SwiftLanguageRuntime::GetDynamicTypeAndAddress_ExistentialRemoteAST(
271271
llvm::Expected<CompilerType>
272272
SwiftLanguageRuntime::BindGenericTypeParametersRemoteAST(
273273
StackFrame &stack_frame, CompilerType base_type) {
274-
LLDB_SCOPED_TIMER();
275-
276274
// If this is a TypeRef type, bind that.
277275
auto sc = stack_frame.GetSymbolContext(lldb::eSymbolContextEverything);
278276
if (auto ts =

0 commit comments

Comments
 (0)