1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#[derive(Clone, Debug)]
pub struct UpVarDef {
    pub capture_local: bool,
    pub upidx: usize,
}

#[derive(Clone, Copy, Debug)]
pub enum Instr {
    ArbInt(usize),
    Array(usize),
    Block(usize),
    GlobalLookup(usize),
    ClosureReturn(usize),
    Double(f64),
    Dummy,
    InstVarLookup(usize),
    InstVarSet(usize),
    Int(isize),
    Pop,
    Return,
    Send(usize, usize),
    String(usize),
    SuperSend(usize, usize),
    Symbol(usize),
    LocalVarLookup(usize),
    LocalVarSet(usize),
    UpVarLookup(usize),
    UpVarSet(usize),
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Primitive {
    Add,
    And,
    As32BitSignedValue,
    As32BitUnsignedValue,
    AsDouble,
    AsInteger,
    AsString,
    AsSymbol,
    At,
    AtPut,
    AtRandom,
    BitXor,
    Class,
    Cos,
    Concatenate,
    Div,
    DoubleDiv,
    ErrorPrint,
    ErrorPrintln,
    Equals,
    Exit,
    Fields,
    FromString,
    FullGC,
    Global,
    GlobalPut,
    GreaterThan,
    GreaterThanEquals,
    Halt,
    HasGlobal,
    Hashcode,
    Holder,
    Inspect,
    InstVarAt,
    InstVarAtPut,
    InstVarNamed,
    InvokeOnWith,
    IsDigits,
    IsLetters,
    IsWhiteSpace,
    #[cfg(feature = "krun_harness")]
    KrunInit,
    #[cfg(feature = "krun_harness")]
    KrunDone,
    #[cfg(feature = "krun_harness")]
    KrunMeasure,
    #[cfg(feature = "krun_harness")]
    KrunGetCoreCyclesDouble,
    #[cfg(feature = "krun_harness")]
    KrunGetNumCores,
    #[cfg(feature = "krun_harness")]
    KrunGetWallclock,
    Length,
    Load,
    LoadFile,
    LessThan,
    LessThanEquals,
    Methods,
    Mod,
    Mul,
    Name,
    NotEquals,
    New,
    NewArray,
    ObjectSize,
    Perform,
    PerformInSuperClass,
    PerformWithArguments,
    PerformWithArgumentsInSuperClass,
    PositiveInfinity,
    PrimSubstringFromTo,
    PrintNewline,
    PrintStackTrace,
    PrintString,
    RefEquals,
    Rem,
    Restart,
    Round,
    Shl,
    Shr,
    Signature,
    Sin,
    Sqrt,
    Sub,
    Superclass,
    Ticks,
    Time,
    /// Is this `value` (0), `value:` (1), or `value:with:` (2)?
    Value(u8),
}