sim: Break the eventq.hh dependency in core.hh.
authorGabe Black <gabe.black@gmail.com>
Tue, 12 Jan 2021 07:44:10 +0000 (23:44 -0800)
committerGabe Black <gabe.black@gmail.com>
Thu, 14 Jan 2021 23:14:17 +0000 (23:14 +0000)
commit4d7384e9dfcc0514b64e19eae69684ab195b7d80
treeb56076046370c4be5497289f701204533a9d0b0f
parentc29523665e2e5baded8d1b9466bff3e92764bd0e
sim: Break the eventq.hh dependency in core.hh.

The original implementation of curTick used a thread local variable,
_curEventQueue, and its getCurTick() method, to retrieve the curTick for
the currently active event queue. That meant that core.hh needed to
include eventq.hh so that the EventQueue type was available, which also
indirectly brought in a lot of other dependencies.

Unfortunately this couldn't easily be fixed by making curTick()
non-inline since this added a significant amount of overhead when
tested.

Instead, this change makes the code in core.hh/core.cc keep a pointer
directly to a Tick. The code which sets _curEventQueue now also sets
that pointer when _curEventQueue changes.

The way curTick() now reaches into the guts of the current EventQueue
directly is not great from a modularity perspective, but if curTick is
considered an extension of the EventQueue, then it's just odd that this
part is broken out into a different file.

Change-Id: I8341b40fe75e90672eb1d70e1a368975fcbfe926
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38996
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
src/sim/core.cc
src/sim/core.hh
src/sim/eventq.hh