Changeset 36

Show
Ignore:
Timestamp:
10/24/08 20:15:55 (4 years ago)
Author:
sean
Message:

* Moved sys into core.sys
* Moved stdc.posix into core.sys.posix
* Moved stdc into core.stdc
* Added initial support for Runtime.loadLibrary() and Runtime.unloadLibrary() in D2. The same functions are exposed in D1, but they are stubbed out for the moment. The basic library loading and unloading should theoretically work, but the GC handle swapping code still needs a look, etc. I left the D1 version stubbed out to make finding GC diffs easier for when I look at the handle swapping code (which is in D2 but not D1). Still not sure about the function naming either... may just switch to load() and unload().

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/D1.0/src/common/core/runtime.d

    r29 r36  
    2323    extern (C) bool rt_init( ExceptionHandler dg = null ); 
    2424    extern (C) bool rt_term( ExceptionHandler dg = null ); 
     25 
     26    extern (C) void* rt_loadLibrary( in char[] name ); 
     27    extern (C) void  rt_unloadLibrary( void* ptr ); 
    2528} 
    2629 
     
    8689    { 
    8790        return rt_isHalting(); 
     91    } 
     92 
     93 
     94    /** 
     95     * Locates a dynamic library with the supplied library name and dynamically 
     96     * loads it into the caller's address space.  If the library contains a D 
     97     * runtime it will be integrated with the current runtime. 
     98     * 
     99     * Params: 
     100     *  name = The name of the dynamic library to load. 
     101     * 
     102     * Returns: 
     103     *  A reference to the library or null on error. 
     104     */ 
     105    static void* loadLibrary( in char[] name ) 
     106    { 
     107        return rt_loadLibrary( name ); 
     108    } 
     109 
     110 
     111    /** 
     112     * Unloads the dynamic library referenced by p.  If this library contains a 
     113     * D runtime then any necessary finalization or cleanup of that runtime 
     114     * will be performed. 
     115     * 
     116     * Params: 
     117     *  p = A reference to the library to unload. 
     118     */ 
     119    static void unloadLibrary( void* p ) 
     120    { 
     121        rt_unloadLibrary( p ); 
    88122    } 
    89123 
  • branches/D1.0/src/common/core/thread.d

    r35 r36  
    8585    private 
    8686    { 
    87         import stdc.stdint : uintptr_t; // for _beginthreadex decl below 
    88         import sys.windows.windows; 
     87        import core.stdc.stdint : uintptr_t; // for _beginthreadex decl below 
     88        import core.sys.windows.windows; 
    8989 
    9090        const DWORD TLS_OUT_OF_INDEXES  = 0xFFFFFFFF; 
     
    152152    private 
    153153    { 
    154         import stdc.posix.semaphore; 
    155         import stdc.posix.pthread; 
    156         import stdc.posix.signal; 
    157         import stdc.posix.time; 
    158         import stdc.errno; 
     154        import core.sys.posix.semaphore; 
     155        import core.sys.posix.pthread; 
     156        import core.sys.posix.signal; 
     157        import core.sys.posix.time; 
     158        import core.stdc.errno; 
    159159 
    160160        extern (C) int getErrno(); 
     
    825825                MAX_SLEEP_MILLIS = uint.max - 1 
    826826            } 
     827 
    827828            period = period < TICKS_PER_MILLI ? 
    828829                        1 : 
     
    853854            { 
    854855                if( period > MAX_SLEEP_TICKS ) 
    855            
    856                 tin.tv_sec = tin.tv_sec.max; 
    857                 tin.tv_nsec = 0; 
    858            
    859             else 
    860            
     856               
     857                    tin.tv_sec = tin.tv_sec.max; 
     858                    tin.tv_nsec = 0; 
     859               
     860                else 
     861               
    861862                    tin.tv_sec = cast(typeof(tin.tv_sec)) (period / TICKS_PER_SECOND); 
    862863                    tin.tv_nsec = cast(typeof(tin.tv_nsec)) (period % TICKS_PER_SECOND) * NANOS_PER_TICK; 
    863             } 
    864  
    865             while( true ) 
    866             { 
    867                 if( !nanosleep( &tin, &tout ) ) 
    868                     return; 
    869                 if( getErrno() != EINTR ) 
     864                } 
     865                while( true ) 
     866                { 
     867                    if( !nanosleep( &tin, &tout ) ) 
     868                        return; 
     869                    if( getErrno() != EINTR ) 
    870870                        throw new ThreadException( "Unable to sleep for the specified duration" ); 
    871                 tin = tout; 
    872            
     871                    tin = tout; 
     872               
    873873                period -= (cast(typeof(period)) tin.tv_sec) * TICKS_PER_SECOND; 
    874874                period -= (cast(typeof(period)) tin.tv_nsec) / NANOS_PER_TICK; 
     
    22582258    version( Posix ) 
    22592259    { 
    2260         import stdc.posix.unistd;   // for sysconf 
    2261         import stdc.posix.sys.mman; // for mmap 
    2262         import stdc.posix.stdlib;   // for malloc, valloc, free 
     2260        import core.sys.posix.unistd;   // for sysconf 
     2261        import core.sys.posix.sys.mman; // for mmap 
     2262        import core.sys.posix.stdlib;   // for malloc, valloc, free 
    22632263 
    22642264        version( AsmX86_Win32 ) {} else 
     
    22722272            //       an obsolescent feature according to the POSIX spec, so a 
    22732273            //       custom solution is still preferred. 
    2274             import stdc.posix.ucontext; 
     2274            import core.sys.posix.ucontext; 
    22752275        } 
    22762276    } 
  • branches/D1.0/src/common/posix.mak

    r32 r36  
    2424#CFLAGS=-g $(ADD_CFLAGS) 
    2525 
    26 DFLAGS=-release -O -inline -w -nofloat -version=Posix $(ADD_DFLAGS) 
    27 #DFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     26DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) 
     27#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2828 
    29 TFLAGS=-O -inline -w -nofloat -version=Posix $(ADD_DFLAGS) 
    30 #TFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     29TFLAGS=-O -inline -w -nofloat $(ADD_DFLAGS) 
     30#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    3131 
    32 DOCFLAGS=-version=DDoc -version=Posix 
     32DOCFLAGS=-version=DDoc 
    3333 
    3434CC=gcc 
     
    7777 
    7878OBJ_STDC= \ 
    79     stdc/errno.o 
     79    core/stdc/errno.o 
    8080 
    8181ALL_OBJS= \ 
     
    114114 
    115115### memory 
     116 
    116117core/memory_.o : core/memory.d 
    117118    $(DC) -c $(DFLAGS) -Hf$*.di $< -of$@ 
     119 
    118120### thread 
    119121 
  • branches/D1.0/src/common/win32.mak

    r29 r36  
    7474 
    7575OBJ_STDC= \ 
    76     stdc\errno.obj 
     76    core\stdc\errno.obj 
    7777 
    7878ALL_OBJS= \ 
  • branches/D1.0/src/compiler/dmd/aaA.d

    r17 r36  
    3636private 
    3737{ 
    38     import stdc.stdarg; 
    39     import stdc.string; 
     38    import core.stdc.stdarg; 
     39    import core.stdc.string; 
    4040 
    4141    enum BlkAttr : uint 
  • branches/D1.0/src/compiler/dmd/adi.d

    r8 r36  
    3939private 
    4040{ 
    41     debug(adi) import stdc.stdio; 
    42     import stdc.string; 
    43     import stdc.stdlib; 
     41    debug(adi) import core.stdc.stdio; 
     42    import core.stdc.string; 
     43    import core.stdc.stdlib; 
    4444    import util.utf; 
    4545 
  • branches/D1.0/src/compiler/dmd/arraycat.d

    r8 r36  
    3434private 
    3535{ 
    36     import stdc.string; 
    37     debug import stdc.stdio; 
     36    import core.stdc.string; 
     37    debug import core.stdc.stdio; 
    3838} 
    3939 
  • branches/D1.0/src/compiler/dmd/cmath2.d

    r8 r36  
    1313module rt.cmath2; 
    1414 
    15 private import stdc.math; 
     15private import core.stdc.math; 
    1616 
    1717extern (C): 
  • branches/D1.0/src/compiler/dmd/cover.d

    r29 r36  
    1818{ 
    1919    version( Windows ) 
    20         import sys.windows.windows; 
     20        import core.sys.windows.windows; 
    2121    else version( Posix ) 
    2222    { 
    23         import stdc.posix.fcntl; 
    24         import stdc.posix.unistd; 
     23        import core.sys.posix.fcntl; 
     24        import core.sys.posix.unistd; 
    2525    } 
    2626    import core.bitmanip; 
    27     import stdc.stdio; 
     27    import core.stdc.stdio; 
    2828    import util.utf; 
    2929 
  • branches/D1.0/src/compiler/dmd/dmain2.d

    r29 r36  
    1414{ 
    1515    import util.console; 
    16     import stdc.stddef; 
    17     import stdc.stdlib; 
    18     import stdc.string; 
    19 
    20  
    21 version(Windows) 
    22 
     16    import core.stdc.stddef; 
     17    import core.stdc.stdlib; 
     18    import core.stdc.string; 
     19
     20 
     21version (Windows) 
     22
     23    extern (Windows) alias int function() FARPROC; 
     24    extern (Windows) FARPROC    GetProcAddress(void*, in char*); 
     25    extern (Windows) void*      LoadLibraryA(in char*); 
     26    extern (Windows) int        FreeLibrary(void*); 
    2327    extern (Windows) void*      LocalFree(void*); 
    2428    extern (Windows) wchar_t*   GetCommandLineW(); 
    2529    extern (Windows) wchar_t**  CommandLineToArgvW(wchar_t*, int*); 
    2630    extern (Windows) export int WideCharToMultiByte(uint, uint, wchar_t*, int, char*, int, char*, int); 
    27     pragma(lib, "shell32.lib");   // needed for CommandLineToArgvW 
     31    pragma(lib, "shell32.lib"); // needed for CommandLineToArgvW 
    2832} 
    2933 
     
    3842extern (C) void _moduleDtor(); 
    3943extern (C) void thread_joinAll(); 
     44 
     45/*********************************** 
     46 * These are a temporary means of providing a GC hook for DLL use.  They may be 
     47 * replaced with some other similar functionality later. 
     48 */ 
     49 
     50extern (C) void* rt_loadLibrary(in char[] name) 
     51{ 
     52    throw new Exception("rt_loadLibrary not yet implemented on linux."); 
     53} 
     54 
     55extern (C) void rt_unloadLibrary(void* ptr) 
     56{ 
     57    throw new Exception("rt_unloadLibrary not yet implemented."); 
     58} 
    4059 
    4160/*********************************** 
  • branches/D1.0/src/compiler/dmd/lifetime.d

    r29 r36  
    3030private 
    3131{ 
    32     import stdc.stdlib; 
    33     import stdc.string; 
    34     import stdc.stdarg; 
    35     debug(PRINTF) import stdc.stdio; 
     32    import core.stdc.stdlib; 
     33    import core.stdc.string; 
     34    import core.stdc.stdarg; 
     35    debug(PRINTF) import core.stdc.stdio; 
    3636} 
    3737 
  • branches/D1.0/src/compiler/dmd/memory.d

    r8 r36  
    141141extern (C) void rt_scanStaticData( scanFn scan ) 
    142142{ 
     143    scan(rt_staticDataBottom(), rt_staticDataTop()); 
     144} 
     145 
     146/** 
     147 * 
     148 */ 
     149extern (C) void* rt_staticDataBottom() 
     150{ 
    143151    version( Windows ) 
    144152    { 
    145         scan( &_xi_a, &_end )
     153        return &_xi_a
    146154    } 
    147155    else version( linux ) 
    148156    { 
    149         scan( &__data_start, &_end )
     157        return &__data_start
    150158    } 
    151159    else 
     
    154162    } 
    155163} 
     164 
     165/** 
     166 * 
     167 */ 
     168extern (C) void* rt_staticDataTop() 
     169{ 
     170    version( Windows ) 
     171    { 
     172        return &_end; 
     173    } 
     174    else version( linux ) 
     175    { 
     176        return &_end; 
     177    } 
     178    else 
     179    { 
     180        static assert( false, "Operating system not supported." ); 
     181    } 
     182} 
  • branches/D1.0/src/compiler/dmd/object_.d

    r30 r36  
    4040private 
    4141{ 
    42     import stdc.string; 
    43     import stdc.stdlib; 
     42    import core.stdc.string; 
     43    import core.stdc.stdlib; 
    4444    import util.string; 
    45     debug(PRINTF) import stdc.stdio; 
     45    debug(PRINTF) import core.stdc.stdio; 
    4646 
    4747    extern (C) void onOutOfMemoryError(); 
  • branches/D1.0/src/compiler/dmd/posix.mak

    r16 r36  
    2121#CFLAGS=-g $(ADD_CFLAGS) 
    2222 
    23 DFLAGS=-release -O -inline -w -nofloat -version=Posix $(ADD_DFLAGS) 
    24 #DFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     23DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) 
     24#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2525 
    26 TFLAGS=-O -inline -w -nofloat -version=Posix $(ADD_DFLAGS) 
    27 #TFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     26TFLAGS=-O -inline -w -nofloat $(ADD_DFLAGS) 
     27#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2828 
    29 DOCFLAGS=-version=DDoc -version=Posix 
     29DOCFLAGS=-version=DDoc 
    3030 
    3131CC=gcc 
  • branches/D1.0/src/compiler/dmd/qsort2.d

    r8 r36  
    1818//debug=qsort; 
    1919 
    20 private import stdc.stdlib; 
     20private import core.stdc.stdlib; 
    2121 
    2222struct Array 
  • branches/D1.0/src/compiler/dmd/switch_.d

    r8 r36  
    2828module rt.switch_; 
    2929 
    30 private import stdc.string; 
     30private import core.stdc.string; 
    3131 
    3232/****************************************************** 
  • branches/D1.0/src/compiler/dmd/trace.d

    r29 r36  
    1717{ 
    1818    import util.string; 
    19     import stdc.ctype; 
    20     import stdc.stdio; 
    21     import stdc.string; 
    22     import stdc.stdlib; 
     19    import core.stdc.ctype; 
     20    import core.stdc.stdio; 
     21    import core.stdc.string; 
     22    import core.stdc.stdlib; 
    2323} 
    2424 
  • branches/D1.0/src/compiler/dmd/typeinfo/ti_Ag.d

    r8 r36  
    33 
    44private import util.string; 
    5 private import stdc.string; 
     5private import core.stdc.string; 
    66 
    77// byte[] 
  • branches/D1.0/src/compiler/dmd/typeinfo/ti_Aint.d

    r8 r36  
    22module rt.typeinfo.ti_Aint; 
    33 
    4 private import stdc.string; 
     4private import core.stdc.string; 
    55 
    66// int[] 
  • branches/D1.0/src/compiler/dmd/typeinfo/ti_Along.d

    r8 r36  
    22module rt.typeinfo.ti_Along; 
    33 
    4 private import stdc.string; 
     4private import core.stdc.string; 
    55 
    66// long[] 
  • branches/D1.0/src/compiler/dmd/typeinfo/ti_Ashort.d

    r8 r36  
    22module rt.typeinfo.ti_Ashort; 
    33 
    4 private import stdc.string; 
     4private import core.stdc.string; 
    55 
    66// short[] 
  • branches/D1.0/src/compiler/dmd/util/console.d

    r8 r36  
    1313    version (Windows) 
    1414    { 
    15         import sys.windows.windows; 
     15        import core.sys.windows.windows; 
    1616    } 
    1717    else version( Posix ) 
    1818    { 
    19         import stdc.posix.unistd; 
     19        import core.sys.posix.unistd; 
    2020    } 
    2121    import util.string; 
  • branches/D1.0/src/compiler/dmd/util/cpuid.d

    r14 r36  
    4141module rt.util.cpuid; 
    4242 
    43 private import stdc.string; 
     43private import core.stdc.string; 
    4444 
    4545version(D_InlineAsm_X86) 
  • branches/D1.0/src/compiler/dmd/util/string.d

    r8 r36  
    99module rt.util.string; 
    1010 
    11 private import stdc.string; 
     11private import core.stdc.string; 
    1212 
    1313char[] intToString( char[] buf, uint val ) 
    1414{ 
    1515    assert( buf.length > 9 ); 
    16     char* p = buf.ptr + buf.length; 
     16    auto p = buf.ptr + buf.length; 
    1717 
    1818    do 
    1919    { 
    20         *--p = val % 10 + '0'
     20        *--p = cast(char)(val % 10 + '0')
    2121    } while( val /= 10 ); 
    2222 
  • branches/D1.0/src/dmd-win32.mak

    r29 r36  
    1818DIR_RT=compiler\dmd 
    1919DIR_GC=gc\basic 
     20DIR_GC_STUB=gc\stub 
    2021 
    2122LIB_CC=$(DIR_CC)\druntime-core.lib 
     
    5960    make -fwin32.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" 
    6061    cd ..\.. 
     62    cd $(DIR_GC_STUB) 
     63    make -fwin32.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)" 
     64    cd ..\.. 
    6165    $(RM) $(LIB_TARGET) 
    6266    $(LC) -c -n $(LIB_TARGET) $(LIB_CC) $(LIB_RT) $(LIB_GC) 
    6367    $(RM) $(DUP_TARGET) 
    6468    copy $(LIB_TARGET) $(DUP_TARGET) 
     69 
    6570 
    6671doc : $(ALL_DOCS) 
     
    7277    cd ..\.. 
    7378    cd $(DIR_GC) 
     79    make -fwin32.mak doc DC=$(DC) 
     80    cd ..\.. 
     81    cd $(DIR_GC_STUB) 
    7482    make -fwin32.mak doc DC=$(DC) 
    7583    cd ..\.. 
     
    9098    make -fwin32.mak clean 
    9199    cd ..\.. 
     100    cd $(DIR_GC_STUB) 
     101    make -fwin32.mak clean 
     102    cd ..\.. 
    92103    $(RM) $(LIB_MASK) 
    93104 
     
    102113    make -fwin32.mak install 
    103114    cd ..\.. 
     115    cd $(DIR_GC_STUB) 
     116    make -fwin32.mak install 
     117    cd ..\.. 
    104118    $(CP) $(LIB_MASK) $(LIB_DEST)\. 
  • branches/D1.0/src/gc/basic/gc.d

    r29 r36  
    2929private import gcx; 
    3030private import gcstats; 
    31 private import stdc.stdlib; 
     31private import core.stdc.stdlib; 
    3232 
    3333version=GCCLASS; 
  • branches/D1.0/src/gc/basic/gcalloc.d

    r29 r36  
    3030version (Windows) 
    3131{ 
    32     private import sys.windows.windows; 
     32    private import core.sys.windows.windows; 
    3333 
    3434    alias int pthread_t; 
     
    4343else version (Posix) 
    4444{ 
    45     private import stdc.posix.sys.mman; 
    46     private import stdc.stdlib; 
     45    private import core.sys.posix.sys.mman; 
     46    private import core.stdc.stdlib; 
    4747 
    4848    //version = GC_Use_Alloc_MMap; 
     
    5050else 
    5151{ 
    52     private import stdc.stdlib; 
     52    private import core.stdc.stdlib; 
    5353 
    5454    //version = GC_Use_Alloc_Malloc; 
  • branches/D1.0/src/gc/basic/gcbits.d

    r29 r36  
    3131{ 
    3232    import core.bitmanip; 
    33     import stdc.string; 
    34     import stdc.stdlib; 
     33    import core.stdc.string; 
     34    import core.stdc.stdlib; 
    3535    extern (C) void onOutOfMemoryError(); 
    3636} 
  • branches/D1.0/src/gc/basic/gcx.d

    r29 r36  
    5353private import gcalloc; 
    5454 
    55 private import cstdlib = stdc.stdlib : calloc, free, malloc, realloc; 
    56 private import stdc.string; 
    57  
    58 debug private import stdc.stdio; 
     55private import cstdlib = core.stdc.stdlib : calloc, free, malloc, realloc; 
     56private import core.stdc.string; 
     57 
     58debug private import core.stdc.stdio; 
    5959 
    6060version (GNU) 
  • branches/D1.0/src/gc/basic/posix.mak

    r16 r36  
    2424#CFLAGS=-g $(ADD_CFLAGS) 
    2525 
    26 DFLAGS=-release -O -inline -w -nofloat -version=Posix $(ADD_DFLAGS) 
    27 #DFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     26DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) 
     27#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2828 
    29 TFLAGS=-O -inline -w -nofloat -version=Posix $(ADD_DFLAGS) 
    30 #TFLAGS=-g -w -nofloat -version=Posix $(ADD_DFLAGS) 
     29TFLAGS=-O -inline -w -nofloat $(ADD_DFLAGS) 
     30#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    3131 
    32 DOCFLAGS=-version=DDoc -version=Posix 
     32DOCFLAGS=-version=DDoc 
    3333 
    3434CC=gcc 
  • branches/D1.0/src/gc/stub/gc.d

    r29 r36  
    2121module gc.gc; 
    2222 
    23 private import stdc.stdlib; 
     23private import core.stdc.stdlib; 
    2424 
    2525private 
  • branches/D1.0/src/gc/stub/posix.mak

    r16 r36  
    1111#       Delete unneeded files created by build process 
    1212 
    13 LIB_TARGET=druntime-gc-stub.a 
    14 LIB_MASK=druntime-gc-stub*.a 
     13LIB_TARGET=libdruntime-gc-stub.a 
     14LIB_MASK=libdruntime-gc-stub*.a 
    1515 
    1616CP=cp -f 
     
    2121ADD_DFLAGS= 
    2222 
    23 CFLAGS=-O -m32 $(ADD_CFLAGS) 
    24 #CFLAGS=-g -m32 $(ADD_CFLAGS) 
     23CFLAGS=-O $(ADD_CFLAGS) 
     24#CFLAGS=-g $(ADD_CFLAGS) 
    2525 
    26 ### warnings disabled because gcx has issues ### 
     26DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) 
     27#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2728 
    28 DFLAGS=-release -O -inline -version=Posix $(ADD_DFLAGS) 
    29 #DFLAGS=-g -version=Posix $(ADD_DFLAGS) 
    3029 
    31 TFLAGS=-O -inline -version=Posix $(ADD_DFLAGS) 
    32 #TFLAGS=-g -version=Posix $(ADD_DFLAGS) 
     30TFLAGS=-O -inline -w -nofloat $(ADD_DFLAGS) 
     31#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    3332 
    34 DOCFLAGS=-version=DDoc -version=Posix 
     33DOCFLAGS=-version=DDoc 
    3534 
    3635CC=gcc 
     
    3837DC=dmd 
    3938 
    40 LIB_DEST=.. 
     39LIB_DEST=../../../lib 
    4140 
    4241.SUFFIXES: .s .S .c .cpp .d .html .o 
  • branches/D1.0/src/gc/stub/win32.mak

    r16 r36  
    1111#       Delete unneeded files created by build process 
    1212 
    13 LIB_TARGET=tango-gc-stub.lib 
    14 LIB_MASK=tango-gc-stub*.lib 
     13LIB_TARGET=druntime-gc-stub.lib 
     14LIB_MASK=druntime-gc-stub*.lib 
    1515 
    1616CP=xcopy /y 
     
    2424#CFLAGS=-g -mn -6 -r $(ADD_CFLAGS) 
    2525 
    26 ### warnings disabled because gcx has issues ### 
     26DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) 
     27#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2728 
    28 DFLAGS=-release -O -inline $(ADD_DFLAGS) 
    29 #DFLAGS=-g -release $(ADD_DFLAGS) 
    3029 
    31 TFLAGS=-O -inline $(ADD_DFLAGS) 
    32 #TFLAGS=-g $(ADD_DFLAGS) 
     30TFLAGS=-O -inline -w  -nofloat $(ADD_DFLAGS) 
     31#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    3332 
    3433DOCFLAGS=-version=DDoc 
     
    3837DC=dmd 
    3938 
    40 LIB_DEST=.. 
     39LIB_DEST=..\..\..\lib 
    4140 
    4241.DEFAULT: .asm .c .cpp .d .html .obj 
     
    9493    $(MD) $(LIB_DEST) 
    9594    $(CP) $(LIB_MASK) $(LIB_DEST)\. 
     95    copy gc.obj $(LIB_DEST)\gcstub.obj 
  • trunk/src/common/core/memory.d

    r33 r36  
    4848    extern (C) void gc_removeRoot( void* p ); 
    4949    extern (C) void gc_removeRange( void* p ); 
    50  
    51     extern (C) void* gc_getHandle(); 
    52     extern (C) void gc_setHandle( void* p ); 
    53     extern (C) void gc_endHandle(); 
    5450} 
    5551 
     
    446442        gc_removeRange( p ); 
    447443    } 
    448  
    449     /** 
    450      * Get handle to the collector. 
    451      * The only thing that can be done with this handle is pass it to 
    452      * setHandle(). getHandle/setHandle/endHandle work together so that 
    453      * if there are multiple instances of the gc running, only one instance 
    454      * can be set to run. 
    455      * The most common case of this is under Windows where a D application 
    456      * calls functions in a DLL that is implemented in D. 
    457      */ 
    458  
    459     static void* getHandle() 
    460     { 
    461     return gc_getHandle(); 
    462     } 
    463  
    464     /** 
    465      * Set handle to the collector. 
    466      * The handle p is an opaque handle, acquired by a call to 
    467      * getHandle(). 
    468      */ 
    469  
    470     static void setHandle(void* p) 
    471     { 
    472     gc_setHandle(p); 
    473     } 
    474  
    475     /** 
    476      * Call when done using the collector specified by the 
    477      * call to setHandle(). 
    478      */ 
    479  
    480     static void endHandle() 
    481     { 
    482     gc_endHandle(); 
    483     } 
    484444} 
  • trunk/src/common/core/runtime.d

    r29 r36  
    2323    extern (C) bool rt_init( ExceptionHandler dg = null ); 
    2424    extern (C) bool rt_term( ExceptionHandler dg = null ); 
     25 
     26    extern (C) void* rt_loadLibrary( in char[] name ); 
     27    extern (C) void  rt_unloadLibrary( void* ptr ); 
    2528} 
    2629 
     
    8689    { 
    8790        return rt_isHalting(); 
     91    } 
     92 
     93 
     94    /** 
     95     * Locates a dynamic library with the supplied library name and dynamically 
     96     * loads it into the caller's address space.  If the library contains a D 
     97     * runtime it will be integrated with the current runtime. 
     98     * 
     99     * Params: 
     100     *  name = The name of the dynamic library to load. 
     101     * 
     102     * Returns: 
     103     *  A reference to the library or null on error. 
     104     */ 
     105    static void* loadLibrary( in char[] name ) 
     106    { 
     107        return rt_loadLibrary( name ); 
     108    } 
     109 
     110 
     111    /** 
     112     * Unloads the dynamic library referenced by p.  If this library contains a 
     113     * D runtime then any necessary finalization or cleanup of that runtime 
     114     * will be performed. 
     115     * 
     116     * Params: 
     117     *  p = A reference to the library to unload. 
     118     */ 
     119    static void unloadLibrary( void* p ) 
     120    { 
     121        rt_unloadLibrary( p ); 
    88122    } 
    89123 
  • trunk/src/common/core/thread.d

    r35 r36  
    8585    private 
    8686    { 
    87         import stdc.stdint : uintptr_t; // for _beginthreadex decl below 
    88         import sys.windows.windows; 
     87        import core.stdc.stdint : uintptr_t; // for _beginthreadex decl below 
     88        import core.sys.windows.windows; 
    8989 
    9090        const DWORD TLS_OUT_OF_INDEXES  = 0xFFFFFFFF; 
     
    152152    private 
    153153    { 
    154         import stdc.posix.semaphore; 
    155         import stdc.posix.pthread; 
    156         import stdc.posix.signal; 
    157         import stdc.posix.time; 
    158         import stdc.errno; 
     154        import core.sys.posix.semaphore; 
     155        import core.sys.posix.pthread; 
     156        import core.sys.posix.signal; 
     157        import core.sys.posix.time; 
     158        import core.stdc.errno; 
    159159 
    160160        extern (C) int getErrno(); 
     161 
    161162        version( GNU ) 
    162163        { 
     
    22572258    version( Posix ) 
    22582259    { 
    2259         import stdc.posix.unistd;   // for sysconf 
    2260         import stdc.posix.sys.mman; // for mmap 
    2261         import stdc.posix.stdlib;   // for malloc, valloc, free 
     2260        import core.sys.posix.unistd;   // for sysconf 
     2261        import core.sys.posix.sys.mman; // for mmap 
     2262        import core.sys.posix.stdlib;   // for malloc, valloc, free 
    22622263 
    22632264        version( AsmX86_Win32 ) {} else 
     
    22712272            //       an obsolescent feature according to the POSIX spec, so a 
    22722273            //       custom solution is still preferred. 
    2273             import stdc.posix.ucontext; 
     2274            import core.sys.posix.ucontext; 
    22742275        } 
    22752276    } 
  • trunk/src/common/posix.mak

    r33 r36  
    7777 
    7878OBJ_STDC= \ 
    79     stdc/errno.o 
     79    core/stdc/errno.o 
    8080 
    8181ALL_OBJS= \ 
  • trunk/src/common/win32.mak

    r29 r36  
    7474 
    7575OBJ_STDC= \ 
    76     stdc\errno.obj 
     76    core\stdc\errno.obj 
    7777 
    7878ALL_OBJS= \ 
  • trunk/src/compiler/dmd/aaA.d

    r17 r36  
    3636private 
    3737{ 
    38     import stdc.stdarg; 
    39     import stdc.string; 
     38    import core.stdc.stdarg; 
     39    import core.stdc.string; 
    4040 
    4141    enum BlkAttr : uint 
  • trunk/src/compiler/dmd/adi.d

    r6 r36  
    3939private 
    4040{ 
    41     debug(adi) import stdc.stdio; 
    42     import stdc.string; 
    43     import stdc.stdlib; 
     41    debug(adi) import core.stdc.stdio; 
     42    import core.stdc.string; 
     43    import core.stdc.stdlib; 
    4444    import util.utf; 
    4545 
  • trunk/src/compiler/dmd/arrayassign.d

    r10 r36  
    1010{ 
    1111    import util.string; 
    12     import stdc.string; 
    13     import stdc.stdlib; 
    14     debug(PRINTF) import stdc.stdio; 
     12    import core.stdc.string; 
     13    import core.stdc.stdlib; 
     14    debug(PRINTF) import core.stdc.stdio; 
    1515} 
    1616 
  • trunk/src/compiler/dmd/arraycat.d

    r5 r36  
    3434private 
    3535{ 
    36     import stdc.string; 
    37     debug import stdc.stdio; 
     36    import core.stdc.string; 
     37    debug import core.stdc.stdio; 
    3838} 
    3939 
  • trunk/src/compiler/dmd/cmath2.d

    r5 r36  
    1313module rt.cmath2; 
    1414 
    15 private import stdc.math; 
     15private import core.stdc.math; 
    1616 
    1717extern (C): 
  • trunk/src/compiler/dmd/cover.d

    r29 r36  
    1818{ 
    1919    version( Windows ) 
    20         import sys.windows.windows; 
     20        import core.sys.windows.windows; 
    2121    else version( Posix ) 
    2222    { 
    23         import stdc.posix.fcntl; 
    24         import stdc.posix.unistd; 
     23        import core.sys.posix.fcntl; 
     24        import core.sys.posix.unistd; 
    2525    } 
    2626    import core.bitmanip; 
    27     import stdc.stdio; 
     27    import core.stdc.stdio; 
    2828    import util.utf; 
    2929 
  • trunk/src/compiler/dmd/dmain2.d

    r29 r36  
    1414{ 
    1515    import util.console; 
    16     import stdc.stddef; 
    17     import stdc.stdlib; 
    18     import stdc.string; 
    19 
    20  
    21 version(Windows) 
    22 
     16    import core.stdc.stddef; 
     17    import core.stdc.stdlib; 
     18    import core.stdc.string; 
     19
     20 
     21version (Windows) 
     22
     23    extern (Windows) alias int function() FARPROC; 
     24    extern (Windows) FARPROC    GetProcAddress(void*, in char*); 
     25    extern (Windows) void*      LoadLibraryA(in char*); 
     26    extern (Windows) int        FreeLibrary(void*); 
    2327    extern (Windows) void*      LocalFree(void*); 
    2428    extern (Windows) wchar_t*   GetCommandLineW(); 
    2529    extern (Windows) wchar_t**  CommandLineToArgvW(wchar_t*, int*); 
    2630    extern (Windows) export int WideCharToMultiByte(uint, uint, wchar_t*, int, char*, int, char*, int); 
    27     pragma(lib, "shell32.lib");   // needed for CommandLineToArgvW 
     31    pragma(lib, "shell32.lib"); // needed for CommandLineToArgvW 
    2832} 
    2933 
     
    3842extern (C) void _moduleDtor(); 
    3943extern (C) void thread_joinAll(); 
     44 
     45/*********************************** 
     46 * These are a temporary means of providing a GC hook for DLL use.  They may be 
     47 * replaced with some other similar functionality later. 
     48 */ 
     49extern (C) 
     50{ 
     51    void* gc_getHandle(); 
     52    void  gc_setHandle(void* p); 
     53    void  gc_clrHandle(); 
     54 
     55    alias void* function()      gcGetFn; 
     56    alias void  function(void*) gcSetFn; 
     57    alias void  function()      gcClrFn; 
     58    alias bool  function(ExceptionHandler dg = null) rtInitFn; 
     59    alias bool  function(ExceptionHandler dg = null) rtTermFn; 
     60} 
     61 
     62extern (C) void* rt_loadLibrary(in char[] name) 
     63{ 
     64    version (Windows) 
     65    { 
     66        char[260] temp = void; 
     67        temp[0 .. name.length] = name[]; 
     68        temp[name.length] = cast(char) 0; 
     69        void* ptr = LoadLibraryA(temp.ptr); 
     70        if (ptr is null) 
     71            return ptr; 
     72        gcSetFn  gcSet = cast(gcSetFn) GetProcAddress(ptr, "_gc_setHandle"); 
     73        rtInitFn rtInit = cast(rtInitFn) GetProcAddress(ptr, "_rt_init"); 
     74        if (gcSet is null || rtInit is null) 
     75            return ptr; 
     76        gcSet(gc_getHandle()); 
     77        rtInit(); 
     78        return ptr; 
     79 
     80    } 
     81    else version (linux) 
     82    { 
     83        throw new Exception("rt_loadLibrary not yet implemented on linux."); 
     84    } 
     85} 
     86 
     87extern (C) void rt_unloadLibrary(void* ptr) 
     88{ 
     89    version (Windows) 
     90    { 
     91        gcClrFn  gcClr  = cast(gcClrFn) GetProcAddress(ptr, "_gc_clrHandle"); 
     92        rtTermFn rtTerm = cast(rtTermFn) GetProcAddress(ptr, "_rt_term"); 
     93 
     94        if (gcClr !is null && rtTerm !is null) 
     95        { 
     96            rtTerm(); 
     97            gcClr(); 
     98        } 
     99        return FreeLibrary(ptr) != 0; 
     100    } 
     101    else version (linux) 
     102    { 
     103        throw new Exception("rt_unloadLibrary not yet implemented on linux."); 
     104    } 
     105} 
    40106 
    41107/*********************************** 
  • trunk/src/compiler/dmd/lifetime.d

    r29 r36  
    3030private 
    3131{ 
    32     import stdc.stdlib; 
    33     import stdc.string; 
    34     import stdc.stdarg; 
    35     debug(PRINTF) import stdc.stdio; 
     32    import core.stdc.stdlib; 
     33    import core.stdc.string; 
     34    import core.stdc.stdarg; 
     35    debug(PRINTF) import core.stdc.stdio; 
    3636} 
    3737 
  • trunk/src/compiler/dmd/memory.d

    r33 r36  
    181181    } 
    182182} 
    183  
    184  
  • trunk/src/compiler/dmd/object_.d

    r30 r36  
    4040private 
    4141{ 
    42     import stdc.string; 
    43     import stdc.stdlib; 
     42    import core.stdc.string; 
     43    import core.stdc.stdlib; 
    4444    import util.string; 
    45     debug(PRINTF) import stdc.stdio; 
     45    debug(PRINTF) import core.stdc.stdio; 
    4646 
    4747    extern (C) void onOutOfMemoryError(); 
  • trunk/src/compiler/dmd/qsort2.d

    r5 r36  
    1818//debug=qsort; 
    1919 
    20 private import stdc.stdlib; 
     20private import core.stdc.stdlib; 
    2121 
    2222struct Array 
  • trunk/src/compiler/dmd/switch_.d

    r5 r36  
    2828module rt.switch_; 
    2929 
    30 private import stdc.string; 
     30private import core.stdc.string; 
    3131 
    3232/****************************************************** 
  • trunk/src/compiler/dmd/trace.d

    r20 r36  
    1717{ 
    1818    import util.string; 
    19     import stdc.ctype; 
    20     import stdc.stdio; 
    21     import stdc.string; 
    22     import stdc.stdlib; 
     19    import core.stdc.ctype; 
     20    import core.stdc.stdio; 
     21    import core.stdc.string; 
     22    import core.stdc.stdlib; 
    2323} 
    2424 
  • trunk/src/compiler/dmd/typeinfo/ti_Ag.d

    r7 r36  
    33 
    44private import util.string; 
    5 private import stdc.string; 
     5private import core.stdc.string; 
    66 
    77// byte[] 
  • trunk/src/compiler/dmd/typeinfo/ti_Aint.d

    r7 r36  
    22module rt.typeinfo.ti_Aint; 
    33 
    4 private import stdc.string; 
     4private import core.stdc.string; 
    55 
    66// int[] 
  • trunk/src/compiler/dmd/typeinfo/ti_Along.d

    r7 r36  
    22module rt.typeinfo.ti_Along; 
    33 
    4 private import stdc.string; 
     4private import core.stdc.string; 
    55 
    66// long[] 
  • trunk/src/compiler/dmd/typeinfo/ti_Ashort.d

    r7 r36  
    22module rt.typeinfo.ti_Ashort; 
    33 
    4 private import stdc.string; 
     4private import core.stdc.string; 
    55 
    66// short[] 
  • trunk/src/compiler/dmd/util/console.d

    r5 r36  
    1313    version (Windows) 
    1414    { 
    15         import sys.windows.windows; 
     15        import core.sys.windows.windows; 
    1616    } 
    1717    else version( Posix ) 
    1818    { 
    19         import stdc.posix.unistd; 
     19        import core.sys.posix.unistd; 
    2020    } 
    2121    import util.string; 
  • trunk/src/compiler/dmd/util/cpuid.d

    r7 r36  
    4141module rt.util.cpuid; 
    4242 
    43 private import stdc.string; 
     43private import core.stdc.string; 
    4444 
    4545version(D_InlineAsm_X86) 
  • trunk/src/compiler/dmd/util/string.d

    r20 r36  
    99module rt.util.string; 
    1010 
    11 private import stdc.string; 
     11private import core.stdc.string; 
    1212 
    1313char[] intToString( char[] buf, uint val ) 
  • trunk/src/gc/basic/gc.d

    r33 r36  
    2929private import gcx; 
    3030private import gcstats; 
    31 private import stdc.stdlib; 
     31private import core.stdc.stdlib; 
    3232 
    3333version=GCCLASS; 
  • trunk/src/gc/basic/gcalloc.d

    r29 r36  
    3030version (Windows) 
    3131{ 
    32     private import sys.windows.windows; 
     32    private import core.sys.windows.windows; 
    3333 
    3434    alias int pthread_t; 
     
    4343else version (Posix) 
    4444{ 
    45     private import stdc.posix.sys.mman; 
    46     private import stdc.stdlib; 
     45    private import core.sys.posix.sys.mman; 
     46    private import core.stdc.stdlib; 
    4747 
    4848    //version = GC_Use_Alloc_MMap; 
     
    5050else 
    5151{ 
    52     private import stdc.stdlib; 
     52    private import core.stdc.stdlib; 
    5353 
    5454    //version = GC_Use_Alloc_Malloc; 
  • trunk/src/gc/basic/gcbits.d

    r29 r36  
    3131{ 
    3232    import core.bitmanip; 
    33     import stdc.string; 
    34     import stdc.stdlib; 
     33    import core.stdc.string; 
     34    import core.stdc.stdlib; 
    3535    extern (C) void onOutOfMemoryError(); 
    3636} 
  • trunk/src/gc/basic/gcx.d

    r33 r36  
    5353private import gcalloc; 
    5454 
    55 private import cstdlib = stdc.stdlib : calloc, free, malloc, realloc; 
    56 private import stdc.string; 
    57  
    58 debug private import stdc.stdio; 
     55private import cstdlib = core.stdc.stdlib : calloc, free, malloc, realloc; 
     56private import core.stdc.string; 
     57 
     58debug private import core.stdc.stdio; 
    5959 
    6060version (GNU) 
  • trunk/src/gc/stub/gc.d

    r33 r36  
    2121module gc.gc; 
    2222 
    23 private import stdc.stdlib; 
     23private import core.stdc.stdlib; 
    2424 
    2525private 
  • trunk/src/gc/stub/posix.mak

    r33 r36  
    1111#       Delete unneeded files created by build process 
    1212 
    13 LIB_TARGET=druntime-gc-stub.a 
    14 LIB_MASK=druntime-gc-stub*.a 
     13LIB_TARGET=libdruntime-gc-stub.a 
     14LIB_MASK=libdruntime-gc-stub*.a 
    1515 
    1616CP=cp -f 
     
    2121ADD_DFLAGS= 
    2222 
    23 CFLAGS=-O -m32 $(ADD_CFLAGS) 
    24 #CFLAGS=-g -m32 $(ADD_CFLAGS) 
     23CFLAGS=-O $(ADD_CFLAGS) 
     24#CFLAGS=-g $(ADD_CFLAGS) 
    2525 
    26 ### warnings disabled because gcx has issues ### 
     26DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) 
     27#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2728 
    28 DFLAGS=-release -O -inline $(ADD_DFLAGS) 
    29 #DFLAGS=-g $(ADD_DFLAGS) 
    3029 
    31 TFLAGS=-O -inline $(ADD_DFLAGS) 
    32 #TFLAGS=-g $(ADD_DFLAGS) 
     30TFLAGS=-O -inline -w -nofloat $(ADD_DFLAGS) 
     31#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    3332 
    3433DOCFLAGS=-version=DDoc 
     
    3837DC=dmd 
    3938 
    40 LIB_DEST=.. 
     39LIB_DEST=../../../lib 
    4140 
    4241.SUFFIXES: .s .S .c .cpp .d .html .o 
  • trunk/src/gc/stub/win32.mak

    r34 r36  
    2424#CFLAGS=-g -mn -6 -r $(ADD_CFLAGS) 
    2525 
    26 ### warnings disabled because gcx has issues ### 
     26DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) 
     27#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    2728 
    28 DFLAGS=-release -O -inline $(ADD_DFLAGS) 
    29 #DFLAGS=-g -release $(ADD_DFLAGS) 
    3029 
    31 TFLAGS=-O -inline $(ADD_DFLAGS) 
    32 #TFLAGS=-g $(ADD_DFLAGS) 
     30TFLAGS=-O -inline -w  -nofloat $(ADD_DFLAGS) 
     31#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) 
    3332 
    3433DOCFLAGS=-version=DDoc