projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ce9cc6a
)
silc_stack_alloc automatically aligns the stack size.
author
Pekka Riikonen
<priikone@silcnet.org>
Tue, 25 Dec 2007 16:47:26 +0000
(16:47 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Tue, 25 Dec 2007 16:47:26 +0000
(16:47 +0000)
CHANGES.RUNTIME
patch
|
blob
|
history
TODO
patch
|
blob
|
history
lib/silcutil/silcfsm.c
patch
|
blob
|
history
lib/silcutil/silcstack.c
patch
|
blob
|
history
lib/silcutil/silcstack.h
patch
|
blob
|
history
lib/silcutil/tests/test_silcstack.c
patch
|
blob
|
history
diff --git
a/CHANGES.RUNTIME
b/CHANGES.RUNTIME
index 4c2cef6413d20edbb7915359dd9f75e21d2216fd..ff6ebd8a0e261608dbbab00d7fd9985667b60426 100644
(file)
--- a/
CHANGES.RUNTIME
+++ b/
CHANGES.RUNTIME
@@
-1,3
+1,8
@@
+Tue Dec 25 18:44:27 EET 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * silc_stack_alloc now automatically aligns the requested
+ stack size. Affected files are lib/silcutil/silcstack.[ch].
+
Tue Dec 25 13:53:07 EET 2007 Pekka Riikonen <priikone@silcnet.org>
* Added silc_getopt to lib/silcutil/silcgetopt.[ch].
Tue Dec 25 13:53:07 EET 2007 Pekka Riikonen <priikone@silcnet.org>
* Added silc_getopt to lib/silcutil/silcgetopt.[ch].
diff --git
a/TODO
b/TODO
index 8fbf2c34e1f9e2788f83ba68f05f78cd31002b87..fd6156b4ccd834bed26fbf47a3f60039cebdc696 100644
(file)
--- a/
TODO
+++ b/
TODO
@@
-203,7
+203,7
@@
Runtime library, lib/silcutil/
allocation possibility. (***DONE)
o silc_stack_alloc shouldn't require multiple by 8 size argument, it
allocation possibility. (***DONE)
o silc_stack_alloc shouldn't require multiple by 8 size argument, it
- should figure it out itself.
+ should figure it out itself.
(***DONE)
o silc_malloc et. al. to respect --with-alignment.
o silc_malloc et. al. to respect --with-alignment.
diff --git
a/lib/silcutil/silcfsm.c
b/lib/silcutil/silcfsm.c
index 3cef6d969506a8f374feb54fdcb5e3a89029b0cf..4ff23bab02fdb2b8eb60678629e136c9c3e5c28e 100644
(file)
--- a/
lib/silcutil/silcfsm.c
+++ b/
lib/silcutil/silcfsm.c
@@
-108,7
+108,7
@@
void silc_fsm_thread_init(SilcFSMThread thread,
SILC_LOG_DEBUG(("Initializing new thread %p (%s)",
thread, real_thread ? "real" : "FSM"));
SILC_LOG_DEBUG(("Initializing new thread %p (%s)",
thread, real_thread ? "real" : "FSM"));
- SILC_
ASSERT
(!fsm->thread);
+ SILC_
VERIFY
(!fsm->thread);
thread->fsm_context = thread_context;
thread->state_context = NULL;
thread->fsm_context = thread_context;
thread->state_context = NULL;
@@
-317,7
+317,7
@@
void silc_fsm_finish(void *fsm)
{
SilcFSM f = fsm;
{
SilcFSM f = fsm;
- SILC_
ASSERT
(!f->finished);
+ SILC_
VERIFY
(!f->finished);
f->started = FALSE;
f->finished = TRUE;
f->started = FALSE;
f->finished = TRUE;
@@
-356,7
+356,7
@@
SilcSchedule silc_fsm_get_schedule(void *fsm)
SilcFSM silc_fsm_get_machine(SilcFSMThread thread)
{
SilcFSM silc_fsm_get_machine(SilcFSMThread thread)
{
- SILC_
ASSERT
(thread->thread);
+ SILC_
VERIFY
(thread->thread);
return (SilcFSM)thread->u.t.fsm;
}
return (SilcFSM)thread->u.t.fsm;
}
@@
-406,7
+406,7
@@
SilcBool silc_fsm_thread_wait(void *fsm, void *thread)
{
SilcFSM t = thread;
{
SilcFSM t = thread;
- SILC_
ASSERT
(t->thread);
+ SILC_
VERIFY
(t->thread);
t->u.t.event = silc_fsm_event_alloc(t->u.t.fsm);
if (!t->u.t.event)
t->u.t.event = silc_fsm_event_alloc(t->u.t.fsm);
if (!t->u.t.event)
@@
-517,7
+517,7
@@
SilcFSMEvent silc_fsm_event_alloc(SilcFSM fsm)
void silc_fsm_event_init(SilcFSMEvent event, SilcFSM fsm)
{
SILC_LOG_DEBUG(("Initializing event %p", event));
void silc_fsm_event_init(SilcFSMEvent event, SilcFSM fsm)
{
SILC_LOG_DEBUG(("Initializing event %p", event));
- SILC_
ASSERT
(!fsm->thread);
+ SILC_
VERIFY
(!fsm->thread);
memset(event, 0, sizeof(*event));
event->fsm = fsm;
event->refcnt = 0;
memset(event, 0, sizeof(*event));
event->fsm = fsm;
event->refcnt = 0;
diff --git
a/lib/silcutil/silcstack.c
b/lib/silcutil/silcstack.c
index 88286d83c505ddfaa3e69eb5b7b72bc009631051..79f63d2fc8552242223be51cadbccb5c69d7ff40 100644
(file)
--- a/
lib/silcutil/silcstack.c
+++ b/
lib/silcutil/silcstack.c
@@
-177,6
+177,9
@@
SilcStack silc_stack_alloc(SilcUInt32 stack_size, SilcStack parent)
if (stack_size < SILC_STACK_DEFAULT_SIZE)
stack_size = SILC_STACK_DEFAULT_SIZE;
if (stack_size < SILC_STACK_DEFAULT_SIZE)
stack_size = SILC_STACK_DEFAULT_SIZE;
+ /* Align by 8 */
+ stack_size += ((-stack_size) % 8);
+
if (parent) {
/* Get stack from parent. The stack itself is allocated from the
parent (but does not consume parent's own stack). */
if (parent) {
/* Get stack from parent. The stack itself is allocated from the
parent (but does not consume parent's own stack). */
diff --git
a/lib/silcutil/silcstack.h
b/lib/silcutil/silcstack.h
index 88032aa81eb7f97c56fe1b9656d1b7c2f329df32..c4415a17c15978d385ebddeb8ba70cce903ae372 100644
(file)
--- a/
lib/silcutil/silcstack.h
+++ b/
lib/silcutil/silcstack.h
@@
-125,8
+125,7
@@
typedef void (*SilcStackOomHandler)(SilcStack stack, void *context);
* allocation by various routines. Returns the pointer to the stack
* that must be freed with silc_stack_free function when it is not
* needed anymore. If the `stack_size' is zero (0) by default a
* allocation by various routines. Returns the pointer to the stack
* that must be freed with silc_stack_free function when it is not
* needed anymore. If the `stack_size' is zero (0) by default a
- * 1 kilobyte (1024 bytes) stack is allocated. If the `stack_size'
- * is non-zero the byte value must be multiple by 8.
+ * 1 kilobyte (1024 bytes) stack is allocated.
*
* If `parent' is non-NULL the created stack is a child of the `parent'
* stack. All of childs the memory is allocated from the `parent' and
*
* If `parent' is non-NULL the created stack is a child of the `parent'
* stack. All of childs the memory is allocated from the `parent' and
diff --git
a/lib/silcutil/tests/test_silcstack.c
b/lib/silcutil/tests/test_silcstack.c
index 4b905385744a881edfde57a8c34c3e348840b401..34b6fc3fead140a024985a44912668bea998d2cd 100644
(file)
--- a/
lib/silcutil/tests/test_silcstack.c
+++ b/
lib/silcutil/tests/test_silcstack.c
@@
-94,7
+94,7
@@
int main(int argc, char **argv)
silc_stack_stats(stack);
SILC_LOG_DEBUG(("Creating child stack"));
silc_stack_stats(stack);
SILC_LOG_DEBUG(("Creating child stack"));
- child = silc_stack_alloc(819
2
, stack);
+ child = silc_stack_alloc(819
0
, stack);
if (!child)
goto err;
SILC_LOG_DEBUG(("Pushing %d times", NUM_ALLS / 2));
if (!child)
goto err;
SILC_LOG_DEBUG(("Pushing %d times", NUM_ALLS / 2));