digitalmars.D - Adjustor thunks and variadic arguments.
- Iain Buclaw via Digitalmars-d (37/37) Apr 09 2015 Hi,
- Daniel Murphy (9/18) Apr 09 2015 They don't support jumping across section boundaries? But they do suppo...
- Iain Buclaw via Digitalmars-d (4/24) Apr 09 2015 That's not copying arguments. :-)
- Daniel Murphy (3/4) Apr 09 2015 True, but why doesn't jump work?
- Iain Buclaw via Digitalmars-d (6/11) Apr 09 2015 Many targets do not support thunks (PPC, IA64, MIPS) - even i386 has
- Iain Buclaw via Digitalmars-d (4/34) Apr 09 2015 What is currently happening in GDC (Generic thunks don't support
Hi, How does LDC handle emitting thunks to external modules that accept variadic parameters? If under the same object file, you can happily emit: sub offset, %thisreg jmp method But if doing separate compilation, many targets to not support doing such operations across section boundaries. So a more general/agnostic way to go about it is by copying all arguments, adjusting the 'this' pointer and calling target method at the codegen level. This works so long as you are not dealing with a variadic method (ie: std.stream.Stream.printf) Example code below: A.d --- module A; interface I_A { bool a(...); } class C_A : I_A { bool a(...) { return false; } } B.d --- module B; import A; interface I_B : I_A { void b(); } abstract class C_B : C_A, I_B { abstract void b(); } void main() { }
Apr 09 2015
"Iain Buclaw via Digitalmars-d" wrote in message news:mailman.1364.1428563414.3111.digitalmars-d puremagic.com...If under the same object file, you can happily emit: sub offset, %thisreg jmp method But if doing separate compilation, many targets to not support doing such operations across section boundaries. So a more general/agnostic way to go about it is by copying all arguments, adjusting the 'this' pointer and calling target method at the codegen level. This works so long as you are not dealing with a variadic method (ie: std.stream.Stream.printf)They don't support jumping across section boundaries? But they do support calling? Anyway it sounds like sub offset, %thisreg call method ret would do it
Apr 09 2015
On 9 April 2015 at 13:20, Daniel Murphy via Digitalmars-d <digitalmars-d puremagic.com> wrote:"Iain Buclaw via Digitalmars-d" wrote in message news:mailman.1364.1428563414.3111.digitalmars-d puremagic.com...That's not copying arguments. :-) Iain.If under the same object file, you can happily emit: sub offset, %thisreg jmp method But if doing separate compilation, many targets to not support doing such operations across section boundaries. So a more general/agnostic way to go about it is by copying all arguments, adjusting the 'this' pointer and calling target method at the codegen level. This works so long as you are not dealing with a variadic method (ie: std.stream.Stream.printf)They don't support jumping across section boundaries? But they do support calling? Anyway it sounds like sub offset, %thisreg call method ret would do it
Apr 09 2015
"Iain Buclaw via Digitalmars-d" wrote in message news:mailman.1372.1428583102.3111.digitalmars-d puremagic.com...That's not copying arguments. :-)True, but why doesn't jump work?
Apr 09 2015
On 9 April 2015 at 15:39, Daniel Murphy via Digitalmars-d <digitalmars-d puremagic.com> wrote:"Iain Buclaw via Digitalmars-d" wrote in message news:mailman.1372.1428583102.3111.digitalmars-d puremagic.com...Many targets do not support thunks (PPC, IA64, MIPS) - even i386 has it's limitations (if there are no free registers, it's tilt game over!).That's not copying arguments. :-)True, but why doesn't jump work?From conversations I've been having with GCC folks, jmp won't workacross shared libraries either it seems.
Apr 09 2015
On 9 April 2015 at 14:38, Iain Buclaw <ibuclaw gdcproject.org> wrote:On 9 April 2015 at 13:20, Daniel Murphy via Digitalmars-d <digitalmars-d puremagic.com> wrote:What is currently happening in GDC (Generic thunks don't support varargs though). https://github.com/D-Programming-GDC/GDC/pull/97#issuecomment-90275901"Iain Buclaw via Digitalmars-d" wrote in message news:mailman.1364.1428563414.3111.digitalmars-d puremagic.com...That's not copying arguments. :-) Iain.If under the same object file, you can happily emit: sub offset, %thisreg jmp method But if doing separate compilation, many targets to not support doing such operations across section boundaries. So a more general/agnostic way to go about it is by copying all arguments, adjusting the 'this' pointer and calling target method at the codegen level. This works so long as you are not dealing with a variadic method (ie: std.stream.Stream.printf)They don't support jumping across section boundaries? But they do support calling? Anyway it sounds like sub offset, %thisreg call method ret would do it
Apr 09 2015