aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs119
1 files changed, 119 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
new file mode 100644
index 0000000..3993436
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JVM/Thread.cs
@@ -0,0 +1,119 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenSim.Scripting.EmbeddedJVM.Types;
32using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
33using OpenSim.Framework;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Region.Environment.Scenes;
36using OpenSim.Region.Environment.Scripting;
37
38namespace OpenSim.Scripting.EmbeddedJVM
39{
40 public partial class Thread
41 {
42 // Is this smart?
43 public static MainMemory GlobalMemory;
44 public static Scene World;
45 private int PC = 0;
46 private Stack stack;
47 private Interpreter mInterpreter;
48 public ClassRecord currentClass;
49 public ClassInstance currentInstance;
50 private StackFrame currentFrame;
51 public int excutionCounter = 0;
52 public bool running = false;
53
54 public ScriptInfo scriptInfo;
55
56 public Thread()
57 {
58 this.mInterpreter = new Interpreter(this);
59 this.stack = new Stack();
60 }
61
62 public void SetPC(int methodpointer)
63 {
64 //Console.WriteLine("Thread PC has been set to " + methodpointer);
65 PC = methodpointer;
66 }
67
68 public void StartMethod(ClassRecord rec, string methName)
69 {
70 currentFrame = new StackFrame();
71 this.stack.StackFrames.Push(currentFrame);
72 this.currentClass = rec;
73 currentClass.StartMethod(this, methName);
74 }
75
76 public void StartMethod( string methName)
77 {
78 currentFrame = new StackFrame();
79 this.stack.StackFrames.Push(currentFrame);
80 currentClass.StartMethod(this, methName);
81 }
82
83 public void JumpToStaticVoidMethod(string methName, int returnPC)
84 {
85 currentFrame = new StackFrame();
86 currentFrame.ReturnPC = returnPC;
87 this.stack.StackFrames.Push(currentFrame);
88 currentClass.StartMethod(this, methName);
89 }
90
91 public void JumpToStaticParamMethod(string methName, string param, int returnPC)
92 {
93 if (param == "I")
94 {
95 BaseType bs1 = currentFrame.OpStack.Pop();
96 currentFrame = new StackFrame();
97 currentFrame.ReturnPC = returnPC;
98 this.stack.StackFrames.Push(currentFrame);
99 currentFrame.LocalVariables[0] = ((Int)bs1);
100 currentClass.StartMethod(this, methName);
101 }
102 if (param == "F")
103 {
104
105 }
106 }
107
108 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
109 {
110
111 }
112
113 public bool Excute()
114 {
115 excutionCounter++;
116 return this.mInterpreter.Excute();
117 }
118 }
119}