What returns Assembler.make()?

34 views
Skip to first unread message

Jong-il Hong

unread,
Nov 6, 2013, 2:55:52 AM11/6/13
to asmji...@googlegroups.com
What returns Assembler.make()?
 
That is bytes of opcodes?
 
If right, how can I get that bytes length?
 
 
Is it automately allocate virtual memory?
 
If yes, can I get assembled codes in stack or heap whitout allocation?
 
 
Thanks.

Ryan Gonzalez

unread,
Nov 6, 2013, 12:41:42 PM11/6/13
to asmji...@googlegroups.com
Whoa...one question at a time!

1. Do you mean what Assembler.make() returns? Cause it's the built function. Calling the function runs the jitted code. See the examples at the website.

2-4. No clue...


--
 
---
You received this message because you are subscribed to the Google Groups "asmjit-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to asmjit-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Ryan

Petr Kobalíček

unread,
Nov 6, 2013, 9:26:30 PM11/6/13
to asmjit-dev
Hi Jong,

the Assembler::make() returns allocated and runnable function. If you just need to get bytes there are some member functions to get them, just go though getters and you will find them.

you can use getOffset() for example or getCodeSize() to get the size of the binary, and you can use relocCode() to relocate the binary into your own buffer.

The simplest example would be:

Assembler a;

...

void* buf = malloc(a.getCodeSize());
if (buf == NULL) {}

a.relocCode(buf);

Hope that helps

Best,
Petr
Reply all
Reply to author
Forward
0 new messages