summaryrefslogtreecommitdiff
path: root/test/MultiDex/Second.java
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2019-12-17 16:15:35 -0800
committerAlex Light <allight@google.com>2019-12-18 18:32:05 +0000
commit7ba68ffa031040fe91a923278910297ecf17edbe (patch)
treeb8c528ef9824188a18f55eafae68de7f114d8d04 /test/MultiDex/Second.java
parent7a6b966d348ee780922e04a8304d3dcc9e297517 (diff)
Fix ABA bug with PreObjectAlloc event being missed
We prevent the PreObjectAlloc event from ever being disabled after being activated for allocation pausing the first time. This is to prevent an instance of the ABA problem where a thread can miss the fact that the size of the object it's allocating has changed if it was suspended within the allocation path during the redefinition. We need to make sure that every thread gets a chance to see the PreObjectAlloc event at least once or else it could miss the fact that the object its allocating had its size changed. Consider the following 2 threads. T1 is allocating an object of class K. It is suspended (by user code) somewhere in the AllocObjectWithAllocator function, perhaps while doing a GC to attempt to clear space. With that thread suspended on thread T2 we decide to structurally redefine 'K', changing its size. To do this we insert this PreObjectAlloc event to check and update the size of the class being allocated. This is done successfully. Now imagine if T2 removed the listener event then T1 subsequently resumes. T1 would see there is no PreObjectAlloc event and so allocate using the old object size. This leads to it not allocating enough. To prevent this we simply force every allocation after our first pause to go through the PreObjectAlloc event. Test: setup runit.sh to run test 2005. ./art/tools/parallel_run.py -j80 --out art/out.txt ./art/runit.sh Test: ./test.py --host Bug: 146436130 Change-Id: I7cdc1d133a7cbba7784b906b587e565072a453b2
Diffstat (limited to 'test/MultiDex/Second.java')
0 files changed, 0 insertions, 0 deletions