Skip to content

Commit

Permalink
Reorder structure fields so commonly accessed fields are at the begin…
Browse files Browse the repository at this point in the history
…ning.
  • Loading branch information
Richard Osborne committed Apr 5, 2012
1 parent 0680598 commit bccf93e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
12 changes: 6 additions & 6 deletions Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@


Core::Core(uint32_t RamSize, uint32_t RamBase) :
executionFrequency(new executionFrequency_t[RamSize >> 1]),
opcode(new OPCODE_TYPE[(RamSize >> 1) + ILLEGAL_PC_THREAD_ADDR_OFFSET]),
operands(new Operands[RamSize >> 1]),
ramSizeLog2(31 - countLeadingZeros(RamSize)),
ram_base(RamBase),
ramBaseMultiple(RamBase / RamSize),
thread(new Thread[NUM_THREADS]),
sync(new Synchroniser[NUM_SYNCS]),
lock(new Lock[NUM_LOCKS]),
Expand All @@ -31,13 +37,7 @@ Core::Core(uint32_t RamSize, uint32_t RamBase) :
memory(new uint32_t[RamSize >> 2]),
coreNumber(0),
parent(0),
opcode(new OPCODE_TYPE[(RamSize >> 1) + ILLEGAL_PC_THREAD_ADDR_OFFSET]),
operands(new Operands[RamSize >> 1]),
invalidationInfo(new unsigned char[RamSize >> 1]),
executionFrequency(new executionFrequency_t[RamSize >> 1]),
ramSizeLog2(31 - countLeadingZeros(RamSize)),
ram_base(RamBase),
ramBaseMultiple(RamBase / RamSize),
syscallAddress(~0),
exceptionAddress(~0)
{
Expand Down
29 changes: 15 additions & 14 deletions Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,21 @@ class Core {
private:
typedef int executionFrequency_t;
static const executionFrequency_t MIN_EXECUTION_FREQUENCY = INT_MIN;

executionFrequency_t *executionFrequency;
uint32_t * memoryOffset;
unsigned char *invalidationInfoOffset;
// The opcode cache is bigger than the memory size. We place an ILLEGAL_PC
// pseudo instruction just past the end of memory. This saves
// us from having to check for illegal pc values when incrementing the pc from
// the previous instruction. Addition pseudo instructions come after this and
// are use for communicating illegal states.
OPCODE_TYPE *opcode;
Operands *operands;
public:
const uint32_t ramSizeLog2;
const uint32_t ram_base;
const uint32_t ramBaseMultiple;
private:
Thread * const thread;
Synchroniser * const sync;
Lock * const lock;
Expand All @@ -61,7 +75,6 @@ class Core {
unsigned *resourceNum;
static bool allocatable[LAST_STD_RES_TYPE + 1];
uint32_t * const memory;
uint32_t * memoryOffset;
unsigned coreNumber;
Node *parent;
std::string codeReference;
Expand Down Expand Up @@ -94,22 +107,10 @@ class Core {
return true;
}
private:
// The opcode cache is bigger than the memory size. We place an ILLEGAL_PC
// pseudo instruction just past the end of memory. This saves
// us from having to check for illegal pc values when incrementing the pc from
// the previous instruction. Addition pseudo instructions come after this and
// are use for communicating illegal states.
OPCODE_TYPE *opcode;
Operands *operands;
unsigned char *invalidationInfo;
unsigned char *invalidationInfoOffset;
executionFrequency_t *executionFrequency;
uint32_t getRamSizeShorts() const { return 1 << (ramSizeLog2 - 1); }

public:
const uint32_t ramSizeLog2;
const uint32_t ram_base;
const uint32_t ramBaseMultiple;
uint32_t vector_base;

uint32_t syscallAddress;
Expand Down

0 comments on commit bccf93e

Please sign in to comment.