Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tools/gcmole/README

Issue 6812002: Add GCMole to the repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 DESCRIPTION -------------------------------------------------------------------- -
2
3 gcmole is a simple static analysis tool used to find possible evaluation order
4 dependent GC-unsafe places in the V8 codebase.
5
6 For example the following code is GC-unsafe:
7
8 Handle<Object> Foo(); // assume Foo can trigger a GC.
Søren Thygesen Gjesse 2011/04/07 08:20:28 Start comment with uppercase - even in README :-)
9 void Bar(Object*, Object*);
10
11 Handle<Object> baz;
12 baz->Qux(*Foo()); // (a)
13 Bar(*Foo(), *baz); // (b)
14
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
17 calling to Foo and save a raw pointer to a heap object in the register or
18 on the stack.
19
20 PREREQUISITES ------------------------------------------------------------------ -
Søren Thygesen Gjesse 2011/04/07 08:20:28 Long line (few more below).
21
22 1) Install Lua 5.1
23
24 2) Get LLVM and Clang sources and build them.
25
26 Follow the instructions on http://clang.llvm.org/get_started.html.
27
28 Make sure to pass --enable-optimized to configure to get Release build
29 instead of a Debug one.
30
31 3) Build gcmole Clang plugin (libgcmole.so)
32
33 In the tools/gcmole execute the following command:
34
35 LLVM_SRC_ROOT=<path-to-llvm-source-root> make
36
37 USING GCMOLE ------------------------------------------------------------------- -
38
39 gcmole consists of driver script written in Lua and Clang plugin that does
40 C++ AST processing. Plugin (libgcmole.so) is expected to be in the same
41 folder as driver (gcmole.lua).
42
43 To start analysis cd into the root of v8 checkout and execute the following comm and:
44
45 CLANG_BIN=<path-to-folder-with-clang-binary> lua tools/gcmole/gcmole.lua [<arch> ]
46
47 where arch should be one of architectures supported by V8 (arm, ia32, x64).
48
49 Analysis will be performed in 2 stages:
50
51 - on the first stage driver will parse all files and build a global callgraph
52 approximation to find all functions that might potentially cause GC, list
53 of this functions will be written into gcsuspects file.
54
55 - on the second stage driver will parse all files again and will locate all
56 callsites that might be GC-unsafe based on the list of functions causing GC.
57 Such places are marked with a "Possible problem with evaluation order."
58 warning. Messages "Failed to resolve v8::internal::Object" are benign and
59 can be ignored.
60
61 If any errors were found driver exits with non-zero status.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698