This is an archive of the discontinued LLVM Phabricator instance.

[scudo] seperate cache retrieval logic
ClosedPublic

Authored by frs513 on Jul 18 2023, 5:03 PM.

Details

Summary

Split cache::retrieve() into separate functions. One that retrieves
the cached block and another that sets the header and MTE environment.
These were split so that the retrieve function could be more easily
changed in the future and so that the retrieve function had the sole
purpose of retrieving a CachedBlock.

Diff Detail

Event Timeline

frs513 created this revision.Jul 18 2023, 5:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 5:03 PM
Herald added subscribers: yaneury, Enna1. · View Herald Transcript
frs513 requested review of this revision.Jul 18 2023, 5:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 5:03 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Can you add some comment in the commit message (and update the summary here) that saying why we want to do this split?

compiler-rt/lib/scudo/standalone/secondary.h
445–459

Can we merge this two if (useMemoryTagging<Config>(Options))?

frs513 updated this revision to Diff 542082.Jul 19 2023, 9:48 AM

Combined if statements in setHeader() and updated commit message to explain
why we separated Cache::retrieve().

frs513 edited the summary of this revision. (Show Details)Jul 19 2023, 9:50 AM
frs513 updated this revision to Diff 542084.Jul 19 2023, 9:51 AM

fixed grammatical errors in commit message

frs513 marked an inline comment as done.Jul 19 2023, 3:51 PM
cferris requested changes to this revision.Jul 19 2023, 4:51 PM
cferris added inline comments.
compiler-rt/lib/scudo/standalone/secondary.h
442

Should be CachedBlock &Entry to match the retrieve call and avoid copying the data structure. Unless that's what you wanted to do.

This revision now requires changes to proceed.Jul 19 2023, 4:51 PM
frs513 added inline comments.Jul 20 2023, 10:57 AM
compiler-rt/lib/scudo/standalone/secondary.h
442

I just passed in a copy because nothing should be writing to the CachedBlock Entry here, setHeader() is only reading values.

cferris added inline comments.Jul 20 2023, 11:29 AM
compiler-rt/lib/scudo/standalone/secondary.h
442

But it's a good idea to avoid doing the copy. Since the entry is not used after this point, it would make more sense to avoid doing the copy and passing by reference.

frs513 marked 2 inline comments as done.Jul 20 2023, 2:22 PM
frs513 updated this revision to Diff 542672.Jul 20 2023, 2:23 PM

passed in CachedBlock by reference to setHeader() to avoid copying the CachedBlock structure

cferris accepted this revision.Jul 20 2023, 2:24 PM

LGTM. After the builds pass, I can submit this for you.

This revision is now accepted and ready to land.Jul 20 2023, 2:24 PM
cferris requested changes to this revision.Jul 21 2023, 3:57 PM

Can you run clang format on this? By looking deep into the logs, I did see an error about clang format failing.

This revision now requires changes to proceed.Jul 21 2023, 3:57 PM
frs513 updated this revision to Diff 543113.Jul 21 2023, 4:22 PM

clang format code

frs513 updated this revision to Diff 543117.Jul 21 2023, 4:33 PM

clang format and fixed version of file

cferris accepted this revision.Jul 21 2023, 4:35 PM

LGTM again.

This revision is now accepted and ready to land.Jul 21 2023, 4:35 PM
frs513 updated this revision to Diff 544061.Jul 25 2023, 11:46 AM

rebased and resolved merge conflicts

rebased and resolved merge conflicts

It looks like you uploaded wrong CL to this change id?

frs513 updated this revision to Diff 544072.Jul 25 2023, 12:14 PM

uploading correct commit after rebase

This revision was landed with ongoing or failed builds.Jul 25 2023, 12:27 PM
This revision was automatically updated to reflect the committed changes.