From 603f5f9bbfe17389b7d8e6d9437422e0a94779fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Wed, 28 Sep 2016 20:38:52 +0200 Subject: [PATCH] VM: better? comment for uninitialized_blocks --- vm/code_heap.hpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vm/code_heap.hpp b/vm/code_heap.hpp index 65e4379f20..69e3683ac9 100644 --- a/vm/code_heap.hpp +++ b/vm/code_heap.hpp @@ -19,11 +19,18 @@ struct code_heap { // Memory allocator free_list_allocator* allocator; + // For fast lookup of blocks from addresses. std::set all_blocks; - // Keys are blocks which need to be initialized by initialize_code_block(). - // Values are literal tables. Literal table arrays are GC roots until the - // time the block is initialized, after which point they are discarded. + + // Code blocks are initialized in two steps in + // primitive_modify_code_heap() because they might reference each + // other. First they are all allocated and placed in this map with + // their literal tables which are GC roots until the block is + // initialized. Then they are all initialized by + // initialize_code_block() which resolves relocations and updates + // addresses. Uninitialized blocks instructions must not be visited + // by GC. std::map uninitialized_blocks; // Code blocks which may reference objects in the nursery