Mercurial > pub > Jint1
changeset 1:033ebe7432d5
vm v2
author | cin |
---|---|
date | Thu, 24 Oct 2013 19:45:57 +0400 |
parents | e113095f1de0 |
children | 4aed85a1f558 |
files | Jint.Runtime/Jint.Runtime.csproj Jint.Runtime/VM/OpCodes/Codes.cs Jint.Runtime/VM/OpCodes/IBinaryOperation2.cs Jint.Runtime/VM/OpCodes/Instruction.cs Jint.Runtime/VM2/Box.cs Jint.Runtime/VM2/Frame.cs Jint.Runtime/VM2/Instruction.cs Jint.Runtime/VM2/IntegerBinder.cs Jint.Runtime/VM2/Machine.cs Jint.Runtime/VM2/OpCodes/Add.cs Jint.Runtime/VM2/OpCodes/Codes.cs Jint.Runtime/VM2/OpCodes/Operation.cs Jint.userprefs |
diffstat | 13 files changed, 171 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/Jint.Runtime/Jint.Runtime.csproj Wed Oct 23 13:24:57 2013 +0400 +++ b/Jint.Runtime/Jint.Runtime.csproj Thu Oct 24 19:45:57 2013 +0400 @@ -49,6 +49,14 @@ <Compile Include="VM\OpCodes\IBinaryOperation.cs" /> <Compile Include="VM\OpCodes\BinaryOperation.cs" /> <Compile Include="VM\IReference.cs" /> + <Compile Include="VM\OpCodes\Codes.cs" /> + <Compile Include="VM2\Instruction.cs" /> + <Compile Include="VM2\OpCodes\Codes.cs" /> + <Compile Include="VM2\Box.cs" /> + <Compile Include="VM2\OpCodes\Operation.cs" /> + <Compile Include="VM2\IntegerBinder.cs" /> + <Compile Include="VM2\Frame.cs" /> + <Compile Include="VM2\Machine.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> @@ -61,5 +69,7 @@ <ItemGroup> <Folder Include="VM\" /> <Folder Include="VM\OpCodes\" /> + <Folder Include="VM2\" /> + <Folder Include="VM2\OpCodes\" /> </ItemGroup> </Project> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM/OpCodes/Codes.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,10 @@ +using System; + +namespace Jint.Runtime +{ + public enum Codes: int + { + Add = 1 + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM/OpCodes/IBinaryOperation2.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,9 @@ +using System; + +namespace Jint.Runtime.VM.OpCodes +{ + public interface IBinaryOperation2 + { + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM/OpCodes/Instruction.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,11 @@ +using System; + +namespace Jint.Runtime +{ + public struct Instruction + { + public Codes code; + public int[] operands; + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/Box.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,19 @@ +using System; + +namespace Jint.Runtime.VM2 +{ + using OpCodes; + + public class Box + { + public Operation[] impl; + public object value; + + public Type HoldingType { + get { + return value == null ? null : value.GetType (); + } + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/Frame.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,17 @@ +using System; + +namespace Jint.Runtime.VM2 +{ + public class Frame + { + Box m_values; + public Frame (int size) + { + } + + public Box Get() { + } + + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/Instruction.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,12 @@ +using System; + +namespace Jint.Runtime.VM2 +{ + public struct Instruction + { + public Codes code; + public int dest; + public int[] args; + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/IntegerBinder.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,12 @@ +using System; + +namespace Jint.Runtime +{ + public class IntegerBinder + { + public int OpAdd(int arg1, int arg2) { + return arg1 + arg2; + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/Machine.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; + +namespace Jint.Runtime.VM2 +{ + public class Machine + { + RuntimeContext m_context; + Stack<object[]> m_frames; + object[] m_frame; + + + public Machine () + { + } + + public void Execute(Instruction[] instructions) { + foreach (var op in instructions) { + + } + } + + private object[] MakeArgs(int[] regs) { + object[] args = new object[regs.Length]; + for (int i=0; i< regs.Length; i++) + args = m_frame [regs [i]]; + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/OpCodes/Add.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,12 @@ +using System; + +namespace Jint.Runtime +{ + public class Add + { + public Add () + { + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/OpCodes/Codes.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,11 @@ +using System; + +namespace Jint.Runtime +{ + public enum Codes: int + { + Add = 1, + MaxCode + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Jint.Runtime/VM2/OpCodes/Operation.cs Thu Oct 24 19:45:57 2013 +0400 @@ -0,0 +1,5 @@ +using System; + +namespace Jint.Runtime.VM2.OpCodes { + public delegate object Operation(object[] args); +}
--- a/Jint.userprefs Wed Oct 23 13:24:57 2013 +0400 +++ b/Jint.userprefs Thu Oct 24 19:45:57 2013 +0400 @@ -1,25 +1,15 @@ <Properties> <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|x86" /> - <MonoDevelop.Ide.Workbench ActiveDocument="Jint.Runtime/VM/IntegerBinder.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="Jint.Runtime/VM2/Machine.cs"> <Files> - <File FileName="Jint.Runtime/VM/Frame.cs" Line="35" Column="8" /> - <File FileName="Jint.Runtime/VM/BoxBase.cs" Line="5" Column="30" /> - <File FileName="Jint.Runtime/VM/Box.cs" Line="24" Column="19" /> - <File FileName="Jint.Runtime/VM/IConverter.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/VM/OpCodes/Add.cs" Line="25" Column="24" /> - <File FileName="Jint.Runtime/VM/OpCodes/IOpCode.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/VM/ISetter.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/VM/IGetter.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/Main.cs" Line="25" Column="4" /> - <File FileName="Jint.Experimental/Program.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/VM/IBinder.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/VM/IntegerBinder.cs" Line="28" Column="4" /> - <File FileName="Jint.Runtime/VM/OpCodes/BinaryOp.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/AssemblyInfo.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/VM/RuntimeContext.cs" Line="1" Column="1" /> - <File FileName="Jint.Runtime/VM/OpCodes/IBinaryOperation.cs" Line="5" Column="35" /> - <File FileName="Jint.Runtime/VM/OpCodes/IOperation.cs" Line="3" Column="26" /> - <File FileName="Jint.Runtime/VM/OpCodes/BinaryOperation.cs" Line="36" Column="12" /> + <File FileName="Jint.Runtime/VM/OpCodes/IBinaryOperation2.cs" Line="3" Column="34" /> + <File FileName="Jint.Runtime/VM2/OpCodes/Codes.cs" Line="12" Column="1" /> + <File FileName="Jint.Runtime/VM2/Box.cs" Line="14" Column="34" /> + <File FileName="Jint.Runtime/VM2/IntegerBinder.cs" Line="10" Column="3" /> + <File FileName="Jint.Runtime/VM2/Instruction.cs" Line="8" Column="19" /> + <File FileName="Jint.Runtime/VM2/OpCodes/Operation.cs" Line="4" Column="50" /> + <File FileName="Jint.Runtime/VM2/Frame.cs" Line="9" Column="4" /> + <File FileName="Jint.Runtime/VM2/Machine.cs" Line="11" Column="3" /> </Files> <Pads> <Pad Id="ProjectPad"> @@ -28,7 +18,10 @@ <Node name="Jint.Runtime" expanded="True"> <Node name="VM" expanded="True"> <Node name="OpCodes" expanded="True" /> - <Node name="IntegerBinder.cs" selected="True" /> + </Node> + <Node name="VM2" expanded="True"> + <Node name="OpCodes" expanded="True" /> + <Node name="Machine.cs" selected="True" /> </Node> </Node> </State>