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;
20 import gov.nasa.jpf.Config;
21 import gov.nasa.jpf.annotation.MJI;
22 import gov.nasa.jpf.vm.JPF_gov_nasa_jpf_vm_Verify;
23 import gov.nasa.jpf.vm.MJIEnv;
24 import gov.nasa.jpf.vm.NativePeer;
27 * just a dummy for now, to avoid UnsatisfiedLinkErrors
29 public class JPF_java_lang_Runtime extends NativePeer {
32 public void addShutdownHook__Ljava_lang_Thread_2__V (MJIEnv env, int objref, int threadRef) {
37 public long totalMemory____J (MJIEnv env, int objref) {
38 // not really sure what to return here, since in reality this
39 // value can be non-deterministic
44 public long maxMemory____J (MJIEnv env, int objref) {
50 public long freeMemory____J (MJIEnv env, int objref) {
51 // we don't have an upper limit for our heap space, and we don't
52 // keep track how much is used, so we just return a dummy
54 // we could loop over the areas calling getHeapSize() on
55 // ElementInfos, but since we don't have a max, what would
62 public void gc____V (MJIEnv env, int objref){
67 public int availableProcessors____I (MJIEnv env, int objref){
68 // this is what all these Runtime data acquisition APIs should look like
69 // - since the value is oing to be used by the application, there should
70 // be a way to vary it with a CG
72 Config conf = env.getConfig();
73 int maxProcessors = conf.getInt("cg.max_processors", 1);
75 if (maxProcessors == 1) {
78 return JPF_gov_nasa_jpf_vm_Verify.getInt__II__I(env,-1, 1,maxProcessors);