01: //
02: //This file is part of the prose package.
03: //
04: //The contents of this file are subject to the Mozilla Public License
05: //Version 1.1 (the "License"); you may not use this file except in
06: //compliance with the License. You may obtain a copy of the License at
07: //http://www.mozilla.org/MPL/
08: //
09: //Software distributed under the License is distributed on an "AS IS" basis,
10: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11: //for the specific language governing rights and limitations under the
12: //License.
13: //
14: //The Original Code is prose.
15: //
16: // Contributor(s):
17: // $Id$
18: // =====================================================================
19: //
20: //(history at end)
21: //
22:
23: package ch.ethz.inf.iks.jvmai.jvmdi;
24:
25: import ch.ethz.jvmai.MethodEntryJoinPoint;
26: import java.lang.reflect.Modifier;
27:
28: /**
29: * Concrete implementation of a MethodEntryJoinPoint for the Jikes RVM.
30: *
31: * @author Angela Nicoara
32: * @author Gerald Linhofer
33: * @version $Revision$
34: */
35: public class HotSwapMethodEntryJoinPointImpl extends
36: HotSwapMethodJoinPointImpl implements MethodEntryJoinPoint {
37:
38: HotSwapMethodEntryJoinPointImpl() {
39: super ();
40: }
41:
42: HotSwapMethodEntryJoinPointImpl(int methodId, Object aopTag) {
43: super (methodId, aopTag);
44: }
45:
46: public String getKind() {
47: return KIND_METHOD_ENTRY_JP;
48: }
49:
50: public int getMask() {
51: return MASK_CODE_JP | MASK_METHOD_ENTRY_JP;
52: }
53:
54: /**
55: * Modifies an argument of the target method.
56: *
57: * @param pos position of the parameter (not the slot!)
58: * @param value new value of the argument
59: *
60: * @throws ch.ethz.jvmai.InvalidIdException can not find
61: * the stack frame of the caller in current thread.
62: */
63: public void setArg(int pos, Object value) {
64: if (!argTypesInitialized)
65: initArgTypes();
66: if (argTypeCodes.length < pos)
67: throw new RuntimeException("Invalide argument position");
68: //System.out.println("setArg(" + pos + "," + value + ")");
69: // calculate slot
70: int slot = pos;
71: for (int i = 0; i < pos; i++)
72: slot += (ARG_TYPE_LONG > argTypeCodes[i]) ? 0 : 1;
73: slot += Modifier.isStatic(getMethod().getModifiers()) ? 0 : 1;
74: // set argument
75: doSetLocalVar(slot, argTypeCodes[pos], value, Thread
76: .currentThread(), height);
77: args[pos] = value;
78: //System.out.println("setArg() terminated");
79: }
80:
81: }
82:
83: //======================================================================
84: //
85: //$Log$
86: //
|