Re: [fpc-pascal] issue when enabling -O2

2018-01-11 Thread Matias Vara
After fixing the assembler code and other issues, e.g., interruption handlers were not restoring all registers, I observed an speed up of ~12% with -O2 when running a simple webserver example. That's very impresive! Thanks for you help, Matias. 2018-01-10 18:19 GMT+01:00 Matias Vara : > > 2018-0

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Matias Vara
2018-01-10 18:09 GMT+01:00 Karoly Balogh (Charlie/SGR) < char...@scenergy.dfmk.hu>: > Hi, > > On Wed, 10 Jan 2018, Matias Vara wrote: > > > BTW, this only applies to inline assembler functions rigth? In the case > > of normal procedures that contains a block asm end; there is no problem, > > Am I

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Matias Vara
Hello, 2018-01-10 18:03 GMT+01:00 Karoly Balogh (Charlie/SGR) < char...@scenergy.dfmk.hu>: > Hi, > > On Wed, 10 Jan 2018, Matias Vara wrote: > > > Thank you very much Karol, I completly missed this point during the > > development of my kernel (Or maybe I had in mind sometime ago but I > > forgot

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 10 Jan 2018, Matias Vara wrote: > BTW, this only applies to inline assembler functions rigth? In the case > of normal procedures that contains a block asm end; there is no problem, > Am I right? No, it applies to *ALL* assembler code. Also inline blocks. The only difference is, for b

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 10 Jan 2018, Matias Vara wrote: > Thank you very much Karol, I completly missed this point during the > development of my kernel (Or maybe I had in mind sometime ago but I > forgot it)It was only when I decided to play with -02 that all these > issues arrised.  BTW, your code (as sho

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Matias Vara
BTW, this only applies to inline assembler functions rigth? In the case of normal procedures that contains a block asm end; there is no problem, Am I right? Matias 2018-01-10 17:51 GMT+01:00 Matias Vara : > Thank you very much Karol, I completly missed this point during the > development of my k

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Matias Vara
Thank you very much Karol, I completly missed this point during the development of my kernel (Or maybe I had in mind sometime ago but I forgot it) It was only when I decided to play with -02 that all these issues arrised. Matias 2018-01-10 17:34 GMT+01:00 Karoly Balogh (Charlie/SGR) < char...@sce

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 10 Jan 2018, Matias Vara wrote: > Hi Karol and thanks you very much! I got confused with the function > names, I feel very sorry.As I said in my previous email, I fixed by > rewriting the assembler function. However, I don't why it worked.  By accident. Simply the register/stack/memo

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Matias Vara
Hi Karol and thanks you very much! I got confused with the function names, I feel very sorry. As I said in my previous email, I fixed by rewriting the assembler function. However, I don't why it worked. So I understand you correctly, if I use assembler in my procedures there could be a risk that I

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 10 Jan 2018, Matias Vara wrote: > I am getting an exception when I enable the -O2 optimization. More > precisaily, the line that stars with write_portd is corrupting the > data section. This is the pascal code:  > > function PciReadDword(const bus, device, func, regnum: UInt32): U

Re: [fpc-pascal] issue when enabling -O2

2018-01-10 Thread Matias Vara
I think the problem was the way write_portd() is implemented: procedure write_portd(const Data: Pointer; const Port: Word); {$IFDEF ASMINLINE} inline; {$ENDIF} asm // RCX: data, RDX: port {$IFDEF LINUX} mov dx, port {$ENDIF} mov rsi, data // DX=port outsd end; If I replace with somethin