sim-se: small performance optimization
authorBrandon Potter <brandon.potter@amd.com>
Mon, 11 Mar 2019 18:08:17 +0000 (14:08 -0400)
committerBrandon Potter <Brandon.Potter@amd.com>
Thu, 1 Aug 2019 20:31:33 +0000 (20:31 +0000)
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 <Brandon.Potter@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/sim/process.cc

index f974fa5babd43de9bd3e466a1616b2215b67cfea..3a39dbe5057f6793a6a35da8dc2d847be13ad865 100644 (file)
@@ -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<FDArray> nfds = np->fds;
         for (int tgt_fd = 0; tgt_fd < fds->getSize(); tgt_fd++) {
-            std::shared_ptr<FDArray> nfds = np->fds;
             std::shared_ptr<FDEntry> this_fde = (*fds)[tgt_fd];
             if (!this_fde) {
                 nfds->setFDEntry(tgt_fd, nullptr);