1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.interpreter.operations;
11
12 import java.io.DataInput;
13 import java.io.IOException;
14 import java.lang.reflect.Method;
15 import java.lang.reflect.Modifier;
16
17 import nl.tudelft.simulation.dsol.interpreter.Frame;
18 import nl.tudelft.simulation.dsol.interpreter.Interpreter;
19 import nl.tudelft.simulation.language.concurrent.Monitor;
20
21 /***
22 * The INVOKESPECIAL operation as defined in <a
23 * href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc6.html">
24 * http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc6.html
25 * </a>.
26 * <p>
27 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
28 * University of Technology </a>, the Netherlands. <br>
29 * See for project information <a
30 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
31 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
32 * License (GPL) </a>, no warranty <br>
33 *
34 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
35 * Jacobs </a><a
36 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
37 * Verbraeck </a>
38 * @version 1.3 Apr 6, 2004
39 * @since 1.4
40 */
41 public class INVOKESPECIAL
42 extends
43 nl.tudelft.simulation.dsol.interpreter.operations.reflection.INVOKESPECIAL
44 {
45 /***
46 * constructs a new INVOKESPECIAL
47 *
48 * @param dataInput the dataInput
49 * @throws IOException on IOfailure
50 */
51 public INVOKESPECIAL(final DataInput dataInput) throws IOException
52 {
53 super(dataInput);
54 }
55
56
57 /***
58 * @see nl.tudelft.simulation.dsol.interpreter.operations.reflection.INVOKESPECIAL
59 * #execute(nl.tudelft.simulation.dsol.interpreter.Frame,
60 * java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
61 */
62 public Frame execute(final Frame frame, final Object objectRef,
63 final Method method, final Object[] arguments) throws Exception
64 {
65 if (Modifier.isNative(method.getModifiers()))
66 {
67 return super.execute(frame, objectRef, method, arguments);
68 }
69 if (Modifier.isSynchronized(method.getModifiers()))
70 {
71 Monitor.lock(objectRef);
72 }
73 return Interpreter.createFrame(objectRef, method, arguments);
74 }
75 }