Re: Object file questions

2014-08-18 Thread Timo Sintonen via D.gnu
On Sunday, 17 August 2014 at 14:47:57 UTC, Johannes Pfau wrote: Am Sun, 17 Aug 2014 14:36:53 + schrieb "Timo Sintonen" : But the register corruption is still an issue. My tls function clearly uses r3 and does not save it. Johannes, do you know the arm calling system? Is it caller or cal

Re: Object file questions

2014-08-17 Thread Artur Skawina via D.gnu
On 08/17/14 16:16, Johannes Pfau via D.gnu wrote: > Am Sun, 17 Aug 2014 15:15:12 +0200 > schrieb "Artur Skawina via D.gnu" : > >> Do you see any problems with it? (Other than gcc not removing >> that dead constant load) > > It's perfect for structs, but when simply declaring a Volatile!uint the >

Re: Object file questions

2014-08-17 Thread Timo Sintonen via D.gnu
On Sunday, 17 August 2014 at 14:47:57 UTC, Johannes Pfau wrote: Am Sun, 17 Aug 2014 14:36:53 + schrieb "Timo Sintonen" : On Sunday, 17 August 2014 at 13:59:03 UTC, Artur Skawina via D.gnu wrote: > On 08/17/14 15:44, Timo Sintonen via D.gnu wrote: > >> I am compiling for arm and I am sorry

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sun, 17 Aug 2014 16:45:15 +0200 schrieb Johannes Pfau : > the callee can't rely on its caller of course ;-)

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sun, 17 Aug 2014 14:36:53 + schrieb "Timo Sintonen" : > On Sunday, 17 August 2014 at 13:59:03 UTC, Artur Skawina via > D.gnu wrote: > > On 08/17/14 15:44, Timo Sintonen via D.gnu wrote: > > > >> I am compiling for arm and I am sorry I misinterpreted the > >> optimized code. Actually the c

Re: Object file questions

2014-08-17 Thread Timo Sintonen via D.gnu
On Sunday, 17 August 2014 at 13:59:03 UTC, Artur Skawina via D.gnu wrote: On 08/17/14 15:44, Timo Sintonen via D.gnu wrote: I am compiling for arm and I am sorry I misinterpreted the optimized code. Actually the code is correct but it still does not work. The problem is that the call to get th

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sun, 17 Aug 2014 15:15:12 +0200 schrieb "Artur Skawina via D.gnu" : > Do you see any problems with it? (Other than gcc not removing > that dead constant load) It's perfect for structs, but when simply declaring a Volatile!uint the pointer dereference must be done manually, right? enum Ti

Re: Object file questions

2014-08-17 Thread Artur Skawina via D.gnu
On 08/17/14 15:44, Timo Sintonen via D.gnu wrote: > I am compiling for arm and I am sorry I misinterpreted the optimized code. > Actually the code is correct but it still does not work. > The problem is that the call to get the tls pointer for volatile_dummy seems > to corrupt the register (r3)

Re: Object file questions

2014-08-17 Thread Timo Sintonen via D.gnu
On Sunday, 17 August 2014 at 11:35:33 UTC, Artur Skawina via D.gnu wrote: It works for me: import volat; // module w/ the last Volatile(T) implementation. struct uartreg { Volatile!int sr; Volatile!int dr; Volatile!int brr; Volatile!int cr1; Volatile

Re: Object file questions

2014-08-17 Thread Artur Skawina via D.gnu
On 08/17/14 10:49, Johannes Pfau via D.gnu wrote: > That's a good start. Can you also get unary operators working? > e.g > TimerB++; Unary ops are easy. If you mean post-inc and post-dec -- that's a language problem. At least for volatile, they will cause a compile error; for atomic ops the naiv

Re: Object file questions

2014-08-17 Thread Artur Skawina via D.gnu
On 08/17/14 13:57, Johannes Pfau via D.gnu wrote: > Am Sun, 17 Aug 2014 13:38:36 +0200 > schrieb "Artur Skawina via D.gnu" : > >> On 08/17/14 10:31, Johannes Pfau via D.gnu wrote: >>> Am Sat, 16 Aug 2014 13:15:57 +0200 >>> schrieb "Artur Skawina via D.gnu" : >>> It already does. Apparently th

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sun, 17 Aug 2014 13:38:36 +0200 schrieb "Artur Skawina via D.gnu" : > On 08/17/14 10:31, Johannes Pfau via D.gnu wrote: > > Am Sat, 16 Aug 2014 13:15:57 +0200 > > schrieb "Artur Skawina via D.gnu" : > > > >> It already does. Apparently there are some kind of problems with > >> certain setups,

Re: Object file questions

2014-08-17 Thread Artur Skawina via D.gnu
On 08/17/14 09:57, Timo Sintonen via D.gnu wrote: > What is the purpose of volatile_dummy? Even if it is not used, Ensuring ordering, w/o it the compiler could reorder operations on different volatile objects. (Which isn't necessarily a bad thing, but people expect certain semantics of 'volatile'

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sun, 17 Aug 2014 10:44:34 + schrieb "Mike" : > On Sunday, 17 August 2014 at 08:26:40 UTC, Johannes Pfau wrote: > > > > Great! But I think this pull request addresses a different > > monitor > > problem: There's an implicit __monitor field in every class > > right now, > > which makes ever

Re: Object file questions

2014-08-17 Thread Artur Skawina via D.gnu
On 08/17/14 10:31, Johannes Pfau via D.gnu wrote: > Am Sat, 16 Aug 2014 13:15:57 +0200 > schrieb "Artur Skawina via D.gnu" : > >> It already does. Apparently there are some kind of problems with >> certain setups, but, instead of addressing those problems, more and >> more /language/ hacks are pro

Re: Object file questions

2014-08-17 Thread Artur Skawina via D.gnu
On 08/17/14 11:24, Timo Sintonen via D.gnu wrote: > On Sunday, 17 August 2014 at 07:57:15 UTC, Timo Sintonen wrote: >> >> >> This seems to work. >> > > This does not work with member functions > > struct uartreg { > Volatile!int sr; > Volatile!int dr; > Volatile!int brr; > Volatil

Re: Object file questions

2014-08-17 Thread Mike via D.gnu
On Sunday, 17 August 2014 at 08:26:40 UTC, Johannes Pfau wrote: Great! But I think this pull request addresses a different monitor problem: There's an implicit __monitor field in every class right now, which makes every class _instance_ bigger. But the monitor in TypeInfo/ClassInfo is differ

Re: Object file questions

2014-08-17 Thread Mike via D.gnu
On Saturday, 16 August 2014 at 11:16:09 UTC, Artur Skawina via D.gnu wrote: A `@nocode` attribute would be a good idea, yes, but there's no need to make it implicit for `@inline`. But this situation demonstrates why having an intelligent linker is a better solution than decorating with attrib

Re: Object file questions

2014-08-17 Thread Timo Sintonen via D.gnu
On Sunday, 17 August 2014 at 07:57:15 UTC, Timo Sintonen wrote: This seems to work. This does not work with member functions struct uartreg { Volatile!int sr; Volatile!int dr; Volatile!int brr; Volatile!int cr1; Volatile!int cr2; Volatile!int cr3; Volatile!int gt

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sun, 17 Aug 2014 07:57:15 + schrieb "Timo Sintonen" : > On Saturday, 16 August 2014 at 20:01:06 UTC, Artur Skawina via > D.gnu wrote: > > On 08/16/14 20:40, Artur Skawina wrote: > >>> How can I use this with struct members ? > >> > >> One possibility would be to declare all members as > >

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sat, 16 Aug 2014 11:58:49 +0200 schrieb "Artur Skawina via D.gnu" : > On 08/16/14 09:33, Johannes Pfau via D.gnu wrote: > > https://github.com/D-Programming-GDC/GDC/pull/82 > > [Only noticed this accidentally; using a mailing list > instead of some web forum would increase visibility...] > >

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sat, 16 Aug 2014 13:15:57 +0200 schrieb "Artur Skawina via D.gnu" : > On 08/16/14 12:41, Mike via D.gnu wrote: > > On Saturday, 16 August 2014 at 09:59:03 UTC, Artur Skawina via > > D.gnu wrote: > >> > >> Taking the address of an always_inline function is allowed. > >> > > > > It may be allowe

Re: Object file questions

2014-08-17 Thread Johannes Pfau via D.gnu
Am Sat, 16 Aug 2014 10:36:19 + schrieb "Mike" : > On Saturday, 16 August 2014 at 09:29:14 UTC, Johannes Pfau wrote: > > > I just had a look at this and ClassInfo has a mutable 'monitor' > > field, > > so it can't be placed into read-only data. > > This was discussed at DConf 2014. > https

Re: Object file questions

2014-08-17 Thread Timo Sintonen via D.gnu
On Saturday, 16 August 2014 at 20:01:06 UTC, Artur Skawina via D.gnu wrote: On 08/16/14 20:40, Artur Skawina wrote: How can I use this with struct members ? One possibility would be to declare all members as `Volatile!...`, or I did not like that required dereference in the previous versio

Re: Object file questions

2014-08-16 Thread Artur Skawina via D.gnu
On 08/16/14 20:40, Artur Skawina wrote: >> How can I use this with struct members ? > > One possibility would be to declare all members as `Volatile!...`, or I did not like that required dereference in the previous version, and tried a different approach: struct Timer { Volatile!uin

Re: Object file questions

2014-08-16 Thread Artur Skawina via D.gnu
On 08/16/14 18:46, Timo Sintonen via D.gnu wrote: > > I am not so familiar with these opAssign things, so how I can do basic > assignment: TimerB = 0x1234 ? > Is it possible to inline volatile_load and volatile_store ? version (GNU) { static import gcc.attribute; enum inline = gcc.att

Re: Object file questions

2014-08-16 Thread Timo Sintonen via D.gnu
On Saturday, 16 August 2014 at 09:59:03 UTC, Artur Skawina via D.gnu wrote: On 08/16/14 09:33, Johannes Pfau via D.gnu wrote: https://github.com/D-Programming-GDC/GDC/pull/82 [Only noticed this accidentally; using a mailing list instead of some web forum would increase visibility...] enum va

Re: Object file questions

2014-08-16 Thread Artur Skawina via D.gnu
On 08/16/14 12:41, Mike via D.gnu wrote: > On Saturday, 16 August 2014 at 09:59:03 UTC, Artur Skawina via D.gnu wrote: >> >> Taking the address of an always_inline function is allowed. >> > > It may be allowed, but it probably shouldn't be. Always-inlining a function > and taking the address of

Re: Object file questions

2014-08-16 Thread Mike via D.gnu
On Saturday, 16 August 2014 at 09:59:03 UTC, Artur Skawina via D.gnu wrote: Taking the address of an always_inline function is allowed. It may be allowed, but it probably shouldn't be. Always-inlining a function and taking the address of that function is contradictory. But this situation

Re: Object file questions

2014-08-16 Thread Mike via D.gnu
On Saturday, 16 August 2014 at 09:29:14 UTC, Johannes Pfau wrote: I just had a look at this and ClassInfo has a mutable 'monitor' field, so it can't be placed into read-only data. This was discussed at DConf 2014. https://www.youtube.com/watch?v=TNvUIWFy02I#t=1008 There is currently a pu

Re: Object file questions

2014-08-16 Thread Artur Skawina via D.gnu
On 08/16/14 09:33, Johannes Pfau via D.gnu wrote: > https://github.com/D-Programming-GDC/GDC/pull/82 [Only noticed this accidentally; using a mailing list instead of some web forum would increase visibility...] > enum var = Volatile!(T,addr)(): doesn't allow |= on enum literals, even if > the t

Re: Object file questions

2014-08-16 Thread Johannes Pfau via D.gnu
Am Sat, 16 Aug 2014 08:39:04 + schrieb "Timo Sintonen" : > > > Regarding __Class: Can you post a short example? > > Some lines from mapfile. Seems to be one for every type in the > program: > > .data 0x20001074 0x720 > minlibd/libdruntime/libdruntime.a(object_.o) >

Re: Object file questions

2014-08-16 Thread Timo Sintonen via D.gnu
On Saturday, 16 August 2014 at 07:36:07 UTC, Johannes Pfau wrote: Iain recently pushed a commit to put zero initializers into bss, so that's intentional: http://bugzilla.gdcproject.org/show_bug.cgi?id=139 But I understand your point that it should be in rodata instead, you'll have to discuss

Re: Object file questions

2014-08-16 Thread Johannes Pfau via D.gnu
Am Sat, 16 Aug 2014 07:06:34 + schrieb "Timo Sintonen" : > On Thursday, 14 August 2014 at 19:05:46 UTC, Johannes Pfau wrote: > > Am Thu, 14 Aug 2014 17:53:32 + > > schrieb "Timo Sintonen" : > > > >> On Thursday, 14 August 2014 at 17:13:23 UTC, Johannes Pfau > >> wrote: > >> > Am Thu, 14 A

Re: Object file questions

2014-08-16 Thread ketmar via D.gnu
On Sat, 16 Aug 2014 07:06:34 + "Timo Sintonen via D.gnu" wrote: > structs wasting memory. Is there any way to omit them? maybe this will work: struct A { int n = void; uint[2] a = void; ...and so on for all fields } signature.asc Description: PGP signature

Re: Object file questions

2014-08-16 Thread Timo Sintonen via D.gnu
On Thursday, 14 August 2014 at 19:05:46 UTC, Johannes Pfau wrote: Am Thu, 14 Aug 2014 17:53:32 + schrieb "Timo Sintonen" : On Thursday, 14 August 2014 at 17:13:23 UTC, Johannes Pfau wrote: > Am Thu, 14 Aug 2014 10:07:04 + > schrieb "Timo Sintonen" : > >> I have been looking at object f

Re: Object file questions

2014-08-14 Thread Johannes Pfau via D.gnu
Am Thu, 14 Aug 2014 17:53:32 + schrieb "Timo Sintonen" : > On Thursday, 14 August 2014 at 17:13:23 UTC, Johannes Pfau wrote: > > Am Thu, 14 Aug 2014 10:07:04 + > > schrieb "Timo Sintonen" : > > > >> I have been looking at object files to see if I can reduce the > >> memory usage for minim

Re: Object file questions

2014-08-14 Thread Artur Skawina via D.gnu
On 08/14/14 19:53, Timo Sintonen via D.gnu wrote: > On Thursday, 14 August 2014 at 17:13:23 UTC, Johannes Pfau wrote: >> Am Thu, 14 Aug 2014 10:07:04 + >> schrieb "Timo Sintonen" : >> >>> I have been looking at object files to see if I can reduce the memory usage >>> for minimum systems. There

Re: Object file questions

2014-08-14 Thread Timo Sintonen via D.gnu
On Thursday, 14 August 2014 at 17:13:23 UTC, Johannes Pfau wrote: Am Thu, 14 Aug 2014 10:07:04 + schrieb "Timo Sintonen" : I have been looking at object files to see if I can reduce the memory usage for minimum systems. There are two things I have noticed: 1. In the data segment there is

Re: Object file questions

2014-08-14 Thread Johannes Pfau via D.gnu
Am Thu, 14 Aug 2014 10:07:04 + schrieb "Timo Sintonen" : > I have been looking at object files to see if I can reduce the > memory usage for minimum systems. There are two things I have > noticed: > > 1. In the data segment there is some source code as ascii text > from a template in gcc/a

Object file questions

2014-08-14 Thread Timo Sintonen via D.gnu
I have been looking at object files to see if I can reduce the memory usage for minimum systems. There are two things I have noticed: 1. In the data segment there is some source code as ascii text from a template in gcc/atomics.d . This is in the actual data segment and not in debug info segm