1 //
2 // Copyright (c) 2006, Brian Frank and Andy Frank
3 // Licensed under the Academic Free License version 3.0
4 //
5 // History:
6 // 11 Sep 07 Auto-generated by /adm/genfcode.rb
7 //
8
9 **
10 ** FOp provides all the fcode constants
11 **
12 enum FOp
13 {
14 Nop (), // 0 no operation
15 LoadNull (), // 1 load null literal onto stack
16 LoadFalse (), // 2 load false literal onto stack
17 LoadTrue (), // 3 load true literal onto stack
18 LoadInt (FOpArg.Int), // 4 load Int const by index onto stack
19 LoadFloat (FOpArg.Float), // 5 load Float const by index onto stack
20 LoadStr (FOpArg.Str), // 6 load Str const by index onto stack
21 LoadDuration (FOpArg.Duration), // 7 load Duration const by index onto stack
22 LoadType (FOpArg.TypeRef), // 8 load Type instance by index onto stack
23 LoadUri (FOpArg.Uri), // 9 load Uri const by index onto stack
24 LoadVar (FOpArg.Register), // 10 local var register index (0 is this)
25 StoreVar (FOpArg.Register), // 11 local var register index (0 is this)
26 LoadInstance (FOpArg.FieldRef), // 12 load field from storage
27 StoreInstance (FOpArg.FieldRef), // 13 store field to storage
28 LoadStatic (FOpArg.FieldRef), // 14 load static field from storage
29 StoreStatic (FOpArg.FieldRef), // 15 store static field to storage
30 Unused1 (), // 16 unsed opcode
31 Unused2 (), // 17 unsed opcode
32 LoadMixinStatic (FOpArg.FieldRef), // 18 load static on mixin field from storage
33 StoreMixinStatic (FOpArg.FieldRef), // 19 store static on mixin field to storage
34 CallNew (FOpArg.MethodRef), // 20 alloc new object and call constructor
35 CallCtor (FOpArg.MethodRef), // 21 call constructor (used for constructor chaining)
36 CallStatic (FOpArg.MethodRef), // 22 call static method
37 CallVirtual (FOpArg.MethodRef), // 23 call virtual instance method
38 CallNonVirtual (FOpArg.MethodRef), // 24 call instance method non-virtually (private or super only b/c of Java invokespecial)
39 CallMixinStatic (FOpArg.MethodRef), // 25 call static mixin method
40 CallMixinVirtual (FOpArg.MethodRef), // 26 call virtual mixin method
41 CallMixinNonVirtual (FOpArg.MethodRef), // 27 call instance mixin method non-virtually (named super)
42 Jump (FOpArg.Jump), // 28 unconditional jump
43 JumpTrue (FOpArg.Jump), // 29 jump if bool true
44 JumpFalse (FOpArg.Jump), // 30 jump if bool false
45 CmpEQ (), // 31 a.equals(b)
46 CmpNE (), // 32 !a.equals(b)
47 Cmp (), // 33 a.compare(b)
48 CmpLE (), // 34 a.compare(b) <= 0
49 CmpLT (), // 35 a.compare(b) < 0
50 CmpGT (), // 36 a.compare(b) > 0
51 CmpGE (), // 37 a.compare(b) >= 0
52 CmpSame (), // 38 a === b
53 CmpNotSame (), // 39 a !== b
54 CmpNull (), // 40 a == null
55 CmpNotNull (), // 41 a != null
56 ReturnVoid (), // 42 return nothing
57 ReturnObj (), // 43 return object
58 Pop (), // 44 pop top object off stack
59 Dup (), // 45 duplicate object ref on top of stack
60 DupDown (), // 46 TODO - remove when we axe Java compiler
61 Is (FOpArg.TypeRef), // 47 is operator
62 As (FOpArg.TypeRef), // 48 as operator
63 Cast (FOpArg.TypeRef), // 49 type cast
64 Switch (), // 50 switch jump table 2 count + 2*count
65 Throw (), // 51 throw Err on top of stack
66 Leave (FOpArg.Jump), // 52 jump out of a try or catch block
67 JumpFinally (FOpArg.Jump), // 53 jump to a finally block
68 CatchAllStart (), // 54 start catch all block - do not leave Err on stack
69 CatchErrStart (FOpArg.TypeRef), // 55 start catch block - leave typed Err on stack
70 CatchEnd (), // 56 start catch block - leave typed Err on stack
71 FinallyStart (), // 57 starting instruction of a finally block
72 FinallyEnd () // 58 ending instruction of a finally block
73
74 private new make(FOpArg arg := FOpArg.None) { this.arg = arg }
75
76 const FOpArg arg
77 }
78
79 **************************************************************************
80 ** FOpArg
81 **************************************************************************
82
83 enum FOpArg
84 {
85 None,
86 Int,
87 Float,
88 Str,
89 Duration,
90 Uri,
91 Register,
92 TypeRef,
93 FieldRef,
94 MethodRef,
95 Jump
96 }