Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use specially-aligned types instead of packed structs #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/JackActivationCount.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct JackClientControl;
\brief Client activation counter.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
class JackActivationCount
{

Expand Down Expand Up @@ -74,7 +74,7 @@ class JackActivationCount
return fValue;
}

} POST_PACKED_STRUCTURE;
};

} // end of namespace

Expand Down
8 changes: 4 additions & 4 deletions common/JackAtomicArrayState.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Jack
/*!
\brief Counter for CAS
*/
PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct AtomicArrayCounter
{
union {
Expand Down Expand Up @@ -68,7 +68,7 @@ struct AtomicArrayCounter
return *this;
}

} POST_PACKED_STRUCTURE;
};

#define Counter1(e) (e).info.fLongVal
#define GetIndex1(e, state) ((e).info.scounter.fByteVal[state])
Expand Down Expand Up @@ -109,7 +109,7 @@ struct AtomicArrayCounter

// CHECK livelock

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
template <class T>
class JackAtomicArrayState
{
Expand Down Expand Up @@ -249,7 +249,7 @@ class JackAtomicArrayState
WriteNextStateStopAux(state);
}

} POST_PACKED_STRUCTURE;
};

} // end of namespace

Expand Down
8 changes: 4 additions & 4 deletions common/JackAtomicState.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Jack
\brief Counter for CAS
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct AtomicCounter
{
union {
Expand Down Expand Up @@ -70,7 +70,7 @@ struct AtomicCounter
return *this;
}

} POST_PACKED_STRUCTURE;
};

#define Counter(e) (e).info.fLongVal
#define CurIndex(e) (e).info.scounter.fShortVal1
Expand All @@ -85,7 +85,7 @@ struct AtomicCounter

// CHECK livelock

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
template <class T>
class JackAtomicState
{
Expand Down Expand Up @@ -254,7 +254,7 @@ class JackAtomicState
}
*/

} POST_PACKED_STRUCTURE;
};

} // end of namespace

Expand Down
4 changes: 2 additions & 2 deletions common/JackClientControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Jack
\brief Client control possibly in shared memory.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct JackClientControl : public JackShmMemAble
{
char fName[JACK_CLIENT_NAME_SIZE + 1];
Expand Down Expand Up @@ -89,7 +89,7 @@ struct JackClientControl : public JackShmMemAble
fSessionID = uuid;
}

} POST_PACKED_STRUCTURE;
};

} // end of namespace

Expand Down
24 changes: 12 additions & 12 deletions common/JackConnectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct JackClientControl;
\brief Utility class.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
template <int SIZE>
class JackFixedArray
{
Expand Down Expand Up @@ -117,13 +117,13 @@ class JackFixedArray
return fCounter;
}

} POST_PACKED_STRUCTURE;
};

/*!
\brief Utility class.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
template <int SIZE>
class JackFixedArray1 : public JackFixedArray<SIZE>
{
Expand Down Expand Up @@ -154,13 +154,13 @@ class JackFixedArray1 : public JackFixedArray<SIZE>
}
}

} POST_PACKED_STRUCTURE;
};

/*!
\brief Utility class.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
template <int SIZE>
class JackFixedMatrix
{
Expand Down Expand Up @@ -250,13 +250,13 @@ class JackFixedMatrix
}


} POST_PACKED_STRUCTURE;
};

/*!
\brief Utility class.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
template <int SIZE>
class JackLoopFeedback
{
Expand Down Expand Up @@ -364,13 +364,13 @@ class JackLoopFeedback
return -1;
}

} POST_PACKED_STRUCTURE;
};

/*!
\brief For client timing measurements.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct JackClientTiming
{
jack_time_t fSignaledAt;
Expand All @@ -393,7 +393,7 @@ struct JackClientTiming
fStatus = NotTriggered;
}

} POST_PACKED_STRUCTURE;
};

/*!
\brief Connection manager.
Expand All @@ -407,7 +407,7 @@ struct JackClientTiming
</UL>
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
class SERVER_EXPORT JackConnectionManager
{

Expand Down Expand Up @@ -487,7 +487,7 @@ class SERVER_EXPORT JackConnectionManager
int SuspendRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing, long time_out_usec);
void TopologicalSort(std::vector<jack_int_t>& sorted);

} POST_PACKED_STRUCTURE;
};

} // end of namespace

Expand Down
12 changes: 7 additions & 5 deletions common/JackEngineControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ class JackGraphManager;
#define JACK_ENGINE_ROLLING_COUNT 32
#define JACK_ENGINE_ROLLING_INTERVAL 1024

typedef JACK_ALIGNED_TYPE(UInt64) jack_UInt64;

/*!
\brief Engine control in shared memory.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct SERVER_EXPORT JackEngineControl : public JackShmMem
{
// Shared state
Expand Down Expand Up @@ -81,9 +83,9 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem
float fCPULoad;

// For OSX thread
UInt64 fPeriod;
UInt64 fComputation;
UInt64 fConstraint;
jack_UInt64 fPeriod;
jack_UInt64 fComputation;
jack_UInt64 fConstraint;

// Timer
JackFrameTimer fFrameTimer;
Expand Down Expand Up @@ -182,7 +184,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem
void CalcCPULoad(JackClientInterface** table, JackGraphManager* manager, jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end);
void ResetRollingUsecs();

} POST_PACKED_STRUCTURE;
};

} // end of namespace

Expand Down
16 changes: 8 additions & 8 deletions common/JackEngineProfiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Jack
\brief Timing stucture for a client.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct JackTimingMeasureClient
{
int fRefNum;
Expand All @@ -54,13 +54,13 @@ struct JackTimingMeasureClient
fStatus((jack_client_state_t)0)
{}

} POST_PACKED_STRUCTURE;
};

/*!
\brief Timing interval in the global table for a given client
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct JackTimingClientInterval
{
int fRefNum;
Expand All @@ -74,13 +74,13 @@ struct JackTimingClientInterval
fEndInterval(-1)
{}

} POST_PACKED_STRUCTURE;
};

/*!
\brief Timing stucture for a table of clients.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct JackTimingMeasure
{
unsigned int fAudioCycle;
Expand All @@ -96,7 +96,7 @@ struct JackTimingMeasure
fPrevCycleEnd(0)
{}

} POST_PACKED_STRUCTURE;
};

/*!
\brief Client timing monitoring.
Expand All @@ -105,7 +105,7 @@ struct JackTimingMeasure
class JackClientInterface;
class JackGraphManager;

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
class SERVER_EXPORT JackEngineProfiling
{

Expand All @@ -132,7 +132,7 @@ class SERVER_EXPORT JackEngineProfiling

JackTimingMeasure* GetCurMeasure();

} POST_PACKED_STRUCTURE;
};

} // end of namespace

Expand Down
12 changes: 6 additions & 6 deletions common/JackFilters.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Jack

#define MAX_SIZE 64

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
struct JackFilter
{

Expand Down Expand Up @@ -66,9 +66,9 @@ namespace Jack
return mean / MAX_SIZE;
}

} POST_PACKED_STRUCTURE;
};

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
class JackDelayLockedLoop
{

Expand Down Expand Up @@ -149,9 +149,9 @@ namespace Jack
return fCurrentWakeup;
}

} POST_PACKED_STRUCTURE;
};

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
class JackAtomicDelayLockedLoop : public JackAtomicState<JackDelayLockedLoop>
{
public:
Expand Down Expand Up @@ -215,7 +215,7 @@ namespace Jack

return res;
}
} POST_PACKED_STRUCTURE;
};

#endif

Expand Down
8 changes: 4 additions & 4 deletions common/JackFrameTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace Jack
\brief A structure used for time management.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
class SERVER_EXPORT JackTimer
{

Expand Down Expand Up @@ -69,13 +69,13 @@ class SERVER_EXPORT JackTimer
return fCurrentWakeup;
}

} POST_PACKED_STRUCTURE;
};

/*!
\brief A class using the JackAtomicState to manage jack time.
*/

PRE_PACKED_STRUCTURE
/* Note: This class must be kept 32/64 clean! */
class SERVER_EXPORT JackFrameTimer : public JackAtomicState<JackTimer>
{

Expand All @@ -97,7 +97,7 @@ class SERVER_EXPORT JackFrameTimer : public JackAtomicState<JackTimer>
void IncFrameTime(jack_nframes_t buffer_size, jack_time_t callback_usecs, jack_time_t period_usecs);
void ReadFrameTime(JackTimer* timer);

} POST_PACKED_STRUCTURE;
};


} // end of namespace
Expand Down
Loading