OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #include "src/shared/assert.h" | 5 #include "src/shared/assert.h" |
6 | 6 |
7 #include "src/vm/program_info_block.h" | 7 #include "src/vm/program_info_block.h" |
8 #include "src/vm/program_relocator.h" | 8 #include "src/vm/program_relocator.h" |
9 | 9 |
10 #ifdef VERBOSE | 10 #ifdef VERBOSE |
11 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__) | 11 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__) |
12 #else | 12 #else |
13 #define DEBUG_PRINT(...) | 13 #define DEBUG_PRINT(...) |
14 #endif | 14 #endif |
15 | 15 |
16 namespace fletch { | 16 namespace dartino { |
17 | 17 |
18 // Helper class that can be used as a visitor when iterating pointers/roots | 18 // Helper class that can be used as a visitor when iterating pointers/roots |
19 // to rebase them to a new address. It takes four arguments: | 19 // to rebase them to a new address. It takes four arguments: |
20 // | 20 // |
21 // from: the address, in memory, of the source data structure | 21 // from: the address, in memory, of the source data structure |
22 // target: the address, in memory, of the mirror copy that is to be | 22 // target: the address, in memory, of the mirror copy that is to be |
23 // updated | 23 // updated |
24 // host_base: the base address, in memory, of the heap that from is | 24 // host_base: the base address, in memory, of the heap that from is |
25 // allocated from | 25 // allocated from |
26 // rebase_base: the base address, in the address space we are rebasing to, where | 26 // rebase_base: the base address, in the address space we are rebasing to, where |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 reinterpret_cast<ProgramInfoBlock*>(target_ + heap_size); | 156 reinterpret_cast<ProgramInfoBlock*>(target_ + heap_size); |
157 program_info->PopulateFromProgram(target_program); | 157 program_info->PopulateFromProgram(target_program); |
158 | 158 |
159 free(target_program); | 159 free(target_program); |
160 | 160 |
161 DEBUG_PRINT("Relocation complete, result is %d bytes...\n", target.length()); | 161 DEBUG_PRINT("Relocation complete, result is %d bytes...\n", target.length()); |
162 | 162 |
163 return total_size; | 163 return total_size; |
164 } | 164 } |
165 | 165 |
166 } // namespace fletch | 166 } // namespace dartino |
OLD | NEW |