Linking with a non-default druntime

Per Nordlöw per.nordlow at gmail.com
Tue Oct 2 21:04:17 UTC 2018


On Tuesday, 2 October 2018 at 16:20:52 UTC, Basile B. wrote:
> This works https://github.com/BBasile/druntime/pull/1. Not sure 
> if it will be useful.

Ahh, thanks!

I've just found my own way of iterating via a script at

     https://github.com/nordlow/scripts/blob/master/dmd-own

that (re)compiles druntime and phobos and then compiles my GC 
test application using toolchain in around 7 secs on my 2 year 
old laptop. I'll stick to that for now.

This assumes the home-directory structure

~/Work/dmd ~master
        druntime ~dmitry-gc
        phobos ~master

. The playground for my GC experiments will be

https://github.com/nordlow/druntime/blob/dmitry-gc/src/gc/impl/dmitry/gc.d

So far I've only described my plan and added a set of debug 
prints.

You're very welcome to comment and destroy my plan. I'm uncertain 
of what kinds of locking (if any) that is needed for a 
thread-local GC allocation (non-mutex I suppose). Please 
elaborate on the subject if you have any experience with 
thread-local GCs.

Would you be interested in making this a druntime PR so you can 
make comments?

Contents of `dmd-own` follows:

#!/usr/bin/env bash

function dmd-own_fn()
{
     local DLANG_SRC_ROOT=${HOME}/Work
     local DMD_ROOT=${DLANG_SRC_ROOT}/dmd
     local DRUNTIME_ROOT=${DLANG_SRC_ROOT}/druntime
     local PHOBOS_ROOT=${DLANG_SRC_ROOT}/phobos
     local BUILD="debug"

     if type clang++ &> /dev/null; then
         local HOST_CXX=clang++
     else
         local HOST_CXX=g++-8
     fi
     HOST_CXX=g++-8 # use g++ for now because building DMD with 
clang++ seems to generate a dmd binary that segfauls

     # rebuild dmd, druntime, phobos on Linux
     command make -f posix.mak BUILD=${BUILD} -C ${DMD_ROOT} 
HOST_CXX=${HOST_CXX} > /dev/null 2> /dev/null
     # command make -f posix.mak BUILD=${BUILD} -C 
${DRUNTIME_ROOT} > /dev/null
     command make -f posix.mak BUILD=${BUILD} -C ${PHOBOS_ROOT} > 
/dev/null

     if [ $# = 0 ]; then
         echo -e "Usage: $FUNCNAME D_SOURCE_FILE ARG
     Example: dmd-own gctester.d --DRT-gcopt=gc:dmitry"
     else
         local FILE="$1"
         local out=$(mktemp)
         local ARG="$2"
         local NEW_DMD=${DMD_ROOT}/generated/linux/${BUILD}/64/dmd
         ${NEW_DMD} -debug -unittest -wi -vcolumns ${PWD}/${FILE} 
-of$out
         $out ${ARG}
     fi
}

dmd-own_fn "$@"


More information about the Digitalmars-d-learn mailing list