Applied downs' latest Phobos patch

This commit is contained in:
Tomas Lindquist Olsen
2008-10-06 21:40:33 +02:00
parent 0bd282113b
commit 1fe1354a8a
18 changed files with 2479 additions and 2445 deletions

View File

@@ -5,8 +5,8 @@ mkdir -p obj
rm -f obj/*.bc
rm -f ../lib/*.bc
LLVMDCFLAGS="-c -odobj -oq -gc -noasm"
LLVMDCFLAGS_ASM="-c -odobj -oq -gc"
LLVMDCFLAGS_ASM="-c -oq -release"
LLVMDCFLAGS="$LLVMDCFLAGS_ASM -noasm"
echo "compiling contract runtime"
llvmdc internal/contract.d -c -of../lib/llvmdcore.bc || exit 1 #-noruntime || exit 1
@@ -16,8 +16,10 @@ echo "compiling common runtime"
internal/mem.d \
internal/critical.d \
internal/dmain2.d \
internal/inv.d \
$LLVMDCFLAGS_ASM || exit 1
mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc obj/internal.*.bc ../lib/llvmdcore.bc
echo "compiling typeinfo 1"
./llvmdc-build typeinfos1.d $LLVMDCFLAGS || exit 1
@@ -47,24 +49,26 @@ mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc obj/aApply.bc obj/aApplyR.bc obj/switch.bc ../lib/llvmdcore.bc || exit 1
echo "compiling array runtime support"
llvmdc internal/qsort2.d $LLVMDCFLAGS || exit 1
llvmdc internal/qsort2.d internal/adi.d internal/aaA.d $LLVMDCFLAGS || exit 1
mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc obj/qsort2.bc ../lib/llvmdcore.bc || exit 1
llvmdc internal/adi.d $LLVMDCFLAGS || exit 1
mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc obj/adi.bc ../lib/llvmdcore.bc || exit 1
llvmdc internal/aaA.d $LLVMDCFLAGS || exit 1
mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc obj/aaA.bc ../lib/llvmdcore.bc || exit 1
llvm-link -f -o=../lib/llvmdcore.bc obj/qsort2.bc obj/adi.bc obj/aaA.bc ../lib/llvmdcore.bc || exit 1
echo "compiling object implementation"
llvmdc internal/objectimpl.d -c -odobj -g || exit 1
llvmdc internal/objectimpl.d $LLVMDCFLAGS || exit 1
mv object.bc objectimpl.bc
mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc obj/objectimpl.bc ../lib/llvmdcore.bc || exit 1
echo "compiling llvm runtime support"
./llvmdc-build llvmsupport.d $LLVMDCFLAGS || exit 1
echo "compiling crc32"
llvmdc crc32.d $LLVMDCFLAGS || exit 1
mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc `ls obj/llvm.*.bc` ../lib/llvmdcore.bc || exit 1
llvm-link -f -o=../lib/llvmdcore.bc ../lib/llvmdcore.bc obj/crc32.bc || exit 1
echo "compiling llvm runtime support"
# ./llvmdc-build llvmsupport.d $LLVMDCFLAGS || exit 1
llvmdc llvmsupport.d -oq -c || exit 1
mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc `ls obj/llvm*.bc` ../lib/llvmdcore.bc || exit 1
echo "compiling garbage collector"
cd gc
@@ -72,17 +76,22 @@ llvmdc $(ls *.d |grep -v win32) $LLVMDCFLAGS_ASM -I.. ||exit 1
# llvmdc gclinux.d $LLVMDCFLAGS -I.. || exit 1
# llvmdc gcx.d $LLVMDCFLAGS -I.. || exit 1
# llvmdc gcbits.d $LLVMDCFLAGS -I.. || exit 1
# llvmdc gc.d $LLVMDCFLAGS -I.. || exit 1
mv std.gc.bc gc.bc
# llvmdc gc.d -oq -c -I.. || exit 1
mv std.gc.bc std_gc.bc
mv *.bc ../obj
# mv -v obj/*.bc ../obj
cd ..
llvm-link -f -o=../lib/llvmdcore.bc obj/gclinux.bc obj/gcx.bc obj/gcbits.bc obj/gc.bc ../lib/llvmdcore.bc || exit 1
llvm-link -f -o=../lib/llvmdcore.bc obj/gclinux.bc obj/gcx.bc obj/gcbits.bc obj/std_gc.bc ../lib/llvmdcore.bc || exit 1
echo "compiling phobos"
./llvmdc-build phobos.d $LLVMDCFLAGS || exit 1
mv *.bc obj
echo "linking phobos"
llvm-link -f -o=../lib/llvmdcore.bc `ls obj/std.*.bc` ../lib/llvmdcore.bc || exit 1
# llvm-link -f -o=../lib/llvmdcore.bc `ls obj/std.*.bc` ../lib/llvmdcore.bc || exit 1
for i in $(ls obj/std.*.bc); do
echo $i
llvm-link -f -o=../lib/llvmdcore.bc ../lib/llvmdcore.bc $i || exit 1
done
echo "Compiling auxiliary"
./llvmdc-build etc/c/zlib.d $LLVMDCFLAGS || exit 1
@@ -90,7 +99,6 @@ mv *.bc obj
llvm-link -f -o=../lib/llvmdcore.bc `ls obj/etc.*.bc` ../lib/llvmdcore.bc || exit 1
echo "optimizing"
opt -stats -p -f -std-compile-opts -disable-inlining -o=../lib/llvmdcore.bc ../lib/llvmdcore.bc || exit 1
opt -stats -p -f -std-compile-opts -o=../lib/llvmdcore.bc ../lib/llvmdcore.bc || exit 1
echo "SUCCESS"

View File

@@ -276,6 +276,10 @@ Loverflow:
_d_OutOfMemory();
}
void* _d_newarrayvT(TypeInfo ti, size_t length) {
return _d_newarrayT(ti, length);
}
/* For when the array has a non-zero initializer.
*/
void* _d_newarrayiT(TypeInfo ti, size_t length)
@@ -1025,4 +1029,6 @@ void* _d_arrayliteralT(TypeInfo ti, size_t length, ...)
size_t length;
void* ptr;
}*/
extern(C) void* _d_allocmemoryT(TypeInfo ti) {
return malloc(ti.tsize).ptr; // Tit size :)

File diff suppressed because it is too large Load Diff

View File

@@ -287,8 +287,8 @@ extern(C) _Unwind_Reason_Code _d_eh_personality(int ver, _Unwind_Action actions,
action_walker += next_action_offset;
}
printf("Assertion failure ;_;\n");
assert(false);
/*printf("Assertion failure ;_;\n");
assert(false);*/
}
// These are the register numbers for SetGR that
@@ -353,12 +353,14 @@ private void _d_getLanguageSpecificTables(_Unwind_Context_Ptr context, ref ubyte
} // end of x86 Linux specific implementation
extern(C) void* malloc(size_t size);
extern(C) void _d_throw_exception(Object e)
{
if (e !is null)
{
_d_exception* exc_struct = new _d_exception;
// _d_exception* exc_struct = new _d_exception;
auto exc_struct = cast(_d_exception*)malloc(_d_exception.sizeof);
exc_struct.unwind_info.exception_class[] = _d_exception_class;
exc_struct.exception_object = e;
printf("Raising exception\n");

View File

@@ -1,4 +1,5 @@
[Environment]
DFLAGS=-I%@P%/../lphobos -I%@P%/../import -L-L%@P%/../lib -R%@P%/../lib
DFLAGS=-I%@P%/../lphobos -I%@P%/../import -L-L%@P%/../lib
# -R%@P%/../lib

View File

@@ -81,6 +81,7 @@ class TypeInfo
OffsetTypeInfo[] offTi();
}
pragma(no_typeinfo)
class TypeInfo_Typedef : TypeInfo
{
TypeInfo base;
@@ -205,3 +206,4 @@ class Error : Exception
this(string msg);
this(string msg, Error next);
}

View File

@@ -48,7 +48,7 @@ struct DateParse
*this = DateParse.init;
//version (Win32)
buffer = (cast(char *)alloca(s.length))[0 .. s.length];
buffer = (cast(char *)/*alloca*/malloc(s.length))[0 .. s.length];
//else
//buffer = new char[s.length];

View File

@@ -43,6 +43,8 @@ private import std.string;
private import std.regexp;
private import std.gc;
version(linux) version = Unix;
/* =========================== Win32 ======================= */
version (Win32)

File diff suppressed because it is too large Load Diff

View File

@@ -39,6 +39,8 @@ private import std.c.stdio;
private import std.c.stdlib;
private import std.string;
version(linux) version = Unix;
//debug = MMFILE;
version (Win32)

View File

@@ -268,7 +268,7 @@ class OutBuffer
if (count != -1)
break;
psize *= 2;
p = cast(char *) alloca(psize); // buffer too small, try again with larger size
p = cast(char *) /*alloca*/malloc(psize); // buffer too small, try again with larger size
}
else version(GNU) {
count = vsnprintf(p,psize,f,args_copy);
@@ -278,7 +278,7 @@ class OutBuffer
psize = count + 1;
else
break;
p = cast(char *) alloca(psize); // buffer too small, try again with larger size
p = cast(char *) /*alloca*/std.gc.malloc(psize); // buffer too small, try again with larger size
}
else version(linux)
{
@@ -294,7 +294,7 @@ class OutBuffer
c.stdlib.free(p);
p = (char *) c.stdlib.malloc(psize); // buffer too small, try again with larger size
+/
p = cast(char *) alloca(psize); // buffer too small, try again with larger size
p = cast(char *) /*alloca*/std.gc.malloc(psize); // buffer too small, try again with larger size
}
}
write(p[0 .. count]);

View File

@@ -33,10 +33,11 @@ class OutOfMemoryException : Exception
extern (C) void _d_OutOfMemory()
{
assert(0);
/*throw cast(OutOfMemoryException)
printf("Out of memory!\n");
*(cast(int*) 0) = 0;
throw cast(OutOfMemoryException)
cast(void *)
OutOfMemoryException.classinfo.init;*/
OutOfMemoryException.classinfo.init;
}
static this()

View File

@@ -29,6 +29,8 @@ module std.path;
import std.string;
version(linux) version = Unix;
version(Unix)
{
import std.c.stdlib;

View File

@@ -43,6 +43,8 @@ private import std.c.string;
private import std.string;
private import std.c.process;
version(linux) version = Unix;
/**
* Execute command in a _command shell.
*

View File

@@ -17,6 +17,8 @@ module std.random;
// Segments of the code in this file Copyright (c) 1997 by Rick Booth
// From "Inner Loops" by Rick Booth, Addison-Wesley
version(linux) version = Unix;
version (Win32)
{
extern(Windows) int QueryPerformanceCounter(ulong *count);

View File

@@ -1820,7 +1820,7 @@ int trymatch(int pc, int pcend)
if (!psave && count < m)
{
//version (Win32)
psave = cast(regmatch_t *)alloca((re_nsub + 1) * regmatch_t.sizeof);
psave = cast(regmatch_t *)/*alloca*/malloc((re_nsub + 1) * regmatch_t.sizeof);
//else
//psave = new regmatch_t[re_nsub + 1];
}

View File

@@ -44,7 +44,7 @@ module std.socket;
private import std.string, std.stdint, std.c.string, std.c.stdlib;
version(linux) version = Unix;
version(Unix) version = BsdSockets;
version (skyos) { /* nothging */ }

View File

@@ -1139,7 +1139,7 @@ class Stream : InputStream, OutputStream {
if (count != -1)
break;
psize *= 2;
p = cast(char*) alloca(psize);
p = cast(char*) /*alloca*/malloc(psize);
} else version (Unix) {
count = vsnprintf(p, psize, f, args_copy);
if (count == -1)
@@ -1148,7 +1148,7 @@ class Stream : InputStream, OutputStream {
psize = count + 1;
else
break;
p = cast(char*) alloca(psize);
p = cast(char*) /*alloca*/malloc(psize);
} else
throw new Exception("unsupported platform");
}
@@ -1779,6 +1779,8 @@ enum FileMode {
Append = 10 // includes FileMode.Out
}
version(linux) version = Unix;
version (Win32) {
private import std.c.windows.windows;
extern (Windows) {
@@ -2232,7 +2234,8 @@ ubyte[][NBOMS] ByteOrderMarks =
* manner with the source stream so the source stream's position and state will be
* kept in sync with the EndianStream if only non-getc functions are called.
*/
class EndianStream : FilterStream {
/// This causes a crash in -O2
/+class EndianStream : FilterStream {
Endian endian; /// Endianness property of the source stream.
@@ -2510,6 +2513,7 @@ class EndianStream : FilterStream {
em.position(0);
}
}
+/
/***
* Parameterized subclass that wraps an array-like buffer with a stream