---
# System prepended metadata

title: Untitled

---

**@CompilationFinal** - a mutable field that the JIT compiler can assume as constant when compiling

**transferToInterpreterAndInvalidate()** - recompile the current code unit

```java
class Interpreter {
    @CompilationFinal int seenNumber = 0;
    @CompilationFinal int seenRightStrings = 0;
    @CompilationFinal boolean seenError = false;

    class AddOperation {
       Object execute(Value left, Value right) {
          if (seenNumber > 0 && seenNumber > seenRightStrings && left instanceof JSNumber && right instanceof JSNumber) {
              return ((JSNumber)left).add(right);
          } else if (seenRightStrings > 0 && seenRightStrings >= seenNumber && right instanceof JSString) {
              return left.toString().concat((JSString)right);
          } else {
              transferToInterpreterAndInvalidate();
              if (left instanceof JSNumber) {
                  seenNumber = true;
                  return ((JSNumber)left).add(right);
              }
              if (right instanceof String) {
                  seenRightStrings = true;
                  return left.toString().concat((JSString)right);
              }
              transferToInterpreterAndInvalidate();
              throw RuntimeException("Unsupported operands for add");
          }
       }
    }
    
    abstract class SubOperation {
        abstract  Object execute(Value left, Value right);
        
        @Specialization
        Object do(JSString left, Object right) {
            ...
        }
        
        
    }
}
```

instanceof JSNumber
bne
instanceof JSNumber
bne
transfer
instanceof JSString
bne
invoke concat ...
instanceof JSString
transfer