| OLD | NEW |
| 1 DESCRIPTION ------------------------------------------------------------------- | 1 DESCRIPTION ------------------------------------------------------------------- |
| 2 | 2 |
| 3 gcmole is a simple static analysis tool used to find possible evaluation order | 3 gcmole is a simple static analysis tool used to find possible evaluation order |
| 4 dependent GC-unsafe places in the V8 codebase. | 4 dependent GC-unsafe places in the V8 codebase. |
| 5 | 5 |
| 6 For example the following code is GC-unsafe: | 6 For example the following code is GC-unsafe: |
| 7 | 7 |
| 8 Handle<Object> Foo(); // Assume Foo can trigger a GC. | 8 Handle<Object> Foo(); // Assume Foo can trigger a GC. |
| 9 void Bar(Object*, Object*); | 9 void Bar(Object*, Object*); |
| 10 | 10 |
| 11 Handle<Object> baz; | 11 Handle<Object> baz; |
| 12 baz->Qux(*Foo()); // (a) | 12 baz->Qux(*Foo()); // (a) |
| 13 Bar(*Foo(), *baz); // (b) | 13 Bar(*Foo(), *baz); // (b) |
| 14 | 14 |
| 15 Both in cases (a) and (b) compiler is free to evaluate call arguments (that | 15 Both in cases (a) and (b) compiler is free to evaluate call arguments (that |
| 16 includes receiver) in any order. That means it can dereference baz before | 16 includes receiver) in any order. That means it can dereference baz before |
| 17 calling to Foo and save a raw pointer to a heap object in the register or | 17 calling to Foo and save a raw pointer to a heap object in the register or |
| 18 on the stack. | 18 on the stack. |
| 19 | 19 |
| 20 PREREQUISITES ----------------------------------------------------------------- | 20 PREREQUISITES ----------------------------------------------------------------- |
| 21 | 21 |
| 22 1) Install Lua 5.1 | 22 1) Install Lua 5.1 |
| 23 | 23 |
| 24 2) Get LLVM and Clang sources and build them. | 24 2) Get LLVM 2.9 and Clang 2.9 sources and build them. |
| 25 | 25 |
| 26 Follow the instructions on http://clang.llvm.org/get_started.html. | 26 Follow the instructions on http://clang.llvm.org/get_started.html. |
| 27 | 27 |
| 28 Make sure to pass --enable-optimized to configure to get Release build | 28 Make sure to pass --enable-optimized to configure to get Release build |
| 29 instead of a Debug one. | 29 instead of a Debug one. |
| 30 | 30 |
| 31 3) Build gcmole Clang plugin (libgcmole.so) | 31 3) Build gcmole Clang plugin (libgcmole.so) |
| 32 | 32 |
| 33 In the tools/gcmole execute the following command: | 33 In the tools/gcmole execute the following command: |
| 34 | 34 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 approximation to find all functions that might potentially cause GC, list | 53 approximation to find all functions that might potentially cause GC, list |
| 54 of this functions will be written into gcsuspects file. | 54 of this functions will be written into gcsuspects file. |
| 55 | 55 |
| 56 - on the second stage driver will parse all files again and will locate all | 56 - on the second stage driver will parse all files again and will locate all |
| 57 callsites that might be GC-unsafe based on the list of functions causing GC. | 57 callsites that might be GC-unsafe based on the list of functions causing GC. |
| 58 Such places are marked with a "Possible problem with evaluation order." | 58 Such places are marked with a "Possible problem with evaluation order." |
| 59 warning. Messages "Failed to resolve v8::internal::Object" are benign and | 59 warning. Messages "Failed to resolve v8::internal::Object" are benign and |
| 60 can be ignored. | 60 can be ignored. |
| 61 | 61 |
| 62 If any errors were found driver exits with non-zero status. | 62 If any errors were found driver exits with non-zero status. |
| OLD | NEW |