Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Coro alignment #232

wants to merge 1 commit into from

2 participants


This patch includes an inline function which produces aligned sizes for use in ensuring 16-byte alignment of stacks.


Ok, this commit is ready to go.


Hm, github says I can't automatically merge it. Were your changes not to the head?


I made a new branch off of your remote, master branch to fix this pull request (before I had done it off my master which has an extra commit in it I didn't want).

Not sure why this wouldn't be automatically mergable.


Still has this error.


Well, it worked 2 years ago when this original pull was made. Closing it now, because I don't care to take another look at it. Thanks for finally getting around to it though. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 12, 2012
  1. @jeremytregunna

    fixes conflicts

    jeremytregunna authored
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 1 deletion.
  1. +9 −1 libs/coroutine/source/Coro.c
10 libs/coroutine/source/Coro.c
@@ -85,6 +85,14 @@ Coro *Coro_new(void)
return self;
+// Returns a size that corresponds to `size` aligned on `alignment` bounds
+static inline size_t aligned_size(size_t size, size_t alignment)
+ assert(alignment <= 0x8000);
+ size_t r = size + --alignment + 2;
+ return (r + 2 + alignment) & ~alignment;
#ifndef USE_FIBERS
void Coro_allocStackIfNeeded(Coro *self)
@@ -599,7 +607,7 @@ void Coro_setup(Coro *self, void *arg)
if (64 > (- sav[i] + (uintptr_t)&i))
assert(i < sz);
- sav[i] = stackend - sizeof(uintptr_t) - 128;
+ sav[i] = aligned_size(stackend - sizeof(uintptr_t) - 128, 16);
Something went wrong with that request. Please try again.