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.cs63
1 files changed, 30 insertions, 33 deletions
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
index 698a518..4e7351e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
@@ -26,8 +26,6 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; 29using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
32using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; 30using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
33 31
@@ -47,77 +45,77 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
47 public bool Excute() 45 public bool Excute()
48 { 46 {
49 bool run = true; 47 bool run = true;
50 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; 48 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[m_thread.PC++];
51 // Console.WriteLine("opCode is: " + currentOpCode); 49 // Console.WriteLine("opCode is: " + currentOpCode);
52 bool handled = false; 50 bool handled = false;
53 51
54 handled = this.IsLogicOpCode(currentOpCode); 52 handled = IsLogicOpCode(currentOpCode);
55 if (!handled) 53 if (!handled)
56 { 54 {
57 handled = this.IsMethodOpCode(currentOpCode); 55 handled = IsMethodOpCode(currentOpCode);
58 } 56 }
59 if (!handled) 57 if (!handled)
60 { 58 {
61 if (currentOpCode == 172) 59 if (currentOpCode == 172)
62 { 60 {
63 if (this.m_thread.stack.StackFrames.Count > 1) 61 if (m_thread.stack.StackFrames.Count > 1)
64 { 62 {
65 Console.WriteLine("returning int from function"); 63 Console.WriteLine("returning int from function");
66 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 64 int retPC1 = m_thread.m_currentFrame.ReturnPC;
67 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 65 BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop();
68 this.m_thread.stack.StackFrames.Pop(); 66 m_thread.stack.StackFrames.Pop();
69 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 67 m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek();
70 this.m_thread.PC = retPC1; 68 m_thread.PC = retPC1;
71 if (bas1 is Int) 69 if (bas1 is Int)
72 { 70 {
73 this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); 71 m_thread.m_currentFrame.OpStack.Push((Int) bas1);
74 } 72 }
75 } 73 }
76 else 74 else
77 { 75 {
78 // Console.WriteLine("No parent function so ending program"); 76 // Console.WriteLine("No parent function so ending program");
79 this.m_thread.stack.StackFrames.Pop(); 77 m_thread.stack.StackFrames.Pop();
80 run = false; 78 run = false;
81 } 79 }
82 handled = true; 80 handled = true;
83 } 81 }
84 if (currentOpCode == 174) 82 if (currentOpCode == 174)
85 { 83 {
86 if (this.m_thread.stack.StackFrames.Count > 1) 84 if (m_thread.stack.StackFrames.Count > 1)
87 { 85 {
88 Console.WriteLine("returning float from function"); 86 Console.WriteLine("returning float from function");
89 int retPC1 = this.m_thread.m_currentFrame.ReturnPC; 87 int retPC1 = m_thread.m_currentFrame.ReturnPC;
90 BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); 88 BaseType bas1 = m_thread.m_currentFrame.OpStack.Pop();
91 this.m_thread.stack.StackFrames.Pop(); 89 m_thread.stack.StackFrames.Pop();
92 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 90 m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek();
93 this.m_thread.PC = retPC1; 91 m_thread.PC = retPC1;
94 if (bas1 is Float) 92 if (bas1 is Float)
95 { 93 {
96 this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); 94 m_thread.m_currentFrame.OpStack.Push((Float) bas1);
97 } 95 }
98 } 96 }
99 else 97 else
100 { 98 {
101 // Console.WriteLine("No parent function so ending program"); 99 // Console.WriteLine("No parent function so ending program");
102 this.m_thread.stack.StackFrames.Pop(); 100 m_thread.stack.StackFrames.Pop();
103 run = false; 101 run = false;
104 } 102 }
105 handled = true; 103 handled = true;
106 } 104 }
107 if (currentOpCode == 177) 105 if (currentOpCode == 177)
108 { 106 {
109 if (this.m_thread.stack.StackFrames.Count > 1) 107 if (m_thread.stack.StackFrames.Count > 1)
110 { 108 {
111 Console.WriteLine("returning from function"); 109 Console.WriteLine("returning from function");
112 int retPC = this.m_thread.m_currentFrame.ReturnPC; 110 int retPC = m_thread.m_currentFrame.ReturnPC;
113 this.m_thread.stack.StackFrames.Pop(); 111 m_thread.stack.StackFrames.Pop();
114 this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); 112 m_thread.m_currentFrame = m_thread.stack.StackFrames.Peek();
115 this.m_thread.PC = retPC; 113 m_thread.PC = retPC;
116 } 114 }
117 else 115 else
118 { 116 {
119 // Console.WriteLine("No parent function so ending program"); 117 // Console.WriteLine("No parent function so ending program");
120 this.m_thread.stack.StackFrames.Pop(); 118 m_thread.stack.StackFrames.Pop();
121 run = false; 119 run = false;
122 } 120 }
123 handled = true; 121 handled = true;
@@ -128,8 +126,7 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
128 Console.WriteLine("opcode " + currentOpCode + " not been handled "); 126 Console.WriteLine("opcode " + currentOpCode + " not been handled ");
129 } 127 }
130 return run; 128 return run;
131
132 } 129 }
133 } 130 }
134 } 131 }
135} 132} \ No newline at end of file