aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs120
1 files changed, 120 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs
new file mode 100644
index 0000000..806f833
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs
@@ -0,0 +1,120 @@
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 public uint EntityId = 0;
54
55 public ScriptInfo scriptInfo;
56
57 public Thread()
58 {
59 this.mInterpreter = new Interpreter(this);
60 this.stack = new Stack();
61 }
62
63 public void SetPC(int methodpointer)
64 {
65 //Console.WriteLine("Thread PC has been set to " + methodpointer);
66 PC = methodpointer;
67 }
68
69 public void StartMethod(ClassRecord rec, string methName)
70 {
71 currentFrame = new StackFrame();
72 this.stack.StackFrames.Push(currentFrame);
73 this.currentClass = rec;
74 currentClass.StartMethod(this, methName);
75 }
76
77 public void StartMethod( string methName)
78 {
79 currentFrame = new StackFrame();
80 this.stack.StackFrames.Push(currentFrame);
81 currentClass.StartMethod(this, methName);
82 }
83
84 public void JumpToStaticVoidMethod(string methName, int returnPC)
85 {
86 currentFrame = new StackFrame();
87 currentFrame.ReturnPC = returnPC;
88 this.stack.StackFrames.Push(currentFrame);
89 currentClass.StartMethod(this, methName);
90 }
91
92 public void JumpToStaticParamMethod(string methName, string param, int returnPC)
93 {
94 if (param == "I")
95 {
96 BaseType bs1 = currentFrame.OpStack.Pop();
97 currentFrame = new StackFrame();
98 currentFrame.ReturnPC = returnPC;
99 this.stack.StackFrames.Push(currentFrame);
100 currentFrame.LocalVariables[0] = ((Int)bs1);
101 currentClass.StartMethod(this, methName);
102 }
103 if (param == "F")
104 {
105
106 }
107 }
108
109 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
110 {
111
112 }
113
114 public bool Excute()
115 {
116 excutionCounter++;
117 return this.mInterpreter.Excute();
118 }
119 }
120}