[svn r135] * Merged DMD 1.025 *

* Fixed a minor linking order mishap *
* Added an command line option -annotate *
* Fixed some problems with running optimizations *
* Added std.stdio and dependencies to lphobos (still not 100% working, but compiles and links) *
* Fixed problems with passing aggregate types to variadic functions *
* Added initial code towards full GC support, currently based on malloc and friends, not all the runtime calls the GC yet for memory *
* Fixed problems with resolving nested function context pointers for some heavily nested cases *
* Redid function argument passing + other minor code cleanups, still lots to do on this end... *
This commit is contained in:
Tomas Lindquist Olsen
2008-01-04 01:38:42 +01:00
parent 4428e47a66
commit bc08c6fcb1
44 changed files with 4587 additions and 592 deletions

19
test/asm1.d Normal file
View File

@@ -0,0 +1,19 @@
module asm1;
void main()
{
version(LLVM_InlineAsm_X86_64)
{
long x;
asm
{
mov RAX, 42L;
mov x, RAX;
}
printf("x = %ld\n", x);
}
else
{
static assert(0, "no llvm inline asm for this platform yet");
}
}

9
test/bug79.d Normal file
View File

@@ -0,0 +1,9 @@
module bug79;
import std.c.linux.linux;
void main()
{
timespec ts;
ts.tv_nsec -= 1;
//auto t = ts.tv_nsec - 1;
//t -= 1;
}

10
test/bug80.d Normal file
View File

@@ -0,0 +1,10 @@
module bug80;
void main()
{
byte b = 10;
int i = b += 2;
printf("byte=%d int=%d\n", b, i);
assert(b == 12);
assert(i == 12);
}

65
test/calls1.d Normal file
View File

@@ -0,0 +1,65 @@
module calls1;
import std.stdarg;
void main()
{
{int a = byVal1(3);}
{int a = void; byRef1(a);}
{char[] c = void; refType(c);}
{char[] c = void; refTypeByRef(c);}
{S s = void; structByVal(s);}
{S s = void; structByRef(s);}
{S s = void; structByPtr(&s);}
{printf("c-varargs %d %d %d\n", 1,2,3);}
{int i=3; float f=24.7; dvararg(i,f);}
{char[] s = "hello"; dvarargRefTy(s);}
{char[] ss = "hello world!"; dvarargRefTy(ss);}
}
int byVal1(int a)
{
return a;
}
void byRef1(ref int a)
{
a = 3;
}
void refType(char[] s)
{
}
void refTypeByRef(ref char[] s)
{
}
struct S
{
float f;
double d;
long l;
byte b;
}
void structByVal(S s)
{
}
void structByRef(ref S s)
{
}
void structByPtr(S* s)
{
}
void dvararg(...)
{
printf("%d %.1f\n", va_arg!(int)(_argptr), va_arg!(float)(_argptr));
}
void dvarargRefTy(...)
{
char[] s = va_arg!(char[])(_argptr);
printf("%.*s\n", s.length, s.ptr);
}

42
test/nested11.d Normal file
View File

@@ -0,0 +1,42 @@
module nested11;
void main()
{
int i;
void f()
{
i++;
void g()
{
i++;
void h()
{
printf("i = %d\n", i);
}
h();
}
g();
}
f();
assert(i == 2);
void foo()
{
i = 42;
}
void bar()
{
foo();
}
bar();
printf("i = %d\n", i);
assert(i == 42);
}

21
test/nested12.d Normal file
View File

@@ -0,0 +1,21 @@
module nested12;
void main()
{
func();
}
void func()
{
void a(int i)
{
printf("%d\n", i);
}
void b()
{
a(42);
}
b();
}

View File

@@ -2,7 +2,27 @@ module stdiotest;
import std.stdio;
T typed(T)(T x)
{
return x;
}
void main()
{
writefln("hello world",42,'x');
/*char[] str = "hello";
writefln(str);
writefln("hello world");*/
char[] fmt = "%s";
writefln(2.0f);
/*{writefln(typed!(byte)(1));}
{writefln(typed!(short)(2));}
{writefln(typed!(int)(3));}
{writefln(typed!(long)(-4));}
{writefln(typed!(ulong)(5));}
{writefln("%f", typed!(float)(6));}
{writefln("%f", typed!(double)(7));}
{writefln("%f", typed!(real)(8));}*/
}

22
test/stdiotest2.d Normal file
View File

@@ -0,0 +1,22 @@
module stdiotest2;
import std.stdio;
void main()
{
int[4] v = [1,2,3,4];
{
writefln("%s", v);
{
int[] dv = v;
{writefln("%s", dv);}
}
}
{
writefln(v);
{
//int[] dv = v;
//{writefln(dv);}
}
}
//writefln(1,2,3,4.56,"hello",v);
}

12
test/vararg5.d Normal file
View File

@@ -0,0 +1,12 @@
module vararg5;
import std.stdarg;
void func(...)
{
char[] str = va_arg!(char[])(_argptr);
{printf("%.*s\n", str.length, str.ptr);}
}
void main()
{
char[] str = "hello";
func(str);
}