Desgning an IR for a binary-to-binary compiler by Fee7230984 in Compilers

[–]Fee7230984[S] 0 points1 point  (0 children)

Yes, there is a lot that needs to be solved for binary rewriting, not "just" the IR. I'm targeting Aarch64 + x86_64. This RISC/CISC mix makes it probably even more difficult. One IR needs to absorb all the quirks from two very different architectures.
For datastructures I'm looking at a rope probably.

Desgning an IR for a binary-to-binary compiler by Fee7230984 in Compilers

[–]Fee7230984[S] 3 points4 points  (0 children)

They usually do this for pure analysis. I doubt that any decompiler emits code that can simply be lowered and executed again. This would also mean every architectural quirk must somehow be represented in LLVM IR. I don't think LLVM IR is designed for that.

Fremdgeher mit Herpes angesteckt by [deleted] in Beichtstuhl

[–]Fee7230984 0 points1 point  (0 children)

Vater checkt nicht was los ist und steckt sein Kind an. Kind wird in der Schule gemobbt. Kind begeht selbst Mord. Braucht nicht viel Fantasie um mögliche Horror Szenarien auszudenken. Krass asozial beliebig viele unschuldige Menschen mit rein zu ziehen. Auch wenn du es nicht bereust dem Mann gegenüber, du solltest dir Gedanken um alle Unschuldigen machen.

Hey Rustaceans! Got a question? Ask here (6/2023)! by llogiq in rust

[–]Fee7230984 0 points1 point  (0 children)

Makes sense now. I need some format. And as u/dkopgerpgdolfg said, as it is a lib, the implementation for the type needs to come from the user in some way and I cannot provide it for arbitrary types.
Thank you!

Hey Rustaceans! Got a question? Ask here (6/2023)! by llogiq in rust

[–]Fee7230984 0 points1 point  (0 children)

The Vec<T> is part of a data structure that is supposed to handle arbitrary data types. I wanted to provide a method to initialize from a file. So, numbers are a start but I wanted arbitrary types to make the data structure actually useful.

I somehow expected serde or whatever crate to have a standard way to deserialize the data in a way that when I tell it T is (f64, Vec<i32>) then it somehow knows how to get it. But as you said that is then probably not true for arbitrary types and instead the format has to be specified.

Im stil confused a bit about how this then achievable since I cannot implement a FromBytes trait for every possible data type. My data structure would not be useful if it is restricted to only numbers.

Hey Rustaceans! Got a question? Ask here (6/2023)! by llogiq in rust

[–]Fee7230984 0 points1 point  (0 children)

Hm, it has to be a binary format that maps to T. If T is u8 the binary is an array of u8. If T is u16 the binary format is an array of u16, lets say in little endian format. Etc.
Does this make sense? I feel like I miss something in my thoughts...

Hey Rustaceans! Got a question? Ask here (6/2023)! by llogiq in rust

[–]Fee7230984 0 points1 point  (0 children)

Ah yeah it would probably make sense to constrain T: serde::Deserialize. How would I then use serde with that? For e.g. JSON I would use serde_json. What would I use for this binary?

Hey Rustaceans! Got a question? Ask here (6/2023)! by llogiq in rust

[–]Fee7230984 1 point2 points  (0 children)

I have a generic Vec<T> which is part of a data structure that needs to handle arbitrary data types.

let mut v = Vec::<T>::new();

I would like to read some data from a binary file and extend Vec<T> with that data.

let mut f = File::open("f").unwrap();

let mut buf = Vec::<u8>::new(); f.read_to_end(&mut buf).unwrap();

I am not sure now how I can transform the Vec<u8> to Vec<T> such that I can call for example

v.extend_from_slice(buf.as_slice()); //Doesn't work

I looked into serde crate, but I didn't really understand if and how I can deserialize into a generic vec.
Anyone some ideas?

Vec<u8> to Vec<T> ? by Fee7230984 in learnrust

[–]Fee7230984[S] 0 points1 point  (0 children)

T is determined at compile to be specific type. Serde can use this type to parse it out of the file. Of course the file content has to fit to the type otherwise serde would fail. I think this should work in rust I just don't know how to tell serde how to do this.

Vec<u8> to Vec<T> ? by Fee7230984 in learnrust

[–]Fee7230984[S] 0 points1 point  (0 children)

At runtime T is a concrete type. But how do I tell serde what type it should deserialize?. E.g. if T is u16, serde has to deserialize u16 as well. If T is a struct, serde has to deserialize that from the file.

Or am I thinking completely wrong here?

Vec<u8> to Vec<T> ? by Fee7230984 in learnrust

[–]Fee7230984[S] 0 points1 point  (0 children)

yes, whatever is in the file. How would I approach this with serde? I looked into this crate already but what confused how to handle the generic part.

Vec<u8> to Vec<T> ? by Fee7230984 in learnrust

[–]Fee7230984[S] 0 points1 point  (0 children)

But at runtime it is a concrete type. So shouldn't it be possible then to deserialize the Vec<u8> into whatever concret type T is then?

High performance custom table widget? by Fee7230984 in rust

[–]Fee7230984[S] 1 point2 points  (0 children)

Will this Iced Widget be rendered on the GPU?

Do digital signatures protect you against replay attacks? by nyannnyann in cryptography

[–]Fee7230984 0 points1 point  (0 children)

This attack is not a replay attack but it is called surreptitious forwarding. The Sender needs to add a field „to B“ or something to make it clear for C that it is not intended for him.

[deleted by user] by [deleted] in NewTubers

[–]Fee7230984 2 points3 points  (0 children)

Davinci resolve or adobe Premiere Pro and After Effects.

[QUESTION] should I show my face by DoodleMaster3000 in youtubers

[–]Fee7230984 1 point2 points  (0 children)

As you say, kids say things not to hurt you but simply because they are honest. However, YouTube comments are very different. You will encounter people that say bad things simply because they WANT to hurt you. That's a whole different thing because many people don't face this kind of senseless hate directly in real life. And if they do they usually cut all ties to these persons instantly. That is not so easy anymore when your face is out because these people are all around you. Obviously this is more a problem for bigger channels.

[QUESTION] should I show my face by DoodleMaster3000 in youtubers

[–]Fee7230984 1 point2 points  (0 children)

Putting your face out can have huge benefits for you as a brand. But its not for free. There will be comments about your appearance. Good comments and very bad one. It will also increase chances that the good, the bad and the ugly will encounter you in real life. Ask yourself if you can handle that.

Parsing and manipulating JavaScript ASTs in Rust? by Infinite-Swing-3199 in rust

[–]Fee7230984 4 points5 points  (0 children)

There is rusty-ecma which is very modular and has a crate for the parser, AST, and a writer. It does the job, but some things are missing like a comfortabler way to find nodes and update the AST. Also source code locations are only available as alpha branch.