-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assembler segfaults because it doesn't reserve enough memory #238
Comments
Performance was really important when we first wrote the assembler, so I
think that an undocumented assumption was that you would call reserve if
you needed it, but we wouldn't force you to call it for every instruction
if you didn't want to.
Looking back, this was probably premature optimization (or wishful thinking
--- it's hard to see now how this could ever have been much of a
bottleneck). A much cleaner implementation would have been to put the
reserve check into the Function class (I think Function --- I don't know
what it's called now --- the thing that holds the assembled buffer) and not
bothered the user with it.
(I'm just musing --- I haven't looked at this code in a while, and
everything I'm saying might no longer be true.)
…On Mon, May 8, 2017 at 10:09 AM Jack Serrino ***@***.***> wrote:
I don't have a minimal bug reproducing program, but when doing something
of the form:
x64asm::Function function;
x64asm::Assembler assembler;
assembler.start(function);
// ... lots of assembly here, mov for me seemed to trigger the segfault ...
assm.mov(r10, Imm64{10L});
assm.finish();
cout << function << endl;
Given enough instructions, this program will segfault. Maybe this is
because the implementations used to write instructions don't call the
reserve method?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#238>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAm4rmUdI19WCL4P8rnrkjopSVcBNYvbks5r30xGgaJpZM4NUOyy>
.
|
@eschkufz maybe worth it to add to the documentation? we can do a PR |
Yeah, we'd be happy to accept a PR to add this to the documentation! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't have a minimal bug reproducing program, but when doing something of the form:
Given enough instructions, this program will segfault. Maybe this is because the implementations used to write instructions don't call the reserve method?
The text was updated successfully, but these errors were encountered: