blob: 34b3b196cada093b7494c4c2c3c8bc51399403ba [file] [log] [blame]
Barry Hayes7ef07552010-06-25 13:36:37 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * Note writes to the heap. These functions must be called if a field
19 * of an Object in the heap changes, and before any GC safe-point. The
20 * call is not needed if NULL is stored in the field.
21 */
22
23/*
24 * The address within the Object has been written, and perhaps changed.
25 */
Barry Hayes6e5cf602010-06-22 12:32:59 -070026INLINE void dvmWriteBarrierField(const Object *obj, void *addr)
27{
28 dvmMarkCard(obj);
Barry Hayes7ef07552010-06-25 13:36:37 -070029}
30
31/*
32 * All of the Object may have changed.
33 */
Barry Hayes6e5cf602010-06-22 12:32:59 -070034INLINE void dvmWriteBarrierObject(const Object *obj)
35{
36 dvmMarkCard(obj);
Barry Hayes7ef07552010-06-25 13:36:37 -070037}
38
39/*
40 * Some or perhaps all of the array indexes in the Array, greater than
41 * or equal to start and strictly less than end, have been written,
42 * and perhaps changed.
43 */
Barry Hayes6e5cf602010-06-22 12:32:59 -070044INLINE void dvmWriteBarrierArray(const ArrayObject *obj,
45 size_t start, size_t end)
46{
47 dvmMarkCard((Object *)obj);
Barry Hayes7ef07552010-06-25 13:36:37 -070048}