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 DoubleConstant extends Constant {
14 public DoubleConstant(double value) {
20 public void push(MethodBuilder mb) {
21 mb.loadConstant(value);
25 public String toString() {
26 return String.valueOf(value);
30 public int hashCode() {
34 temp = Double.doubleToLongBits(value);
35 result = prime * result + (int) (temp ^ (temp >>> 32));
40 public boolean equals(Object obj) {
45 if (getClass() != obj.getClass())
47 DoubleConstant other = (DoubleConstant) obj;
48 if (Double.doubleToLongBits(value) != Double
49 .doubleToLongBits(other.value))
55 public void deconstruct(MethodBuilder mb, IVal parameter, Cont success,
57 mb.push(parameter, Types.DOUBLE);
58 mb.loadConstant(value);
59 mb.ifComparisonBranch(failure, "!=", TypeDesc.DOUBLE);
64 public int constructorTag() {
69 public Object realizeValue(TransientClassBuilder classBuilder) {