Deleted Added
sdiff udiff text old ( 13145:5291e0747c7c ) new ( 13154:f86c71dac456 )
full compact
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 30 unchanged lines hidden (view full) ---

39{
40
41Scheduler::Scheduler() :
42 eq(nullptr), readyEvent(this, false, ReadyPriority),
43 pauseEvent(this, false, PausePriority),
44 stopEvent(this, false, StopPriority),
45 scMain(nullptr),
46 starvationEvent(this, false, StarvationPriority),
47 _started(false), _paused(false), _stopped(false), _stopNow(false),
48 maxTickEvent(this, false, MaxTickPriority),
49 _numCycles(0), _changeStamp(0), _current(nullptr), initDone(false),
50 runOnce(false)
51{}
52
53Scheduler::~Scheduler()
54{
55 // Clear out everything that belongs to us to make sure nobody tries to

--- 128 unchanged lines hidden (view full) ---

184 _current->excWrapper = nullptr;
185 ew->throw_it();
186 }
187}
188
189void
190Scheduler::ready(Process *p)
191{
192 if (_stopNow)
193 return;
194
195 // Clump methods together to minimize context switching.
196 static bool cluster_methods = false;
197
198 if (cluster_methods && p->procKind() == ::sc_core::SC_METHOD_PROC_)
199 readyList.pushFirst(p);
200 else
201 readyList.pushLast(p);
202

--- 72 unchanged lines hidden (view full) ---

275 yield();
276 } while (!readyList.empty());
277
278 if (!empty) {
279 _numCycles++;
280 _changeStamp++;
281 }
282
283 if (_stopNow)
284 return;
285
286 // The update phase.
287 update();
288
289 // The delta phase.
290 while (!deltas.empty())
291 deltas.front()->run();
292
293 if (!runToTime && starved())

--- 90 unchanged lines hidden (view full) ---

384
385void
386Scheduler::scheduleStop(bool finish_delta)
387{
388 if (stopEvent.scheduled())
389 return;
390
391 if (!finish_delta) {
392 _stopNow = true;
393 // If we're not supposed to finish the delta cycle, flush all
394 // pending activity.
395 clear();
396 }
397 schedule(&stopEvent);
398}
399
400Scheduler scheduler;
401
402} // namespace sc_gem5