Permalink
Browse files

update Context::executableSize after allocating objectPool

This ensures that, if an exception is thrown later but before the
method has been fully compiled, we will know exactly how much memory
to free.  Previously, we would abort when trying to free the wrong
amount due to an assertion failure.
  • Loading branch information...
1 parent 8c1419f commit 49d8ccb1bdfecfa49eec051c6e3f2957b44b8b0c @dicej dicej committed Apr 10, 2013
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/compile.cpp
View
@@ -7307,6 +7307,9 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
FixedSizeOfArray + ((context->objectPoolCount + 1) * BytesPerWord),
true);
+ context->executableSize = (allocator->base + allocator->offset)
+ - static_cast<uint8_t*>(context->executableStart);
+
initArray(t, pool, context->objectPoolCount + 1);
mark(t, pool, 0);

0 comments on commit 49d8ccb

Please sign in to comment.