Rust-based provocation :)
nazriel
spam at dzfl.pl
Tue May 28 00:26:33 PDT 2013
On Tuesday, 28 May 2013 at 00:43:25 UTC, Adam D. Ruppe wrote:
> On Monday, 27 May 2013 at 17:51:33 UTC, Dicebot wrote:
>> Looking at object.d source, it looks like you are generating
>> TypeInfo stubs that can be optimized away, have I understood
>> it right?
>
> I'm not sure if they can be optimized away, but all I was doing
> is putting the bare minimum so the compiler would shut up.
>
>> P.S. I can't get to run your "minimal.zip" example because of
>> "object.d(87): Error: mismatch between compiler and object.d
>> or object.di found." which does not really make sense in scope
>> of line 87. Any ideas? Have changes all relevant stuff from
>> x32 to x64 as far as I can see.
>
>
> Hmm I already modified the file I have locally. I'll update the
> zip but I don't think this will work in 64 bit anyway because
> the syscall functions are all written in 32 bit inline asm.
> (I've never written a 64 bit asm program so I'm not even sure
> what the calling convention would look like there. If you
> ripped that out and used C functions instead, with an extern(C)
> main even maybe, you might be in business though.)
>
On x86_64 you need to use syscall instead of int 80h
You pass system call id in RAX, then arguments goes into RDI,
RSI, RDX, R10, etc.
Table of syscalls is also different
http://blog.rchapman.org/post/36801038863/linux-system-call-table-for-x86-64
> I think line 87 was one of the TypeInfos though, and dmd
> expects them to be a particular size, and it is slightly
> different on 64 bit. If it is TypeInfo_Struct, on 32 bit
> void*[13] stuff; is good enough for dmd to shut up.
>
> I believe on 64 bit it expects two more words, so void*[15]
> stuff should be good enough.
>
> this should be updated and hitting "make" worked on my box,
> building 32 bit, with the test program being a bit of class
> stuff. The write() and exit() functions are moved to object.d
> right now, along with a dead stupid "allocator" that gives you
> a pointer to a static buffer (that it never frees) to play with
> new class. If you are using libc, malloc/free should be able to
> do the job instead, see the manual_alloc and manual_free stubs
> in object.d
>
> http://arsdnet.net/dcode/minimal.zip
I tried to port your package to x86_64 but dozens of:
"/home/raz/.dvm/compilers/dmd-2.063/src/druntime/src/rt/typeinfo/ti_Acfloat.d(35):
Error: cannot implicitly convert expression (s.length * 8LU) of
type ulong to uint
/home/raz/.dvm/compilers/dmd-2.063/src/druntime/src/rt/typeinfo/ti_Acfloat.d(42):
Error: cannot implicitly convert expression (s1.length) of type
ulong to uint"
blown off my enthusiasm ;)
More information about the Digitalmars-d
mailing list