1 package org.simantics.scl.compiler.constants;
3 import org.cojen.classfile.TypeDesc;
4 import org.objectweb.asm.Label;
5 import org.simantics.scl.compiler.internal.codegen.continuations.Cont;
6 import org.simantics.scl.compiler.internal.codegen.references.IVal;
7 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
8 import org.simantics.scl.compiler.internal.codegen.utils.TransientClassBuilder;
9 import org.simantics.scl.compiler.types.Types;
11 public class ShortConstant extends Constant {
12 public static final ShortConstant ZERO = new ShortConstant((short)0);
13 public static final ShortConstant ONE = new ShortConstant((short)1);
14 public static final ShortConstant MINUS_ONE = new ShortConstant((short)-1);
18 public ShortConstant(short value) {
24 public void push(MethodBuilder mb) {
25 mb.loadConstant(value);
29 public String toString() {
30 return String.valueOf(value);
33 public short getValue() {
38 public int hashCode() {
43 public boolean equals(Object obj) {
48 if (getClass() != obj.getClass())
50 ShortConstant other = (ShortConstant) obj;
51 if (value != other.value)
57 public void deconstruct(MethodBuilder mb, IVal parameter, Cont success,
59 mb.push(parameter, Types.SHORT);
60 mb.loadConstant(value);
61 mb.ifComparisonBranch(failure, "!=", TypeDesc.SHORT);
65 public int constructorTag() {
70 public Object realizeValue(TransientClassBuilder classBuilder) {