# HG changeset patch # User korDen # Date 1256563699 -10800 # Node ID d706d958e4e82f321817cd974486500cd1aa5e9b # Parent 07ced0345cfeca0e047d421057081d4c27eb25bb Step 2 of restoring GC functionality. diff -r 07ced0345cfe -r d706d958e4e8 dmd/Array.d --- a/dmd/Array.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/Array.d Mon Oct 26 16:28:19 2009 +0300 @@ -1,6 +1,6 @@ module dmd.Array; -import dmd.Memory; +import core.memory; import std.contracts; import core.stdc.string; diff -r 07ced0345cfe -r d706d958e4e8 dmd/BaseClass.d --- a/dmd/BaseClass.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/BaseClass.d Mon Oct 26 16:28:19 2009 +0300 @@ -13,7 +13,7 @@ import core.stdc.stdlib; import core.stdc.string; -import dmd.Memory; +import core.memory; class BaseClass { diff -r 07ced0345cfe -r d706d958e4e8 dmd/Expression.d --- a/dmd/Expression.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/Expression.d Mon Oct 26 16:28:19 2009 +0300 @@ -44,10 +44,9 @@ import dmd.backend.elem; import dmd.backend.dt_t; -import dmd.Memory; +import core.memory; import std.stdio : writef; -import core.stdc.stdlib : malloc; import std.conv; diff -r 07ced0345cfe -r d706d958e4e8 dmd/File.d --- a/dmd/File.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/File.d Mon Oct 26 16:28:19 2009 +0300 @@ -9,7 +9,7 @@ import std.string : toStringz; -import dmd.Memory; +import core.memory; class File { diff -r 07ced0345cfe -r d706d958e4e8 dmd/FileName.d --- a/dmd/FileName.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/FileName.d Mon Oct 26 16:28:19 2009 +0300 @@ -5,9 +5,9 @@ import dmd.OutBuffer; import dmd.File; -import dmd.Memory; +import core.memory; -import core.stdc.stdlib : malloc, alloca; +import core.stdc.stdlib : alloca; import core.stdc.string : memcpy, strlen; import core.stdc.ctype : isspace; diff -r 07ced0345cfe -r d706d958e4e8 dmd/Lexer.d --- a/dmd/Lexer.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/Lexer.d Mon Oct 26 16:28:19 2009 +0300 @@ -17,7 +17,7 @@ import std.stdio : writeln; -import dmd.Memory; +import core.memory; import core.stdc.ctype; import core.stdc.stdlib; diff -r 07ced0345cfe -r d706d958e4e8 dmd/Library.d --- a/dmd/Library.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/Library.d Mon Oct 26 16:28:19 2009 +0300 @@ -18,7 +18,7 @@ import std.string; -import dmd.Memory; +import core.memory; align(1) struct LibHeader diff -r 07ced0345cfe -r d706d958e4e8 dmd/Memory.d --- a/dmd/Memory.d Sun Oct 25 03:23:44 2009 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -version (GC_ENABLE) { - extern (C) void* gc_malloc( size_t sz, uint ba = 0 ); - extern (C) void* gc_calloc( size_t sz, uint ba = 0 ); - extern (C) void* gc_realloc( void* p, size_t sz, uint ba = 0 ); - - struct GC - { - alias gc_malloc malloc; - alias gc_calloc calloc; - alias gc_realloc realloc; - alias gc_disable disable; - } -} -else { - import core.stdc.stdlib; - - struct GC - { - alias core.stdc.stdlib.malloc malloc; - alias core.stdc.stdlib.calloc calloc; - alias core.stdc.stdlib.realloc realloc; - } -} \ No newline at end of file diff -r 07ced0345cfe -r d706d958e4e8 dmd/Module.d --- a/dmd/Module.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/Module.d Mon Oct 26 16:28:19 2009 +0300 @@ -56,7 +56,7 @@ import core.stdc.string; import core.stdc.stdlib; -import dmd.Memory; +import core.memory; uint readwordLE(ushort* p) { @@ -929,7 +929,7 @@ outdata(cov); slist_add(cov); - covb = cast(uint*)GC.calloc((numlines + 32) / 32, (*covb).sizeof); + covb = cast(uint*)GC.calloc(((numlines + 32) / 32) * (*covb).sizeof); } for (int i = 0; i < members.dim; i++) diff -r 07ced0345cfe -r d706d958e4e8 dmd/OutBuffer.d --- a/dmd/OutBuffer.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/OutBuffer.d Mon Oct 26 16:28:19 2009 +0300 @@ -6,7 +6,7 @@ import core.stdc.stdlib; import core.stdc.string; -import dmd.Memory; +import core.memory; class OutBuffer { diff -r 07ced0345cfe -r d706d958e4e8 dmd/Parser.d --- a/dmd/Parser.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/Parser.d Mon Oct 26 16:28:19 2009 +0300 @@ -203,7 +203,7 @@ import core.stdc.string : memcpy; import std.contracts; -import dmd.Memory; +import core.memory; class Parser : Lexer { diff -r 07ced0345cfe -r d706d958e4e8 dmd/PragmaDeclaration.d --- a/dmd/PragmaDeclaration.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/PragmaDeclaration.d Mon Oct 26 16:28:19 2009 +0300 @@ -20,7 +20,7 @@ import dmd.backend.Util; import dmd.backend.Symbol; -import dmd.Memory; +import core.memory; class PragmaDeclaration : AttribDeclaration { diff -r 07ced0345cfe -r d706d958e4e8 dmd/ScopeDsymbol.d --- a/dmd/ScopeDsymbol.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/ScopeDsymbol.d Mon Oct 26 16:28:19 2009 +0300 @@ -16,7 +16,7 @@ import dmd.expression.Util; import core.stdc.stdlib; -import dmd.Memory; +import core.memory; class ScopeDsymbol : Dsymbol { diff -r 07ced0345cfe -r d706d958e4e8 dmd/StringExp.d --- a/dmd/StringExp.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/StringExp.d Mon Oct 26 16:28:19 2009 +0300 @@ -27,7 +27,7 @@ import dmd.backend.TYPE; import dmd.backend.OPER; -import dmd.Memory; +import core.memory; import core.stdc.string; diff -r 07ced0345cfe -r d706d958e4e8 dmd/StringTable.d --- a/dmd/StringTable.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/StringTable.d Mon Oct 26 16:28:19 2009 +0300 @@ -7,7 +7,7 @@ import core.stdc.stdlib; import core.stdc.string; -import dmd.Memory; +import core.memory; class StringTable { @@ -17,7 +17,7 @@ this(uint size = 37) { - table = cast(void**)GC.calloc(size, (void*).sizeof); + table = cast(void**)GC.calloc(size * (void*).sizeof); memset(table, 0, size * (void*).sizeof); tabledim = size; count = 0; diff -r 07ced0345cfe -r d706d958e4e8 dmd/SwitchStatement.d --- a/dmd/SwitchStatement.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/SwitchStatement.d Mon Oct 26 16:28:19 2009 +0300 @@ -47,7 +47,7 @@ import dmd.backend.RTLSYM; import dmd.backend.targ_types; -import dmd.Memory; +import core.memory; class SwitchStatement : Statement { diff -r 07ced0345cfe -r d706d958e4e8 dmd/Type.d --- a/dmd/Type.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/Type.d Mon Oct 26 16:28:19 2009 +0300 @@ -63,7 +63,7 @@ import core.stdc.stdio; -import dmd.Memory; +import core.memory; /* These have default values for 32 bit code, they get * adjusted for 64 bit code. diff -r 07ced0345cfe -r d706d958e4e8 dmd/backend/iasm.d --- a/dmd/backend/iasm.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/backend/iasm.d Mon Oct 26 16:28:19 2009 +0300 @@ -41,7 +41,9 @@ import std.string : toStringz; import std.algorithm : min; -import dmd.Memory;import core.stdc.stdio : printf; +import core.memory; + +import core.stdc.stdio : printf; import core.stdc.string : strlen; import core.stdc.limits; diff -r 07ced0345cfe -r d706d958e4e8 dmd/codegen/Util.d --- a/dmd/codegen/Util.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/codegen/Util.d Mon Oct 26 16:28:19 2009 +0300 @@ -55,7 +55,7 @@ import std.string; import core.stdc.string; -import dmd.Memory; +import core.memory; /************************************ * Call a function. diff -r 07ced0345cfe -r d706d958e4e8 dmd/expression/Cat.d --- a/dmd/expression/Cat.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/expression/Cat.d Mon Oct 26 16:28:19 2009 +0300 @@ -14,7 +14,7 @@ import dmd.TypeSArray; import dmd.IntegerExp; -import dmd.Memory; +import core.memory; import core.stdc.string; import core.stdc.stdlib; diff -r 07ced0345cfe -r d706d958e4e8 dmd/expression/Slice.d --- a/dmd/expression/Slice.d Sun Oct 25 03:23:44 2009 +0300 +++ b/dmd/expression/Slice.d Mon Oct 26 16:28:19 2009 +0300 @@ -9,7 +9,7 @@ import dmd.ArrayLiteralExp; import dmd.ArrayTypes; -import dmd.Memory; +import core.memory; import core.stdc.stdlib; import core.stdc.string; diff -r 07ced0345cfe -r d706d958e4e8 main.d --- a/main.d Sun Oct 25 03:23:44 2009 +0300 +++ b/main.d Mon Oct 26 16:28:19 2009 +0300 @@ -123,8 +123,8 @@ _minit(); _moduleCtor(); + GC.disable(); CrashHandlerInit(); - GC.disable(); result = main(cast(string[])args);