Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
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
2 changes: 1 addition & 1 deletion src/core/thread.di
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ enum IsMarked : int
unknown, /// Address is not managed by the GC.
}

alias IsMarked delegate( void* addr ) IsMarkedDg;
alias int delegate( void* addr ) IsMarkedDg;

/**
* This routine allows the runtime to process any special per-thread handling
Expand Down
4 changes: 1 addition & 3 deletions src/gc/bits.d
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ module gc.bits;
import core.bitop;
import core.stdc.string;
import core.stdc.stdlib;


private extern (C) void onOutOfMemoryError(void* pretend_sideffect = null) @trusted pure nothrow; /* dmd @@@BUG11461@@@ */
import core.exception : onOutOfMemoryError;


version (DigitalMars)
Expand Down
31 changes: 9 additions & 22 deletions src/gc/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ import gc.stats;
import gc.os;

import cstdlib = core.stdc.stdlib : calloc, free, malloc, realloc;
import core.stdc.string;
import core.stdc.string : memcpy, memset, memmove;
import core.bitop;
import core.sync.mutex;
import core.exception : onOutOfMemoryError, onInvalidMemoryOperationError;
import core.thread;
static import core.memory;
private alias BlkAttr = core.memory.GC.BlkAttr;
private alias BlkInfo = core.memory.GC.BlkInfo;

version (GNU) import gcc.builtins;

Expand Down Expand Up @@ -81,36 +84,20 @@ private
// D is the depth of the heap graph.
enum MAX_MARK_RECURSIONS = 64;
}
struct BlkInfo
{
void* base;
size_t size;
uint attr;
}

private
{
// to allow compilation of this module without access to the rt package,
// make these functions available from rt.lifetime
extern (C) void rt_finalize2(void* p, bool det, bool resetMemory);
extern (C) int rt_hasFinalizerInSegment(void* p, in void[] segment);

extern (C) void thread_suspendAll();
extern (C) void thread_resumeAll();

// core.thread
enum IsMarked : int
{
no,
yes,
unknown, // memory is not managed by GC
unknown, // memory is not managed by GC, treated as yes by lifetime.processGCMarks
}
alias IsMarked delegate(void*) IsMarkedDg;
extern (C) void thread_processGCMarks(scope IsMarkedDg isMarked);

alias void delegate(void*, void*) scanFn;
extern (C) void thread_scanAll(scope scanFn fn);

extern (C) void onOutOfMemoryError(void* pretend_sideffect = null) @trusted pure nothrow; /* dmd @@@BUG11461@@@ */
extern (C) void onInvalidMemoryOperationError(void* pretend_sideffect = null) @trusted pure nothrow; /* dmd @@@BUG11461@@@ */

enum
{
OPFAIL = ~cast(size_t)0
Expand Down Expand Up @@ -2825,7 +2812,7 @@ struct Gcx
* Warning! This should only be called while the world is stopped inside
* the fullcollect function.
*/
IsMarked isMarked(void *addr)
int isMarked(void *addr)
{
// first, we find the Pool this block is in, then check to see if the
// mark bit is clear.
Expand Down
3 changes: 3 additions & 0 deletions src/gc/proxy.d
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ private

__gshared gc_t _gc;

static import core.memory;
alias BlkInfo = core.memory.GC.BlkInfo;

extern (C) void thread_init();
extern (C) void thread_term();

Expand Down