BadScript 2
Loading...
Searching...
No Matches
BadScript2.Runtime.VirtualMachine Namespace Reference

Contains the Virtual Machine Implementation. More...

Namespaces

namespace  Compiler
 Contains the Compiler for the BadVirtualMachine.
 

Classes

class  BadCompiledFunction
 Implements a Compiled Function. More...
 
struct  BadInstruction
 Implements a single instruction for the BadVirtualMachine. More...
 
class  BadRuntimeVirtualMachine
 Implements a Virtual Machine for the BadScript Language. More...
 
class  BadRuntimeVirtualStackFrame
 Stores the current execution state of the Virtual Machine. More...
 

Enumerations

enum  BadOpCode {
  Nop = 0 , DefVar = 0x0001 , DefVarTyped = 0x0002 , LoadVar = 0x0003 ,
  LoadMember = 0x0004 , LoadMemberNullChecked = 0x0005 , Assign = 0x0006 , Push = 0x0007 ,
  FormatString = 0x0008 , ClearStack = 0x0009 , LoadArrayAccess = 0x000A , LoadArrayAccessNullChecked = 0x000B ,
  LoadArrayAccessReverse = 0x000C , LoadArrayAccessReverseNullChecked = 0x000D , Dup = 0x000E , ArrayInit = 0x000F ,
  TableInit = 0x0010 , HasProperty = 0x0011 , Swap = 0x0012 , Pop = 0x0013 ,
  TypeOf = 0x0014 , Delete = 0x0015 , InstanceOf = 0x0016 , Export = 0x0017 ,
  Import = 0x0018 , Equals = 0x1000 , NotEquals = 0x1001 , Greater = 0x1002 ,
  GreaterEquals = 0x1003 , Less = 0x1004 , LessEquals = 0x1005 , And = 0x2000 ,
  Not = 0x2002 , XOr = 0x2003 , AndAssign = 0x2004 , XOrAssign = 0x2006 ,
  Add = 0x3000 , Sub = 0x3001 , Mul = 0x3002 , Div = 0x3003 ,
  Mod = 0x3004 , AddAssign = 0x3005 , SubAssign = 0x3006 , MulAssign = 0x3007 ,
  DivAssign = 0x3008 , ModAssign = 0x3009 , PostInc = 0x3010 , PostDec = 0x3011 ,
  PreInc = 0x3012 , PreDec = 0x3013 , Exp = 0x3014 , Neg = 0x3015 ,
  ExpAssign = 0x3016 , JumpRelative = 0x4000 , JumpRelativeIfFalse = 0x4001 , JumpRelativeIfTrue = 0x4002 ,
  JumpRelativeIfNotNull = 0x4003 , JumpRelativeIfNull = 0x4004 , Invoke = 0x4005 , New = 0x4006 ,
  Range = 0x4007 , CreateScope = 0x5000 , DestroyScope = 0x5001 , AddDisposeFinalizer = 0x5002 ,
  Return = 0x6000 , Break = 0x6001 , Continue = 0x6002 , Throw = 0x6003 ,
  SetBreakPointer = 0x6004 , SetContinuePointer = 0x6005 , SetThrowPointer = 0x6006 , AquireLock = 0x7000 ,
  ReleaseLock = 0x7001 , Eval = 0x8000 , BinaryUnpack = 0x9000 , UnaryUnpack = 0x9001
}
 Defines the Operations that the BadVirtualMachine can execute. More...
 

Detailed Description

Contains the Virtual Machine Implementation.

Enumeration Type Documentation

◆ BadOpCode

Defines the Operations that the BadVirtualMachine can execute.

Enumerator
Nop 

No Operation.

DefVar 

Define a Variable.

DefVarTyped 

Define a Typed Variable.

LoadVar 

Load a Variable.

LoadMember 

Load a Member of an Object.

LoadMemberNullChecked 

Load a Member of an Object and check if it is null.

Assign 

Assign to a Reference.

Push 

Push a Value onto the Stack.

FormatString 

Format a String.

ClearStack 

Clear the Stack.

LoadArrayAccess 

Load an Array Access.

LoadArrayAccessNullChecked 

Load an Array Access and check if it is null.

LoadArrayAccessReverse 

Load an Array Access in reverse order.

LoadArrayAccessReverseNullChecked 

Load an Array Access in reverse order and check if it is null.

Dup 

Duplicate the top of the Stack.

ArrayInit 

Initialize an Array.

TableInit 

Initialize a Table.

HasProperty 

Check if an Object has a Property.

Swap 

Swap the top two Stack Values.

Pop 

Pop the top of the Stack.

TypeOf 

Get the Type of an Object.

Delete 

Delete a Property.

InstanceOf 

Get the Type of an Object and check if it is an Instance of another Type.

Export 

Exports a named or default expression.

Import 

Imports a module from a specified path.

Equals 

Compare two Objects.

NotEquals 

Compare two Objects for Inequality.

Greater 

Compare two Objects for Greater Than.

GreaterEquals 

Compare two Objects for Greater Than or Equal.

Less 

Compare two Objects for Less Than.

LessEquals 

Compare two Objects for Less Than or Equal.

And 

Logical And two Booleans.

Not 

Logical Not a Boolean.

XOr 

Logical XOr two Booleans.

AndAssign 

Logical And two Booleans and assign the result to the first.

XOrAssign 

Logical XOr two Booleans and assign the result to the first.

Add 

Add two Objects.

Sub 

Subtract two Objects.

Mul 

Multiply two Objects.

Div 

Divide two Objects.

Mod 

Modulo two Objects.

AddAssign 

Assign the result of an Addition to the first Object.

SubAssign 

Assign the result of a Subtraction to the first Object.

MulAssign 

Assign the result of a Multiplication to the first Object.

DivAssign 

Assign the result of a Division to the first Object.

ModAssign 

Assign the result of a Modulo to the first Object.

PostInc 

Postfix Increment.

PostDec 

Postfix Decrement.

PreInc 

Prefix Increment.

PreDec 

Prefix Decrement.

Exp 

Exponentiate two Objects.

Neg 

Negate an Object.

ExpAssign 

Assign the result of an Exponentiation to the first Object.

JumpRelative 

Jump to a specific Instruction addressed by a relative offset.

JumpRelativeIfFalse 

Jump to a specific Instruction addressed by a relative offset if the top of the Stack is false.

JumpRelativeIfTrue 

Jump to a specific Instruction addressed by a relative offset if the top of the Stack is true.

JumpRelativeIfNotNull 

Jump to a specific Instruction addressed by a relative offset if the top of the Stack is not null.

JumpRelativeIfNull 

Jump to a specific Instruction addressed by a relative offset if the top of the Stack is null.

Invoke 

Invoke a Function.

New 

Create a new Object.

Range 

Create a new Range Enumerable.

CreateScope 

Create a new Scope.

DestroyScope 

Destroy the current scope.

AddDisposeFinalizer 

Registers a Finalizer for the current scope.

Return 

Return from a Function.

Break 

Break from a Loop.

Continue 

Continue a Loop.

Throw 

Throw an Exception.

SetBreakPointer 

Set the Break instruction pointer.

SetContinuePointer 

Set the Continue instruction pointer.

SetThrowPointer 

Set the Throw instruction pointer.

AquireLock 

Aquire a Lock.

ReleaseLock 

Release a Lock.

Eval 

Evaluate an Expression.(used if there is no Expression Compiler for the Expression)

BinaryUnpack 

Unpack the right side of a Binary Operation into the left side.

UnaryUnpack 

Unpack the right side of a Unary Operation into the current scope.

Definition at line 6 of file BadOpCode.cs.

7{
11 Nop = 0,
12
16 DefVar = 0x0001,
17
21 DefVarTyped = 0x0002,
22
26 LoadVar = 0x0003,
27
31 LoadMember = 0x0004,
32
36 LoadMemberNullChecked = 0x0005,
37
41 Assign = 0x0006,
42
46 Push = 0x0007,
47
51 FormatString = 0x0008,
52
56 ClearStack = 0x0009,
57
61 LoadArrayAccess = 0x000A,
62
67
72
77
81 Dup = 0x000E,
82
86 ArrayInit = 0x000F,
87
91 TableInit = 0x0010,
92
96 HasProperty = 0x0011,
97
101 Swap = 0x0012,
102
106 Pop = 0x0013,
107
111 TypeOf = 0x0014,
112
116 Delete = 0x0015,
117
121 InstanceOf = 0x0016,
122
126 Export = 0x0017,
127
131 Import = 0x0018,
132
136 Equals = 0x1000,
137
141 NotEquals = 0x1001,
142
146 Greater = 0x1002,
147
151 GreaterEquals = 0x1003,
152
156 Less = 0x1004,
157
161 LessEquals = 0x1005,
162
166 And = 0x2000,
167
168 //Or = 0x2001, //Short circuiting with JumpRelativeIfTrue
172 Not = 0x2002,
173
177 XOr = 0x2003,
178
182 AndAssign = 0x2004,
183
184 //OrAssign = 0x2005, //Short circuiting with JumpRelativeIfTrue
188 XOrAssign = 0x2006,
189
193 Add = 0x3000,
194
198 Sub = 0x3001,
199
203 Mul = 0x3002,
204
208 Div = 0x3003,
209
213 Mod = 0x3004,
214
218 AddAssign = 0x3005,
219
223 SubAssign = 0x3006,
224
228 MulAssign = 0x3007,
229
233 DivAssign = 0x3008,
234
238 ModAssign = 0x3009,
239
243 PostInc = 0x3010,
244
248 PostDec = 0x3011,
249
253 PreInc = 0x3012,
254
258 PreDec = 0x3013,
259
263 Exp = 0x3014,
264
268 Neg = 0x3015,
269
273 ExpAssign = 0x3016,
274
278 JumpRelative = 0x4000,
279
283 JumpRelativeIfFalse = 0x4001,
284
288 JumpRelativeIfTrue = 0x4002,
289
293 JumpRelativeIfNotNull = 0x4003,
294
298 JumpRelativeIfNull = 0x4004,
299
303 Invoke = 0x4005,
304
308 New = 0x4006,
309
313 Range = 0x4007,
314
318 CreateScope = 0x5000,
319
323 DestroyScope = 0x5001,
324
328 AddDisposeFinalizer = 0x5002,
329
333 Return = 0x6000,
334
338 Break = 0x6001,
339
343 Continue = 0x6002,
344
348 Throw = 0x6003,
349
353 SetBreakPointer = 0x6004,
354
358 SetContinuePointer = 0x6005,
359
363 SetThrowPointer = 0x6006,
364
368 AquireLock = 0x7000,
369
373 ReleaseLock = 0x7001,
374
378 Eval = 0x8000,
379
383 BinaryUnpack = 0x9000,
384
388 UnaryUnpack = 0x9001,
389}
@ Export
Exports a named or default expression.
@ LoadArrayAccessReverseNullChecked
Load an Array Access in reverse order and check if it is null.
@ Dup
Duplicate the top of the Stack.
@ Less
Compare two Objects for Less Than.
@ XOrAssign
Logical XOr two Booleans and assign the result to the first.
@ SubAssign
Assign the result of a Subtraction to the first Object.
@ SetBreakPointer
Set the Break instruction pointer.
@ ModAssign
Assign the result of a Modulo to the first Object.
@ NotEquals
Compare two Objects for Inequality.
@ Eval
Evaluate an Expression.(used if there is no Expression Compiler for the Expression)
@ InstanceOf
Get the Type of an Object and check if it is an Instance of another Type.
@ LoadArrayAccessNullChecked
Load an Array Access and check if it is null.
@ LoadArrayAccessReverse
Load an Array Access in reverse order.
@ SetThrowPointer
Set the Throw instruction pointer.
@ DefVarTyped
Define a Typed Variable.
@ DestroyScope
Destroy the current scope.
@ LoadMemberNullChecked
Load a Member of an Object and check if it is null.
@ UnaryUnpack
Unpack the right side of a Unary Operation into the current scope.
@ Import
Imports a module from a specified path.
@ GreaterEquals
Compare two Objects for Greater Than or Equal.
@ JumpRelativeIfFalse
Jump to a specific Instruction addressed by a relative offset if the top of the Stack is false.
@ JumpRelativeIfNotNull
Jump to a specific Instruction addressed by a relative offset if the top of the Stack is not null.
@ Greater
Compare two Objects for Greater Than.
@ Swap
Swap the top two Stack Values.
@ Range
Create a new Range Enumerable.
@ HasProperty
Check if an Object has a Property.
@ AndAssign
Logical And two Booleans and assign the result to the first.
@ ExpAssign
Assign the result of an Exponentiation to the first Object.
@ TypeOf
Get the Type of an Object.
@ Push
Push a Value onto the Stack.
@ JumpRelative
Jump to a specific Instruction addressed by a relative offset.
@ DivAssign
Assign the result of a Division to the first Object.
@ AddAssign
Assign the result of an Addition to the first Object.
@ JumpRelativeIfNull
Jump to a specific Instruction addressed by a relative offset if the top of the Stack is null.
@ MulAssign
Assign the result of a Multiplication to the first Object.
@ JumpRelativeIfTrue
Jump to a specific Instruction addressed by a relative offset if the top of the Stack is true.
@ AddDisposeFinalizer
Registers a Finalizer for the current scope.
@ LessEquals
Compare two Objects for Less Than or Equal.
@ BinaryUnpack
Unpack the right side of a Binary Operation into the left side.
@ SetContinuePointer
Set the Continue instruction pointer.
@ LoadMember
Load a Member of an Object.