aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs')
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs270
1 files changed, 135 insertions, 135 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
index c3611d4..698a518 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
@@ -1,135 +1,135 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33 33
34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM 34namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
35{ 35{
36 partial class Thread 36 partial class Thread
37 { 37 {
38 private partial class Interpreter 38 private partial class Interpreter
39 { 39 {
40 private Thread m_thread; 40 private Thread m_thread;
41 41
42 public Interpreter(Thread parentThread) 42 public Interpreter(Thread parentThread)
43 { 43 {
44 m_thread = parentThread; 44 m_thread = parentThread;
45 } 45 }
46 46
47 public bool Excute() 47 public bool Excute()
48 { 48 {
49 bool run = true; 49 bool run = true;
50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; 50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++];
51 // Console.WriteLine("opCode is: " + currentOpCode); 51 // Console.WriteLine("opCode is: " + currentOpCode);
52 bool handled = false; 52 bool handled = false;
53 53
54 handled = this.IsLogicOpCode(currentOpCode); 54 handled = this.IsLogicOpCode(currentOpCode);
55 if (!handled) 55 if (!handled)
56 { 56 {
57 handled = this.IsMethodOpCode(currentOpCode); 57 handled = this.IsMethodOpCode(currentOpCode);
58 } 58 }
59 if (!handled) 59 if (!handled)
60 { 60 {
61 if (currentOpCode == 172) 61 if (currentOpCode == 172)
62 { 62 {
63 if (this.m_thread.stack.StackFrames.Count > 1) 63 if (this.m_thread.stack.StackFrames.Count > 1)
64 { 64 {
65 Console.WriteLine("returning int from function"); 65 Console.WriteLine("returning int from function");
66 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 66 int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
67 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 67 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
68 this.m_thread.stack.StackFrames.Pop(); 68 this.m_thread.stack.StackFrames.Pop();
69 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 69 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
70 this.m_thread.PC = retPC1; 70 this.m_thread.PC = retPC1;
71 if (bas1 is Int) 71 if (bas1 is Int)
72 { 72 {
73 this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); 73 this.m_thread.m_currentFrame.OpStack.Push((Int)bas1);
74 } 74 }
75 } 75 }
76 else 76 else
77 { 77 {
78 // Console.WriteLine("No parent function so ending program"); 78 // Console.WriteLine("No parent function so ending program");
79 this.m_thread.stack.StackFrames.Pop(); 79 this.m_thread.stack.StackFrames.Pop();
80 run = false; 80 run = false;
81 } 81 }
82 handled = true; 82 handled = true;
83 } 83 }
84 if (currentOpCode == 174) 84 if (currentOpCode == 174)
85 { 85 {
86 if (this.m_thread.stack.StackFrames.Count > 1) 86 if (this.m_thread.stack.StackFrames.Count > 1)
87 { 87 {
88 Console.WriteLine("returning float from function"); 88 Console.WriteLine("returning float from function");
89 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 89 int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
90 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 90 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
91 this.m_thread.stack.StackFrames.Pop(); 91 this.m_thread.stack.StackFrames.Pop();
92 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 92 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
93 this.m_thread.PC = retPC1; 93 this.m_thread.PC = retPC1;
94 if (bas1 is Float) 94 if (bas1 is Float)
95 { 95 {
96 this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); 96 this.m_thread.m_currentFrame.OpStack.Push((Float)bas1);
97 } 97 }
98 } 98 }
99 else 99 else
100 { 100 {
101 // Console.WriteLine("No parent function so ending program"); 101 // Console.WriteLine("No parent function so ending program");
102 this.m_thread.stack.StackFrames.Pop(); 102 this.m_thread.stack.StackFrames.Pop();
103 run = false; 103 run = false;
104 } 104 }
105 handled = true; 105 handled = true;
106 } 106 }
107 if (currentOpCode == 177) 107 if (currentOpCode == 177)
108 { 108 {
109 if (this.m_thread.stack.StackFrames.Count > 1) 109 if (this.m_thread.stack.StackFrames.Count > 1)
110 { 110 {
111 Console.WriteLine("returning from function"); 111 Console.WriteLine("returning from function");
112 int retPC = this.m_thread.m_currentFrame.ReturnPC; 112 int retPC = this.m_thread.m_currentFrame.ReturnPC;
113 this.m_thread.stack.StackFrames.Pop(); 113 this.m_thread.stack.StackFrames.Pop();
114 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 114 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
115 this.m_thread.PC = retPC; 115 this.m_thread.PC = retPC;
116 } 116 }
117 else 117 else
118 { 118 {
119 // Console.WriteLine("No parent function so ending program"); 119 // Console.WriteLine("No parent function so ending program");
120 this.m_thread.stack.StackFrames.Pop(); 120 this.m_thread.stack.StackFrames.Pop();
121 run = false; 121 run = false;
122 } 122 }
123 handled = true; 123 handled = true;
124 } 124 }
125 } 125 }
126 if (!handled) 126 if (!handled)
127 { 127 {
128 Console.WriteLine("opcode " + currentOpCode + " not been handled "); 128 Console.WriteLine("opcode " + currentOpCode + " not been handled ");
129 } 129 }
130 return run; 130 return run;
131 131
132 } 132 }
133 } 133 }
134 } 134 }
135} 135}