This is an archive of the discontinued LLVM Phabricator instance.

Don't try to parse ObjC method if CU isn't ObjC
ClosedPublic

Authored by clayborg on Jun 11 2019, 2:56 PM.

Details

Summary

Improve manual indexing performance when indexing non objective C code. One question I have is all Darwin compilers currently support the apple DWARF indexes, so do we even need the objective C parsing code here?

Diff Detail

Event Timeline

clayborg created this revision.Jun 11 2019, 2:56 PM

I suppose one could compile Objective-C code on Linux using GCC.

source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
252

Since check_objc is only used here, I think it would be better for readability to say

if (cu_language == eLanguageTypeObjC ||
    cu_language == eLanguageTypeObjC_plus_plus)

here

clayborg marked an inline comment as done.Jun 11 2019, 4:06 PM
clayborg added inline comments.
source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
252

This is a hot loop. As long as the compiler will compute this once when optimizations are enabled, I am fine with inlining it into the if statement. But I pulled it out of the loop to ensure it only gets calculated once.

I suppose one could compile Objective-C code on Linux using GCC.

Will GCC not set the language to ObjC or ObjC++?

I suppose one could compile Objective-C code on Linux using GCC.

Will GCC not set the language to ObjC or ObjC++?

This was intended as a reply to:

One question I have is all Darwin compilers currently support the apple DWARF indexes, so do we even need the objective C parsing code here?

source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
252

cu_language is a constant, so it should be safe for the compiler to hoist the computation. Also, this computation is so cheap that I'd rather optimize for readability.

I suppose one could compile Objective-C code on Linux using GCC.

Will GCC not set the language to ObjC or ObjC++?

This was intended as a reply to:

One question I have is all Darwin compilers currently support the apple DWARF indexes, so do we even need the objective C parsing code here?

Also, i think I remember hearing that the apple indexes will not be emitted for jitted code, even on apple platforms, but this was just in passing, so I may not be totally correct here.

clayborg updated this revision to Diff 204553.Jun 13 2019, 8:31 AM

Let compiler hoist "cu_language == eLanguageTypeObjC || cu_language == eLanguageTypeObjC_plus_plus" by inlining it into if statement so it is more readable.

aprantl accepted this revision.Jun 13 2019, 12:46 PM

Thanks!

This revision is now accepted and ready to land.Jun 13 2019, 12:46 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2019, 12:15 PM