aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs
diff options
context:
space:
mode:
authorMW2007-04-11 13:32:50 +0000
committerMW2007-04-11 13:32:50 +0000
commit00b7058e000d7871df2ae40075ead1042e8e81ac (patch)
tree2a7e4d5c51b4567b97a7fc06c1c970e6a4ac9d44 /OpenSim.Scripting/EmbeddedJVM/Interpreter.cs
parentsmall improvement to the jvm and test script (diff)
downloadopensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.zip
opensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.tar.gz
opensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.tar.bz2
opensim-SC_OLD-00b7058e000d7871df2ae40075ead1042e8e81ac.tar.xz
Attempt to rearrange some of the directories
Diffstat (limited to 'OpenSim.Scripting/EmbeddedJVM/Interpreter.cs')
-rw-r--r--OpenSim.Scripting/EmbeddedJVM/Interpreter.cs108
1 files changed, 108 insertions, 0 deletions
diff --git a/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs b/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs
new file mode 100644
index 0000000..b94248c
--- /dev/null
+++ b/OpenSim.Scripting/EmbeddedJVM/Interpreter.cs
@@ -0,0 +1,108 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Scripting.EmbeddedJVM.Types;
5using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
6
7namespace OpenSim.Scripting.EmbeddedJVM
8{
9 partial class Thread
10 {
11 private partial class Interpreter
12 {
13 private Thread _mThread;
14
15 public Interpreter(Thread parentThread)
16 {
17 _mThread = parentThread;
18 }
19
20 public bool Excute()
21 {
22 bool run = true;
23 byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this._mThread.PC++];
24 // Console.WriteLine("opCode is: " + currentOpCode);
25 bool handled = false;
26
27 handled = this.IsLogicOpCode(currentOpCode);
28 if (!handled)
29 {
30 handled = this.IsMethodOpCode(currentOpCode);
31 }
32 if (!handled)
33 {
34 if (currentOpCode == 172)
35 {
36 if (this._mThread.stack.StackFrames.Count > 1)
37 {
38 Console.WriteLine("returning int from function");
39 int retPC1 = this._mThread.currentFrame.ReturnPC;
40 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
41 this._mThread.stack.StackFrames.Pop();
42 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
43 this._mThread.PC = retPC1;
44 if (bas1 is Int)
45 {
46 this._mThread.currentFrame.OpStack.Push((Int)bas1);
47 }
48 }
49 else
50 {
51 // Console.WriteLine("No parent function so ending program");
52 this._mThread.stack.StackFrames.Pop();
53 run = false;
54 }
55 handled = true;
56 }
57 if (currentOpCode == 174)
58 {
59 if (this._mThread.stack.StackFrames.Count > 1)
60 {
61 Console.WriteLine("returning float from function");
62 int retPC1 = this._mThread.currentFrame.ReturnPC;
63 BaseType bas1 = this._mThread.currentFrame.OpStack.Pop();
64 this._mThread.stack.StackFrames.Pop();
65 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
66 this._mThread.PC = retPC1;
67 if (bas1 is Float)
68 {
69 this._mThread.currentFrame.OpStack.Push((Float)bas1);
70 }
71 }
72 else
73 {
74 // Console.WriteLine("No parent function so ending program");
75 this._mThread.stack.StackFrames.Pop();
76 run = false;
77 }
78 handled = true;
79 }
80 if (currentOpCode == 177)
81 {
82 if (this._mThread.stack.StackFrames.Count > 1)
83 {
84 Console.WriteLine("returning from function");
85 int retPC = this._mThread.currentFrame.ReturnPC;
86 this._mThread.stack.StackFrames.Pop();
87 this._mThread.currentFrame = this._mThread.stack.StackFrames.Peek();
88 this._mThread.PC = retPC;
89 }
90 else
91 {
92 // Console.WriteLine("No parent function so ending program");
93 this._mThread.stack.StackFrames.Pop();
94 run = false;
95 }
96 handled = true;
97 }
98 }
99 if (!handled)
100 {
101 Console.WriteLine("opcode " + currentOpCode + " not been handled ");
102 }
103 return run;
104
105 }
106 }
107 }
108}