geo80 has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 240 seconds]
geo80 has joined #picolisp
<geo80>
morning!
<geo80>
Hi Regenaxer, I saw the changes as well as weekend progress with tankf33der during the weekends for pil21, cool!
<geo80>
btw I was wondering if it is fine to add -no-pie at gcc compilation in the official pil21 repo? this is the fix for the seg-fault on my side.
karswell has quit [Remote host closed the connection]
karswell has joined #picolisp
<geo80>
Hi Regenaxer,I'm also trying to implement opt but im still confused how to use mockPil
orivej has joined #picolisp
<Regenaxer>
Good morning geo80!
<Regenaxer>
Yes, -no-pie might be necessary, not sure in which cases (which systems) it is needed explicitly
<Regenaxer>
'opt' has nothing to do with MockPil
<Regenaxer>
MockPil is llvm frontend
<Regenaxer>
'opt' is a separate tool operating on the backend
<Regenaxer>
The llvm generated by the frontend must be optimized too (adding attributes etc.), but I want to do that later when everything else is stable
<geo80>
Hi Regenaxer! noted about -no-pie. I would say first case would be mine, which is building under WSL
<geo80>
noted about frontend and backend, thanks! but actually what I wan to mean is
<geo80>
I am currently reading the code of loadAll
<geo80>
because based in pil64, loadAll and opt are almost similar
<geo80>
so i plan to use and modify the code of pil21 loadAll
<geo80>
from what I understand, the code of pil21 are in MockPil which will be parsed using llvm.l which then generates the base.ll
<Regenaxer>
Yes, the structure of the code in pil64 and piu21 is the same
<Regenaxer>
mostly
<Regenaxer>
and yes, the procedure is as you describe
<Regenaxer>
In the long range, a backend -> Verilog would be cool. I wonder if something like that exists in llvm already
<geo80>
ok thanks for confirming
<geo80>
ah hmm as far as i know i think not yet coz from what i understand, Verilog is used to model your own customized processor. unlike the current backends supported by llvm are already real general purpose processors
<geo80>
but maybe there will be in the future? let me investigate that as well
<geo80>
about this code:
<geo80>
(de loadAll (Exe)
<geo80>
(let (X $Nil P (val $AV))
<geo80>
(loop
<geo80>
(let Q (val P)
<geo80>
(? (=0 Q))
<geo80>
(?
<geo80>
(and
<geo80>
(== (val Q) (char "-"))
<geo80>
(=0 (val (i Q))) ) )
<geo80>
(setq
<geo80>
P (set $AV (i P))
<geo80>
X (repl Exe 0 (mkStr Q)) ) ) )
<geo80>
X ) )
<geo80>
for opt, i want to remove the opt as well as the repl
<geo80>
sorry i mean for opt, i want to remove the loop and repl
<geo80>
and just X (mkStr Q)
<geo80>
is my understanding correct?
<Regenaxer>
You could also write a separate test function
<geo80>
i see hmm what confuses me is the (?
<geo80>
based on the standard pil, this is related to pilog? but for mockPil i assume its different use?
<Regenaxer>
yes, I used '?' for a special operator to exit loops
<Regenaxer>
Pilog is not needed in MockLisp
<Regenaxer>
(probably, and if it were, '?' is for interactive use only)
<geo80>
oh! so that's why, so ? is for exiting loop
<geo80>
ok let me try redo my code
<geo80>
thanks!
<Regenaxer>
loop, cond and nond are different in that they accept 'T' as first arg to indicate that they return a value
<Regenaxer>
yes, '?' exits
<Regenaxer>
different from PicoLisp
<Regenaxer>
in PicoLisp, 'loop' accepts (T ...), but only on top level
<geo80>
so it exits if the statement becomes false, correct?
<Regenaxer>
'?' in MockPil can be inside nested structures
<Regenaxer>
it exits if true
<geo80>
ah ok2 got it, thanks!
<Regenaxer>
Similar to (T (condition) ... in Pil
<geo80>
let me redo it and check
<geo80>
ok noted
<Regenaxer>
'?' works also in 'while' and 'until'
<geo80>
ok noted, btw quick question. in the code above, does P and Q have the same value?
<Regenaxer>
No, Q in the indirection of P
<Regenaxer>
(let Q (val P)
<Regenaxer>
both are pointers, as all data in pil
<geo80>
ah ok thanks
<geo80>
Hi Regenaxer, is this mockPil code:
<geo80>
(de _opt (X)
<geo80>
(let (X $Nil P (val $AV) Q (val P))
<geo80>
(when (and
<geo80>
(n0 Q)
<geo80>
(<> (val Q) (char "-"))
<geo80>
(n0 (val (i Q))) )
<geo80>
(setq
<geo80>
P (set $AV (i P))
<geo80>
X (mkStr Q) ))
<geo80>
X ) )
<geo80>
equivalent to this PilASM code:
<geo80>
(code 'doOpt 2)
<geo80>
ld E ((AV)) # Command line vector
<geo80>
null E # Next string pointer?
<geo80>
jz retNil # No
<geo80>
ld B (E) # Single-dash argument?
<geo80>
cmp B (char "-")
<geo80>
if eq
<geo80>
nul (E 1)
<geo80>
jz retNil # Yes
<geo80>
end
<geo80>
add (AV) I # Increment vector pointer
<geo80>
jmp mkStrE_E # Return transient symbol
<Regenaxer>
_opt is a copy of loadAll?
<Regenaxer>
Then it must be about the same ;)
<geo80>
ah almost copy but without loop and without repl
<geo80>
from what i understand :)
<Regenaxer>
ok
<geo80>
im not sure how to verify if opt works but what i did is
<tankf33der>
they count bytes words and lines separetly
<tankf33der>
like wc
<tankf33der>
i've create big txt file from tolstoy war and peace :)
beneroth has joined #picolisp
beneroth has quit [Client Quit]
<Regenaxer>
I suspect it is a lot faster if you traverse the file twice (till " " "\t") and (till "\r" "\n" ) and take the bytes from (car (info "file"))
<Regenaxer>
Reading the whole file into data structures takes awfully long compared to these three operations
<Regenaxer>
Cause the OS caches the file, and second traversal is faster
<Regenaxer>
And, even *more* fast is if you use the 'lines' function which counts lines most efficiently :)
orivej has joined #picolisp
<tankf33der>
but anyway i will read file twice. right ?
<Regenaxer>
yes
<Regenaxer>
but 'lines' has no further function call overhead like 'inc' and 'till'