Gas64 (no more use of gcc, only gas) WDS / LNX
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
@SARG good job and thank you.
Joshy
Joshy
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
Agreed. Even using libdwarf to read them is. The pdf for that library is 240 pages! I don't doubt it needs to be that complex to read everything that could ever be generated by compilers, but still, that seems like it might be doing a little bit too much.BTW Dwarf format is a nightmare :-)
I wouldn't mind but it doesn't even document what it does very well. I randomly found a page on the internet that told me "Oh by the way, this one function magically knows about the enumeration you do with this other function, so just use those two functions together to find all the subs in the exe rather than the two pages of code that the example uses"
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
For fbc that's sure.adeyblue wrote:it might be doing a little bit too much."
I didn't use libdwarf, I 'cheated' a bit using objdump that extracts debug data each necessary section in plain text then fbdebugger (previous/current version) links all. But I let down that in fbdebugger_new.
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
The fixes for the bugs reported by dodicat and D.J. Peters are now in the build (1.10) provided by St_W.
-
- Posts: 1002
- Joined: Jul 14, 2005 23:41
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
@SARG, I just wanted to make a quick post of appreciation for the Gas64 backend. I have now used it to compile all 150+ source files for my 64-bit version of the WinFBE Editor. No errors or warnings and the resulting EXE appears to be working correctly. A added benefit is that the compile times using your -gen gas64 versus -gen gcc is substantially faster.
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
Nice to read that. Thanks.PaulSquires wrote: ↑Mar 17, 2022 13:14 @SARG, I just wanted to make a quick post of appreciation for the Gas64 backend. I have now used it to compile all 150+ source files for my 64-bit version of the WinFBE Editor. No errors or warnings and the resulting EXE appears to be working correctly.
With what ratio ?A added benefit is that the compile times using your -gen gas64 versus -gen gcc is substantially faster.
-
- Posts: 1002
- Joined: Jul 14, 2005 23:41
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
I have always found that doing a full cold 64-bit compile of the source code using -gen gcc has been very slow. I believe there was a forum thread here somewhere that talked about people experiencing very long compile times and it had to do with strings (maybe?) and gcc? I can't remember the details of the post.
I just ran a simple test using the full WinFBE source code:
-gen gcc 60 seconds
-gen gas64 12 seconds
-gen gas 3.7 seconds
I ran this on my Dell XPS15 laptop with 64-bit Windows 10, 16 GB RAM, and SSD drive. It is certainly not a very scientifically controlled test but it is very indicative of the relative compile times that I experience.
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
Maybe mine viewtopic.php?p=259959#p259959
Thanks for the information.PaulSquires wrote: -gen gcc 60 seconds
-gen gas64 12 seconds
-gen gas 3.7 seconds
There is still work to beat the fast gas32.
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
Is this the right way to report a bug?
Trying the second example in
https://www.freebasic.net/wiki/KeyPgWindow
with gas64 gives no result with exponent 2 in 'plot the function'.
It works with other exponents or double instead of single.
I tried with
FreeBASIC-1.09.0-winlibs-gcc-9.3.0
and
fbc_win64_mingw_0792_2022-06-05.zip from https://users.freebasic-portal.de/stw/builds/win64/.
Same with Linux: fbc_linux64_0745_2022-06-05.zip from https://users.freebasic-portal.de/stw/builds/linux64/.
Trying the second example in
https://www.freebasic.net/wiki/KeyPgWindow
with gas64 gives no result with exponent 2 in 'plot the function'.
Code: Select all
#cmdline "-gen gas64"
dim as single x, y
for x = -2 to 2
y = x ^ 2
print x, y, x ^ 2
next x
sleep
I tried with
FreeBASIC-1.09.0-winlibs-gcc-9.3.0
and
fbc_win64_mingw_0792_2022-06-05.zip from https://users.freebasic-portal.de/stw/builds/win64/.
Same with Linux: fbc_linux64_0745_2022-06-05.zip from https://users.freebasic-portal.de/stw/builds/linux64/.
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
@hhr thanks for the report.
The problem was due to the trick square of a number replaced by a multiplication. The expected result needs to be a double but in case of multiplication of singles the result is a single..... A converting added (single to double, just one instruction) fixed the issue.
The problem was due to the trick square of a number replaced by a multiplication. The expected result needs to be a double but in case of multiplication of singles the result is a single..... A converting added (single to double, just one instruction) fixed the issue.
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
Running the code compile with Gas64. got error message:
Aborting due to runtime error 12 ("segmentation violation" signal) in Gas64CompileFailure1.bas::TEXTTOSTATE()
But it is OK compile with GCC64. Anyone know what's happen?
Aborting due to runtime error 12 ("segmentation violation" signal) in Gas64CompileFailure1.bas::TEXTTOSTATE()
But it is OK compile with GCC64. Anyone know what's happen?
Code: Select all
#cmdline "-gen gas64"
Dim As UByte T(1 To 4, 1 To 4)
Sub TextToState(ByRef Texts As String, T() As UByte)
For y As Integer = 1 To 4
For x As Integer = 1 To 4
T(y, x) = Asc(Mid(Texts, (((y - 1) Shl 2) + x), 1))
Next x
Next y
End Sub
TextToState("123456789012364567890", T())
For y As Integer = 1 To 4
For x As Integer = 1 To 4
Print T(y, x)
Next x
Next y
Sleep(1000)
End
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
Line 2 and 3: it works with long, longint or integer, not with byte or short. The same with unsigned variables.
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
@Avata
Thank you for the report.
It's fixed. That will be in the next daily build also with the fix for previous bug.
@hhr
I'm not going to explain the exact problem (too much difficult even in my native language ) but it works with long just because addresses are in 32bit area.....
Thank you for the report.
It's fixed. That will be in the next daily build also with the fix for previous bug.
@hhr
I'm not going to explain the exact problem (too much difficult even in my native language ) but it works with long just because addresses are in 32bit area.....
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
I normally use the stairs.
Code: Select all
Dim As Ulong rainbowcolor(...) = { _
Rgb(255, 0, 0) , _
Rgb(255, 127, 0), _
Rgb(255, 255, 0), _
Rgb(0, 255, 0), _
Rgb(0, 0, 255) , _
Rgb(46, 43, 95), _
Rgb(139,0,255) _
}
#define irange(f,l) Int(Rnd*(((l)+1)-(f))+(f))
#define map(a,b,x,c,d) ((d)-(c))*((x)-(a))/((b)-(a))+(c)
#define randitem(myarray) irange(lbound(rainbowcolor),ubound(rainbowcolor))
Type V2
As Single x,y
End Type
Type Circle
As v2 ctr
As Long r
As Ulong col
End Type
Function ShortSpline(p() As V2,t As Single) As V2
#macro set(n)
0.5 *( (2 * P(2).n) +_
(-1*P(1).n + P(3).n) * t +_
(2*P(1).n - 5*P(2).n + 4*P(3).n - P(4).n) * t*t +_
(-1*P(1).n + 3*P(2).n- 3*P(3).n + P(4).n) * t*t*t)
#endmacro
Dim As V2 G
G.x=set(x):G.y=set(y)':G.z=set(z)
Return g
End Function
Sub GetSpline(v() As V2,outarray() As V2,arraysize As Integer=1000)
Dim As V2 p(1 To 4)
Redim outarray(0)
Dim As Single stepsize=(Ubound(v)-1)/(arraysize)
If stepsize>1 Then stepsize=1
For n As Integer=Lbound(v)+1 To Ubound(v)-2
p(1)=v(n-1):p(2)=v(n):p(3)=v(n+1):p(4)=v(n+2)
For t As Single=0 To 1 Step stepsize
Redim Preserve outarray(1 To Ubound(outarray)+1)
outarray(Ubound(outarray))=ShortSpline(p(),t)
Next t
Next n
End Sub
#macro setsplines
Dim As v2 red(...)={(210,255),(180,255),(150,255),(120,255),(90,0),(60,0),(30,46),(0,139),(-30,139)}
Redim As v2 sred()
Dim As v2 green(...)={(210,0),(180,0),(150,127),(120,255),(90,255),(60,0),(30,43),(0,0),(-30,0)}
Redim As v2 sgreen()
Dim As v2 blue(...)={(210,0),(180,0),(150,0),(120,0),(90,0),(60,255),(30,95),(0,255),(-30,139)}
Redim As v2 sblue()
getspline(red(),sred(),360)
getspline(green(),sgreen(),360)
getspline(blue(),sblue(),360)
For n As Long=Lbound(sred) To Ubound(sred)
If sred(n).y>255 Then sred(n).y=255
If sred(n).y<0 Then sred(n).y=0
If sblue(n).y>255 Then sblue(n).y=255
If sblue(n).y<0 Then sblue(n).y=0
If sgreen(n).y>255 Then sgreen(n).y=255
If sgreen(n).y<0 Then sgreen(n).y=0
Next n
#endmacro
Function dot(v1 As v2,v2 As v2) As Single
Dim As Single d1=Sqr(v1.x*v1.x + v1.y*v1.y),d2=Sqr(v2.x*v2.x + v2.y*v2.y)
Dim As Single v1x=v1.x/d1,v1y=v1.y/d1
Dim As Single v2x=v2.x/d2,v2y=v2.y/d2
Return (v1x*v2x+v1y*v2y)
End Function
Function drawline(x As Long,y As Long,angle As Double,length As Double,flag As Long=0) As v2
angle=angle*.0174532925199433
Dim As Single x2=x+length*Cos(angle)
Dim As Single y2=y-length*Sin(angle)
Return Type(x2,y2)
End Function
Sub DrawPointer(C As Circle,p As v2,col As Ulong)
Circle(C.ctr.x,C.ctr.y),C.r,col,,,,f
Dim As v2 X,Y
For a As Single=0 To 360
Var v=drawline(C.ctr.x,C.ctr.y,a,C.r)
X=Type(v.x-p.x,v.y-p.y)
Y=Type(c.ctr.x-v.x,c.ctr.y-v.y)
If Abs(dot(Y,X))<.05 Then
Line(p.x,p.y)-(v.x,v.y),col 'tangents to C
End If
Next a
Paint((p.x+C.ctr.x)/2,(p.y+C.ctr.y)/2),col,col
End Sub
Sub quickfilter(i As Any Ptr,n As Long)
Dim As Integer ix,iy
Imageinfo i,ix,iy
Dim As Long p(0 To 4)
For k As Long=1 To n
For x As Long=1 To ix-2
For y As Long=1 To iy-2
Var r=0
Var g=0
Var b=0
p(0)=Point(x,y,i)
p(1)=Point(x,y-1,i)
p(2)=Point(x+1,y,i)
p(3)=Point(x,y+1,i)
p(4)=Point(x-1,y,i)
For n As Long=0 To 4
r+=Cast(Ubyte Ptr,@p(n))[2]
g+=Cast(Ubyte Ptr,@p(n))[1]
b+=Cast(Ubyte Ptr,@p(n))[0]
Next
r/=5
g/=5
b/=5
Pset i,(x,y),Rgb(r,g,b)
Next y
Next x
Next k
End Sub
Sub createback(i As Any Ptr)
Var z=2,yval=0
For y As Integer=-300 To 900 Step 1
z=z*.995
For x As Single=-400 To 1200 Step 1.5
Var d=(Sqr((1300-x)*(1300-x)+(2300-y)*(12300-y)))*z
Var xval=x+600*.01
Var k=.2*Sin(d*10)
Line i,(x,y)-(x+k*(xval-x),y+k*(yval-y)),Rgb(Abs(k*400) Mod 255,Abs(k*250) Mod 255,0)
Next x
Next y
For n As Single =330 To 360 Step .5
Dim As Ulong r=map(330,360,n,400,30)
Var k=map(330,360,n,20,150)
Circle i,(400,400),n,Rgb(200,k,0),0,3.142
Next
Quickfilter(i,5)
End Sub
'================================
Screen 19,32
Windowtitle "Press <Esc> to finish"
Dim As Any Ptr i=Imagecreate(800,600,Rgb(200,200,200))
Randomize Timer
Dim As Ulong A_Colour,x,y
Dim As Circle c
Dim As Long a,la=1,tol=2
Dim As Single da
Dim As boolean nextone=true
createback(i)
setsplines
Do
' Get a different colour each time
If nextone=true Then
Var t=A_Colour
Do
A_Colour= randitem(rainbowcolor)
Loop Until A_Colour<>t
End If
Screenlock
Put(0,0),i,Pset
For n As Long=0 To Ubound(rainbowcolor)
If n=A_Colour Then Color rainbowcolor(A_Colour) Else Color Rgb(200,200,200)
a=map(0,Ubound(rainbowcolor),n,180,0)
Var p=drawline(400,400,a,300)
Draw String(p.x-4,p.y-8),iif(n=0,"G",Str(n))
If Culng(Color)=rainbowcolor(A_Colour) Then
nextone=false
For z As Single=23 To 17 Step -.1
Circle(p.x+Rnd,p.y-Rnd),z
Next z
da+=-Sgn(la-a)/2
Var q=drawline(400,400,da,300)
c=Type(Type<v2>(400,400),50,rainbowcolor(A_Colour))
Dim As Long idr=map(180,0,da,Lbound(sred),Ubound(sred))
DrawPointer(c,q,Rgb(sred(idr).y,sgreen(idr).y,sblue(idr).y))
If Abs((da)-a)<tol Then
tol=1
nextone=true
Var t=Timer
While Timer-t<.75:Wend
End If
If nextone=true Then la=a
End If
Next
Screenunlock
Sleep 5
Loop Until Inkey=Chr(27)
Imagedestroy i
Re: Gas64 (no more use of gcc, only gas) WDS / LNX
@dodicat
@SARG
Gas64 will not compile dodicat's program viewtopic.php?p=283883#p283883.
I changed line 31:
Dim As Single ln=Sqr(impulsex*impulsex+impulsey*impulsey)
to
Dim As Single ln=impulsex*impulsex+impulsey*impulsey
ln = Sqr(ln)
and it run's.
@SARG
Gas64 will not compile dodicat's program viewtopic.php?p=283883#p283883.
I changed line 31:
Dim As Single ln=Sqr(impulsex*impulsex+impulsey*impulsey)
to
Dim As Single ln=impulsex*impulsex+impulsey*impulsey
ln = Sqr(ln)
and it run's.