aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs
diff options
context:
space:
mode:
authorMW2007-05-26 13:40:19 +0000
committerMW2007-05-26 13:40:19 +0000
commit3436961bb5c01d659d09be134368f4f69460cef9 (patch)
tree3753ba4d7818df2a6bce0bbe863ff033cdfd568a /OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs
downloadopensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.zip
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.gz
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.bz2
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.xz
Start of rewrite 5279!
Diffstat (limited to 'OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs')
-rw-r--r--OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs88
1 files changed, 88 insertions, 0 deletions
diff --git a/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs
new file mode 100644
index 0000000..436949c
--- /dev/null
+++ b/OpenSim/OpenSim.Scripting/EmbeddedJVM/Thread.cs
@@ -0,0 +1,88 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Scripting.EmbeddedJVM.Types;
5using OpenSim.Scripting.EmbeddedJVM.Types.PrimitiveTypes;
6using OpenSim.Framework;
7using OpenSim.Framework.Interfaces;
8
9namespace OpenSim.Scripting.EmbeddedJVM
10{
11 public partial class Thread
12 {
13 public static MainMemory GlobalMemory;
14 public static IScriptAPI OpenSimScriptAPI;
15 private int PC = 0;
16 private Stack stack;
17 private Interpreter mInterpreter;
18 public ClassRecord currentClass;
19 public ClassInstance currentInstance;
20 private StackFrame currentFrame;
21 public int excutionCounter = 0;
22 public bool running = false;
23 public uint EntityId = 0;
24
25 public Thread()
26 {
27 this.mInterpreter = new Interpreter(this);
28 this.stack = new Stack();
29 }
30
31 public void SetPC(int methodpointer)
32 {
33 //Console.WriteLine("Thread PC has been set to " + methodpointer);
34 PC = methodpointer;
35 }
36
37 public void StartMethod(ClassRecord rec, string methName)
38 {
39 currentFrame = new StackFrame();
40 this.stack.StackFrames.Push(currentFrame);
41 this.currentClass = rec;
42 currentClass.StartMethod(this, methName);
43 }
44
45 public void StartMethod( string methName)
46 {
47 currentFrame = new StackFrame();
48 this.stack.StackFrames.Push(currentFrame);
49 currentClass.StartMethod(this, methName);
50 }
51
52 public void JumpToStaticVoidMethod(string methName, int returnPC)
53 {
54 currentFrame = new StackFrame();
55 currentFrame.ReturnPC = returnPC;
56 this.stack.StackFrames.Push(currentFrame);
57 currentClass.StartMethod(this, methName);
58 }
59
60 public void JumpToStaticParamMethod(string methName, string param, int returnPC)
61 {
62 if (param == "I")
63 {
64 BaseType bs1 = currentFrame.OpStack.Pop();
65 currentFrame = new StackFrame();
66 currentFrame.ReturnPC = returnPC;
67 this.stack.StackFrames.Push(currentFrame);
68 currentFrame.LocalVariables[0] = ((Int)bs1);
69 currentClass.StartMethod(this, methName);
70 }
71 if (param == "F")
72 {
73
74 }
75 }
76
77 public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
78 {
79
80 }
81
82 public bool Excute()
83 {
84 excutionCounter++;
85 return this.mInterpreter.Excute();
86 }
87 }
88}