2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package gov.nasa.jpf.vm;
21 * abstraction for the container of StaticElementInfos, which manages static fields.
22 * Note that there is a Statics instance per ClassLoaderInfo, i.e. ids are only unique within each
23 * ClassLoader namespace.
25 * This container is only growing - we don't remove/recycle classes yet
27 * Since Statics instances have to be obtained from their respective ClassLoaderInfo, and
28 * ClassLoaderInfos are the ones that map type names to ClassInfos, Statics does not include
29 * methods for name lookup. This allows implementors to use efficient lookup based on the numerical
30 * ClassInfo id (which is only unique within this Statics / ClassLoader namespace)
32 public interface Statics extends Iterable<ElementInfo> {
37 * startup classes are registered and initialized in two steps since object
38 * creation has to be deferred until we have at least Object and Class ClassInfos
40 StaticElementInfo newStartupClass (ClassInfo ci, ThreadInfo ti);
43 * this returns the search global id which is unique within this ClassLoader namespace.
44 * This id is also stored in the respective java.lang.Class object
46 StaticElementInfo newClass (ClassInfo ci, ThreadInfo ti, ElementInfo eiClsObj);
52 * get an ElementInfo that might or might not be suitable for modification. This should only
53 * be used when retrieving field values. The 'id' argument has to be the result of a previous 'newClass()' call
55 StaticElementInfo get (int id);
58 * get an ElementInfo that is guaranteed to be modifiable. This should be used when modifying
59 * field values. The 'id' argument has to be the result of a previous 'newClass()' call
61 StaticElementInfo getModifiable (int id);
66 Iterable<StaticElementInfo> liveStatics();
68 void markRoots (Heap heap);
69 void cleanUpDanglingReferences (Heap heap);
72 //--- state management
74 Memento<Statics> getMemento(MementoFactory factory);
75 Memento<Statics> getMemento();