From: Brandon Potter Date: Mon, 11 Mar 2019 18:08:17 +0000 (-0400) Subject: sim-se: small performance optimization X-Git-Tag: v19.0.0.0~698 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0db598e48d68d267c13b8213b333f8ec2b13d28f;p=gem5.git sim-se: small performance optimization A local variable was being set inside a loop when it should have been set outside the loop. This changeset moves the variable to the appropriate place. Change-Id: If7655b501bd819c39d35dea4c316b4b9ed3173a2 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17108 Maintainer: Brandon Potter Tested-by: kokoro Reviewed-by: Jason Lowe-Power --- diff --git a/src/sim/process.cc b/src/sim/process.cc index f974fa5ba..3a39dbe50 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -199,8 +199,8 @@ Process::clone(ThreadContext *otc, ThreadContext *ntc, * host file descriptors are also dup'd so that the flags for the * host file descriptor is independent of the other process. */ + std::shared_ptr nfds = np->fds; for (int tgt_fd = 0; tgt_fd < fds->getSize(); tgt_fd++) { - std::shared_ptr nfds = np->fds; std::shared_ptr this_fde = (*fds)[tgt_fd]; if (!this_fde) { nfds->setFDEntry(tgt_fd, nullptr);