diff options
author | Andi Kleen <ak@gcc.gnu.org> | 2024-12-26 12:36:04 -0800 |
---|---|---|
committer | Andi Kleen <ak@gcc.gnu.org> | 2025-02-07 09:43:01 -0800 |
commit | 66af77cbed6c5bf15c19573ad21ebfd0552cc4b2 (patch) | |
tree | 3ae4a6f4fcf518e91c25661c2aa293b663bb1af7 /gcc/fortran/trans-expr.cc | |
parent | 0b6453d5575d4aa773a1fe25060123bc6f539891 (diff) | |
download | gcc-66af77cbed6c5bf15c19573ad21ebfd0552cc4b2.zip gcc-66af77cbed6c5bf15c19573ad21ebfd0552cc4b2.tar.gz gcc-66af77cbed6c5bf15c19573ad21ebfd0552cc4b2.tar.bz2 |
Add a cache of recent lines
For larger files the file_cache line index will be spread out to make
the index fit into the fixed buffer, so any access to the non latest line
will need some skipping of lines.
Most accesses for line are near the latest line because
a diagnostic is likely near where the scanner is currently lexing.
Add a second cache for recent lines. It is organized as a ring buffer
and maintains the last 256 lines relative to the last input line.
With that, enabling -Wmisleading-indentation for the test case in
PR preprocessor/118168, is within the run-to-run variation.
gcc/ChangeLog:
PR preprocessor/118168
* input.cc (file_cache::m_line_recent,
m_line_recent_first, m_line_recent_last): Add.
(file_cache_slot::evict): Clear new fields.
(file_cache_slot::create): Clear new fields.
(file_cache_slot::file_cache_slot): Initialize new fields.
(file_cache_slot::~file_cache_slot): Release m_line_recent.
(file_cache_slot::get_next_line): Maintain ring buffer of lines
in m_line_recent.
(file_cache_slot::read_line_num): Use m_line_recent to look up
recent lines quickly.
Diffstat (limited to 'gcc/fortran/trans-expr.cc')
0 files changed, 0 insertions, 0 deletions