mark4 changed the topic of #forth to: Forth Programming | do drop >in | logged by clog at http://bit.ly/91toWN backup at http://forthworks.com/forth/irc-logs/ | If you have two (or more) stacks and speak RPN then you're welcome here! | https://github.com/mark4th
<siraben> mark4: you should see the isomorphic keyboard layouts for piano
<siraben> but indeed, you have to practice and get familiar with all 12 keys and they have different finger patterns
<siraben> KipIngram: what computer did you buy?
<siraben> yet another channel I participate in regularly has moved to libera
<KipIngram> It's a Lenovo ThinkPad Carbon X1 Gen 8.
<KipIngram> 16 GB RAM, 512 GB SSD.
AlyssaXY has quit [Ping timeout: 240 seconds]
<KipIngram> Seems to be drawing about 515 mA right now.
<KipIngram> If the capacity listed over there is right, that's 22 hours of time.
<KipIngram> I need to write my current monitoring utility - I keep a little tiny window in the bottom left of my console screen that reports that stuff to me.
<KipIngram> Updates every 30 seconds.
<KipIngram> the key command is
<KipIngram> upower -i /org/freedesktop/UPower/devices/battery_BAT0
<KipIngram> I catch that in a bash variable and then pick apart and do a little arithmetic.
boru` has joined #forth
boru has quit [Disconnected by services]
boru` is now known as boru
AlyssaXY has joined #forth
sts-q has quit [Ping timeout: 240 seconds]
sts-q has joined #forth
Rakko has joined #forth
Rakko has quit [Quit: Leaving]
lispmacs has left #forth ["rcirc on GNU Emacs 27.2"]
gravicappa has joined #forth
lispmacs has joined #forth
<siraben> f-a_: yeah, a lot of programming language channels have moved
lispmacs has left #forth ["rcirc on GNU Emacs 27.2"]
AlyssaXY has quit [Remote host closed the connection]
xek has quit [Remote host closed the connection]
proteus-guy has quit [Ping timeout: 240 seconds]
proteus-guy has joined #forth
xek has joined #forth
mtsd has joined #forth
<jn__> in any case, please announce a move in the /topic, if it's decided
Vedran has quit [Ping timeout: 260 seconds]
Vedran has joined #forth
proteanthread has joined #forth
rtdos has joined #forth
Vedran has quit [Ping timeout: 260 seconds]
Vedran has joined #forth
rtdos has left #forth [#forth]
proteanthread has left #forth [#forth]
Vedran has quit [Ping timeout: 260 seconds]
Vedran has joined #forth
<KipIngram> Morning, folks.
Vedran has quit [Ping timeout: 246 seconds]
Vedran has joined #forth
AlyssaXY has joined #forth
Vedran has quit [Read error: Connection reset by peer]
Vedran has joined #forth
mtsd has quit [Ping timeout: 240 seconds]
AlyssaXY has quit [Remote host closed the connection]
<cmtptr> been thinking about doing some experimenting this weekend, but on the other hand i also would like to know what the sun looks like again...
<KipIngram> :-)
<KipIngram> I'll be trying to move my Forth over to the new Linux box this weekend.
<KipIngram> All I should need to do is change the syscall and iocotl stuff.
<cmtptr> moving from 32-bit to 64?
<KipIngram> No - it's 64 on both.
<cmtptr> why do you have to change syscalls then?
<cmtptr> you bought something that isn't amd64?
<KipIngram> MacOS adds an offset to the syscall numbers, and has a slight difference in the registers used to pass parameters.
<KipIngram> Different "secret numbers" need to go to the ioctl syscall to get the termios right.
<cmtptr> oh it's a different os
<KipIngram> Right. MacOS --> Fedora.
<KipIngram> MacOS also forced me to use an "offset" based system - all of my definitions are stored as offsets from the origin of the system, and I point a register to the origin and then do register relative accesses.
<KipIngram> Linux doesn't require that, but will still allow it.
<KipIngram> It causes my NEXT to have one or two extra assembly language instructions that it would optimally need.
<KipIngram> I'll retain that feature for now, to minimize the porting work.
<KipIngram> In any case when my system can rebuild itself I'll be able to rebuild using absolute addresses.
<KipIngram> That relative thing is just a requirement of the MACHO executable format that MacOS uses.
<KipIngram> I point r15 at the base of my "body region" and r14 at the base of my "header region."
<KipIngram> A definition is a list of pointers into the header region. So I have to do those relative to r14. Then the CFA and PFA pointers (in the header region) point back to stuff in the body region, so those get r14 added.
<KipIngram> As a convenience, my NEXT code is the very first thing in the image, so r15 points directly to it.
<KipIngram> So I can implement NEXT as jmp r15.
<KipIngram> The headers consist of a two byte link field, just telling me how far back the previous header is, the counted name string, and then a CFA pointer and a PFA pointer.
<KipIngram> In my system an "xt" is an offset, of a CFA pointer in the header space.
<KipIngram> So if I take an xt, add r15 to it, fetch the 32-bit cell at that location, and add r14 to THAT, I have the address of machine code to execute.
<KipIngram> I'm sorry - I flipped r15 and r14 there.
<cmtptr> i knew that but i was waiting to see if you'd catch it
<KipIngram> ( xt --) r14 + h@ r15 + gives a code address.
<KipIngram> :-)
andrei-n has joined #forth
<KipIngram> and ( xt --) r14 + 4 + h@ r15 + gives a pointer to the definition list of a word.
<KipIngram> All of the bytes of the counted name string are guaranteed to have MSB=0, except for the count byte, which is guaranteed to have MSB=1. So I can scan from the CFA location back and recognize the count byte. That's the nfa. Then subtract 2 from that is the lfa.
<KipIngram> r13 is my IP. r12 is my data stack pointer, r11 is my return stack pointer.
<KipIngram> r10 is a "frame pointer" that I use to implement stack frames.
<KipIngram> r8 and r9 are scratch register pair that the virtual machine needs.
<cmtptr> i was wondering whether you burned a register for that or did you put them in the return stack
<KipIngram> rcx is the TOS.
<KipIngram> And rsi and rdi are "address registers"
<KipIngram> Well, I have a lot of registers - I tried to use them to gain performance.
<KipIngram> A lot of primitives need scratch regs anyway, and they can use r8 and r9 without having to save them.
<cmtptr> yeah now that i think of it, s0..s4 would take an indirection penalty if they had to go to the return stack for their frame address
<KipIngram> I've also allocated rbp for my "exception handling" system.
<KipIngram> No official use yet for rax, rbx, rdx.
<KipIngram> I think it's a pretty effective arrangement.
<MrMobius> i think it would be really interesting to profile forth on x86
<MrMobius> i think some of the speed killers on other platforms lile arm might not apply so you could come to some counter intuitive conclusions that would be interesting
AlyssaXY has joined #forth
<KipIngram> I've planned a profiling system.
<KipIngram> I see an easy way to get pretty rich data there.
<MrMobius> like appatently thrashing the stack may not have a speed penalty
<KipIngram> I can modify NEXT to use the IP to increment cells of a heat map array. Execution heat map.
<KipIngram> Set up all zeroes, flip NEXT to that modified version, and execute my app for a while.
<KipIngram> Then flip it back, and go see what the data looks like.
<MrMobius> that wouldnt really tell you anything about performance though
<KipIngram> Well, it would tell me about where my code was spending the most time.
<MrMobius> you might compare two versions and the one with more instructions and a noticeably different heat map might take much less time to run
<KipIngram> I could see which bits would benefit most from optimizing.
<KipIngram> But you're right - it's not a TIMING.
<MrMobius> ya thats true. it would be useful for that even if it didnt reveal anything abiut the underlying x86 magic. the thing is, improving the hot regions is tough if you cant test the performance
<KipIngram> But my definition of "profiling" is exactly that: where is the code spending its effort.
<KipIngram> I have a mechanism for reading the tsc, so I'll probably want some timing utilities as well.
AlyssaXY has quit [Quit: Leaving]
AlyssaXY has joined #forth
Zarutian_HTC has quit [Ping timeout: 240 seconds]
Zarutian_HTC has joined #forth
Zarutian_HTC has quit [Ping timeout: 246 seconds]
Kumool has joined #forth
AlyssaXY has quit [Remote host closed the connection]
AlyssaXY has joined #forth
kiedtl has joined #forth
kiedtl has quit [Client Quit]
AlyssaXY has quit [Remote host closed the connection]
proteus-guy has quit [Ping timeout: 260 seconds]
proteus-guy has joined #forth
<KipIngram> Happy Friday guys. Just got my second covid jab - bracing myself for the effects to roll in over the next few hours.
<KipIngram> Got my Forth assembly source moved to the new computer, and also chased down the include file and build script I used last time for Linux support.
<KipIngram> It was quite a bit of research and experimentation to chase down all of those magic numbers - especially the ones associated with the ioctl syscalls.
<KipIngram> But the results of that work are in that include file, so I shouldn't have any of that work to do again.
<KipIngram> All that stuff is NOT documented very well anywhere.
<KipIngram> For parts of it I had to figure out how to do whatever I was wanting to do in C, and then printing out the C #define values that it used.
<cmtptr> linux ioctl ids are generated with a series of macros... it take a bit of effort to decode them
<cmtptr> i want to say i've seen a decoder before, but i don't remember where. i'm pretty sure i've also used gcc -E to do it before
<KipIngram> Yep.
<KipIngram> That yields them up fairly readily.
<KipIngram> There's also a difference in one of the registers used to send in parameters to syscalls. I forget which is which right offhand, but I think it's r10 on one platform and rcx on the other one.
<KipIngram> The rest of the registers are the same.
<cmtptr> we used to have the same problem where i work in our ipc libraries. every module got a unique id and a range it could use for its message ids, and the macros that assembled there were scattered all over the place, which made it really irritating to debug when you were looking at a core dump and only had the hex value available to you
<KipIngram> And then Mac has you add 0x2000000 to all the syscall #'s.
<KipIngram> Yeah.
<KipIngram> But all the pieces are onhand now, and nasm is installed and it builds without error.
<cmtptr> kewl
<KipIngram> Of course it wouldn't run right now, but at least I know that much is in place.
wineroots has joined #forth
mark4 has quit [Read error: Connection reset by peer]
mark4 has joined #forth
gravicappa has quit [Ping timeout: 260 seconds]
spoofer has quit [Quit: Lost terminal]
spoofer has joined #forth
andrei-n has quit [Quit: Leaving]
rtdos has joined #forth
proteanthread has joined #forth
ovf has quit [Ping timeout: 260 seconds]
rann has quit [Read error: Connection reset by peer]
rann has joined #forth
ovf has joined #forth
Zarutian_HTC has joined #forth