1
/*
2
 * $Id$
3
 *
4
 * Copyright (C) 2003-2009 JNode.org
5
 *
6
 * This library is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Lesser General Public License as published
8
 * by the Free Software Foundation; either version 2.1 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful, but 
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
14
 * License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with this library; If not, write to the Free Software Foundation, Inc., 
18
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
 */
20
 
21
package org.jnode.vm.memmgr;
22
23
import org.jnode.vm.VmSystemObject;
24
import org.vmmagic.pragma.UninterruptiblePragma;
25
26
/**
27
 * @author Ewout Prangsma (epr@users.sourceforge.net)
28
 */
29
public abstract class VmWriteBarrier extends VmSystemObject {
30
31
    /**
32
     * This method is inlined to implement the write barrier for aastores
33
     *
34
     * @param ref   The base pointer of the array
35
     * @param index The array index being stored into.  NOTE: This is the "natural" index; a[3] will pass 3.
36
     * @param value The value being stored
37
     */
38
    public abstract void arrayStoreWriteBarrier(Object ref, int index, Object value)
39
        throws UninterruptiblePragma;
40
41
    /**
42
     * This method implements the write barrier for putfields of references
43
     *
44
     * @param ref    The base pointer of the array
45
     * @param offset The offset being stored into.  NOTE: This is in bytes.
46
     * @param value  The value being stored
47
     */
48
    public abstract void putfieldWriteBarrier(Object ref, int offset, Object value)
49
        throws UninterruptiblePragma;
50
51
    /**
52
     * This method is inlined to implement the write barrier for putstatics of references
53
     *
54
     * @param shared       Is this a shared static field
55
     * @param staticsIndex The offset of static field (in VmSharedStatics or VmIsolatedStatics)
56
     * @param value        The value being stored
57
     */
58
    public abstract void putstaticWriteBarrier(boolean shared, int staticsIndex, Object value)
59
        throws UninterruptiblePragma;
60
61
    /**
62
     * This method generates write barrier entries needed as a consequence of
63
     * an explicit user array copies.
64
     *
65
     * @param array The referring (source) array.
66
     * @param start The first "natural" index into the array (e.g. for
67
     *              <code>a[1]</code>, index = 1).
68
     * @param end   The last "natural" index into the array
69
     */
70
    public abstract void arrayCopyWriteBarrier(Object array, int start, int end)
71
        throws UninterruptiblePragma;
72
}