On Mon, 06 Dec 2010 09:44:10 -0500, spir <denis.s...@gmail.com> wrote:
Hello,
Nearly all is in title.
I found dmd2/src/phobos/std/string.cmp in string.d. But this performs
string comp with positive/negative/zero result, not equality test with
boolean result.
It's in druntime.
Easy way to find out what druntime function is used by the compiler
void main()
{
auto str1 = "hello";
auto str2 = "world";
auto iseq = (str1 == str2);
}
compile using -c, then use obj2asm, result of main function:
.text._Dmain segment
assume CS:.text._Dmain
_Dmain:
push EBP
mov EBP,ESP
push EBX
push ESI
mov EDX,_t...@sym32[0bh]
mov EAX,_t...@sym32[0ch]
mov ECX,_t...@sym32[016h]
mov EBX,_t...@sym32[018h]
mov ESI,offset FLAT:_d11typeinfo_aa6__in...@sym32
push ESI
push ECX
push EBX
push EDX
push EAX
******** call _ad...@pc32
xor EAX,EAX
add ESP,014h
pop ESI
pop EBX
pop EBP
ret
.text._Dmain ends
So it looks like adEq2 is the function called (I marked with ********
above). Searching druntime, it looks like it's here:
http://www.dsource.org/projects/druntime/browser/trunk/src/rt/adi.d#L353
This is an essential exercise for D runtime hacking ;)
-Steve