zherczeg / sljit

Platform independent low-level JIT compiler
Other
841 stars 74 forks source link

Define all the possible emit combinations? #227

Closed stevefan1999-personal closed 6 months ago

stevefan1999-personal commented 9 months ago

Hi, I'm making a Rust wrapper to SLJIT, and I want to have type safe definition of opcode emission using Rust as well for high-level bindings, but I'm not sure about all the possible combinations, i.e. the possible cases for each opcode. For example, I'm not sure under what condition I can ignore the srcw and dstw parameter.

But so far, I can rewrite some of the examples to use my mid-level bindings semi-converted to a certain level of idiomatic Rust. Code will be released soon after some bookkeeping

zherczeg commented 9 months ago

This is great news! The 'w' means word value, and only ignored (must be 0) for register / register pair arguments. Memory uses it for absolute address / offset / shifting, and immedate uses it as constant. Maybe the value pair can be boxed into some structure with a simple constructor.

Do you plan to use it for something?

stevefan1999-personal commented 9 months ago

This is great news! The 'w' means word value, and only ignored (must be 0) for register / register pair arguments. Memory uses it for absolute address / offset / shifting, and immedate uses it as constant. Maybe the value pair can be boxed into some structure with a simple constructor.

Do you plan to use it for something?

Yes. I'm planning to use it for learning how to write a JIT interpreter, because I found cranelift too heavyweight at the moment and dynasm-rs is too limited in platform support