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.SystemAttribute;
23 * DirectCallStackFrames are only used for overlay calls (from native code), i.e.
24 * there is no corresponding INVOKE instruction. The associated MethodInfos are
25 * synthetic, their only code is (usually) a INVOKEx and a DIRECTCALLRETURN.
26 * NOTE: such MethodInfos do not belong to any class
28 * Arguments for the invoke insn have to be pushed explicitly by the caller
30 * direct calls do not return any values themselves, but they do get the return values of the
31 * called method pushed onto their own operand stack. If the DirectCallStackFrame user
32 * needs such return values, it has to do so via ThreadInfo.getReturnedDirectCall()
35 public abstract class DirectCallStackFrame extends StackFrame implements SystemAttribute {
39 protected DirectCallStackFrame (MethodInfo miDirectCall, MethodInfo callee, int maxLocals, int maxStack){
40 super( miDirectCall, maxLocals, maxStack);
44 protected DirectCallStackFrame (MethodInfo miDirectCall, MethodInfo callee){
45 super( miDirectCall, miDirectCall.getMaxLocals(), miDirectCall.getMaxStack());
49 public MethodInfo getCallee (){
54 public String getStackTraceInfo () {
55 StringBuilder sb = new StringBuilder(128);
57 sb.append( callee.getUniqueName());
62 public DirectCallStackFrame getPreviousDirectCallStackFrame(){
64 while (f != null && !(f instanceof DirectCallStackFrame)){
68 return (DirectCallStackFrame) f;
71 public void setFireWall(){
76 public boolean isDirectCallFrame () {
81 public boolean isSynthetic() {
86 * those set the callee arguments for the invoke insn - the returned value is the slot index OFFSET (not the slot index
87 * itself) for the next argument. This has to be used in a pattern like
88 * int argOffset = frame.setArgument( 0, firstArg, a0);
89 * argOffset = frame.setLongArgument( argOffset, secondArg, a1);
93 public abstract int setArgument (int argOffset, int value, Object attr);
94 public abstract int setLongArgument (int argOffset, long value, Object attr);
95 public abstract int setReferenceArgument (int argOffset, int ref, Object attr);
97 public int setFloatArgument (int argOffset, float value, Object attr){
98 return setArgument( argOffset, Float.floatToIntBits(value), attr);
100 public int setDoubleArgument (int argOffset, double value, Object attr){
101 return setLongArgument( argOffset, Double.doubleToLongBits(value), attr);