Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'stack-top' of git://github.com/alexrp/druntime
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Jul 12, 2012
2 parents 90cccc8 + e055445 commit a838d92
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions import/core/thread.di
Expand Up @@ -668,10 +668,26 @@ alias IsMarked delegate( void* addr ) IsMarkedDg;
extern(C) void thread_processGCMarks( scope IsMarkedDg isMarked );


/**
* Returns the stack top of the currently active stack within the calling
* thread.
*
* In:
* The calling thread must be attached to the runtime.
*
* Returns:
* The address of the stack top.
*/
extern (C) void* thread_stackTop();


/**
* Returns the stack bottom of the currently active stack within the calling
* thread.
*
* In:
* The calling thread must be attached to the runtime.
*
* Returns:
* The address of the stack bottom.
*/
Expand Down
17 changes: 17 additions & 0 deletions src/core/thread.d
Expand Up @@ -2866,7 +2866,24 @@ private void* getStackBottom()
}


extern (C) void* thread_stackTop()
in
{
// Not strictly required, but it gives us more flexibility.
assert(Thread.getThis());
}
body
{
return getStackTop();
}


extern (C) void* thread_stackBottom()
in
{
assert(Thread.getThis());
}
body
{
return Thread.getThis().topContext().bstack;
}
Expand Down

0 comments on commit a838d92

Please sign in to comment.