rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has quit [Quit: Leaving...]
rgrinberg has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
Everything has quit [Ping timeout: 256 seconds]
Everything has joined #ocaml
<Corbin>
Ugh, deja vu, but I don't think I've asked this yet: with sexplib, is it possible to load an S-expression from a file, but somehow filter the file first? Or do I have to open the file, run the filter on the contents, and then parse the remainder?
Tuplanolla has quit [Quit: Leaving.]
<Corbin>
Because I'm not great at making choices, the filter's currently written in Python 3. I'm thinking that I've gotta rewrite at least one component.
Everything has quit [Quit: leaving]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kaph has quit [Read error: Connection reset by peer]
<d_bot>
<ohad> anyone have any tips for debugging the ocaml compiler/runtime? im porting ocaml to a new OS and encountered some weird errors:
<d_bot>
<ohad> 1. when running `ocamlopt.opt` and `ocamlc.opt`, the code in `Random.State.full_init` crashes with a bounds error (which after some printf debugging comes from `let j = i mod 55` giving values >55)
<d_bot>
<ohad> 2. `ocamlopt.byte` immediately crashes with `input_value: native integer value too large` (and seemingly crashes too early to print a stack trace)
<d_bot>
<ohad> strangely enough everything else looks like it's working fine, but these two errors both look pretty scary
<d_bot>
<ohad> with #1 especially i'd be inclined to think the codegen is wrong, but this is running on i386 on 4.12.0 which id imagine is pretty heavily tested
shawnw has joined #ocaml
waleee has quit [Ping timeout: 268 seconds]
hexology has quit [Quit: hex on you ...]
Everything has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
<d_bot>
<ohad> so i think i've cracked the case here for #1. basically, im using an amd64 machine to cross-compile ocaml to x86. somewhere along the way it seems like the compiler is making assumptions based on math that works on amd64 and then generating code for it on x86
<d_bot>
<ohad> not sure if this is officially a "bug" since ocaml doesn't really support cross compilation, but on the github docs it seems to imply that this should be possible: https://github.com/ocaml/ocaml/blob/trunk/INSTALL.adoc#configuration (compiling from amd64 -> i686)
<d_bot>
<ohad> any chance im just missing a flag here that makes this work correctly?
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Haudegen has joined #ocaml
hornhack has joined #ocaml
hackinghorn has quit [Ping timeout: 256 seconds]
bartholin has joined #ocaml
<d_bot>
<EduardoRFS> @ohad this will not work, you need same word size compilers to cross compile
<d_bot>
<Continuation Calculus> is there a ready-made memoization library that can work with any pure function and data-type, without having to provide an equal or a compare function? like, a thing that uses the pointer / underlying int to do the memoization?
<d_bot>
<Continuation Calculus> if there is none, is this a bad idea?
<d_bot>
<Continuation Calculus> (from what I understand: somethingsomething GC can shuffle pointers around, but somethingsomething ephemerons and similar data-structures can keep track of this)
<d_bot>
<octachron> Using the memory address is the same thing as using the physical equality as the `equal` function.
<d_bot>
<Continuation Calculus> oh, i forgot this was exposed, nice.
<d_bot>
<Continuation Calculus> ah. now i see, it means that to have this library, you'd need to iterate over all the memoized parameters, because you only have access to `equal`
<d_bot>
<Continuation Calculus> so you still need at least some pre-`hash`
<d_bot>
<octachron> Yes, you need some more structure/information to have a fast lookup.
<d_bot>
<Continuation Calculus> and now, we're back to something very close to ephemerons
<d_bot>
<Continuation Calculus> well, off to writing this library then
<d_bot>
<octachron> (You may want to have a look at the `Memoize` module of the Fix library)
<d_bot>
<Continuation Calculus> I will likely do so, but I really do want ephemerons and the like as I plan to have those things live in long-lived processes (LSP)
Tuplanolla has joined #ocaml
bobo_ has joined #ocaml
spip has quit [Ping timeout: 260 seconds]
dalek-caan has joined #ocaml
xiongxin has joined #ocaml
xiongxin has quit [Remote host closed the connection]
gopcode has quit [Quit: Client closed]
gravicappa has joined #ocaml
shawnw has quit [Ping timeout: 268 seconds]
waleee has joined #ocaml
<travv0>
Is there a cross-platform library that’ll let me copy a file while preserving its modification time?
<travv0>
Never mind, just found the utimes function in Unix
mro has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
xd1le has quit [Quit: xd1le]
Haudegen has quit [Quit: Bin weg.]
<d_bot>
<let Butanium = raise Not_found;;> I know some magic compiler parameters in C can speed up your code. I only know they exist - because their are used in code challenges - idk how they work and what they do. Does this exist with OCaml too ?
<d_bot>
<Abbix> you mean optimizations?
hornhack has quit [Ping timeout: 268 seconds]
<d_bot>
<ohad> ah interesting, makes sense though i do wish that INSTALL.adoc made that a little more clear
<d_bot>
<ohad> it seems like it might actually be an easy patch by overriding the `Sys.word_size` when host size != build size, but haven't confirmed that that's the only place where it breaks
<d_bot>
<EduardoRFS> That's not the problem, the problem is codegen
<d_bot>
<EduardoRFS> Your division will be broken as an example
<d_bot>
<ohad> right, the code that's used to optimize division uses `Sys.word_size` and changing it to return `4` should fix it
mro has quit [Quit: Leaving...]
mbuf has quit [Quit: Leaving]
<d_bot>
<let Butanium = raise Not_found;;> tes
rgrinberg has joined #ocaml
<d_bot>
<EduardoRFS> Now you need to find all places that use the wrong word_size, there is not only Sys.word_size
<d_bot>
<EduardoRFS> But probably shouldn't be that hard if you get the test suite right
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
hornhack has joined #ocaml
gravicappa has quit [Ping timeout: 268 seconds]
rgrinberg has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Techcable has quit [Ping timeout: 240 seconds]
<d_bot>
<Et7f3> OCaml has regular -O3
<d_bot>
<Et7f3> and can give any options you want to underlying compiler with -ccopt
Techcable has joined #ocaml
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
<d_bot>
<let Butanium = raise Not_found;;> So if I look for those magic instructions in C I should be able to use them in OCaml too ?
kaph_ has quit [Ping timeout: 256 seconds]
<d_bot>
<let Butanium = raise Not_found;;> If you have some resources about it in OCaml (or in C) let me know. Otherwise if you know the keyword I should use on Google that would be awesome too
<d_bot>
<Et7f3> for a .ml file ocamlopt generate .s file, call external assembler/linker. So if you want to pass optimization flag you can use -ccopt (I don't think assembler has optimizations), and also -cclib (linker flag: -flto for instance). ccopt are also passed to linker.
Techcable has quit [Client Quit]
Techcable has joined #ocaml
<d_bot>
<Et7f3> for a .c/cpp file ocamlopt convert in .s with external compiler. You can give option with -ccopt.
<d_bot>
<Et7f3> and for intrinsic you might need to use a c stub with ocaml ffi and maybe some `[@noalloc]` and other attribute.
dalek-caan has quit [Quit: dalek-caan]
<d_bot>
<Et7f3> @let Butanium = raise Not_found;;
Everything has left #ocaml [#ocaml]
spip has joined #ocaml
bobo_ has quit [Ping timeout: 256 seconds]
kaph has joined #ocaml
<d_bot>
<Et7f3> Happy new year 🥳
jsoo_ has joined #ocaml
aru_ has joined #ocaml
olle_ has joined #ocaml
infinity0_ has joined #ocaml
infinity0_ is now known as infinity0
infinity0 has quit [Killed (calcium.libera.chat (Nickname regained by services))]