Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Coro alignment #232

Closed
wants to merge 1 commit into from

2 participants

@jeremytregunna

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

@jeremytregunna

Ok, this commit is ready to go.

@stevedekorte

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

@jeremytregunna

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.

@stevedekorte
Owner

Still has this error.

@jeremytregunna

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
View
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))
break;
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.