< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/RealType.java

Print this page


   1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
  23 
  24 import com.sun.org.apache.bcel.internal.generic.BranchHandle;
  25 import com.sun.org.apache.bcel.internal.generic.CHECKCAST;
  26 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
  27 import com.sun.org.apache.bcel.internal.generic.DLOAD;
  28 import com.sun.org.apache.bcel.internal.generic.DSTORE;
  29 import com.sun.org.apache.bcel.internal.generic.GOTO;
  30 import com.sun.org.apache.bcel.internal.generic.IFEQ;
  31 import com.sun.org.apache.bcel.internal.generic.IFNE;
  32 import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
  33 import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
  34 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
  35 import com.sun.org.apache.bcel.internal.generic.Instruction;
  36 import com.sun.org.apache.bcel.internal.generic.InstructionConstants;
  37 import com.sun.org.apache.bcel.internal.generic.InstructionList;
  38 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
  39 import com.sun.org.apache.bcel.internal.generic.NEW;
  40 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
  41 import com.sun.org.apache.xalan.internal.xsltc.compiler.FlowList;
  42 
  43 /**
  44  * @author Jacek Ambroziak
  45  * @author Santiago Pericas-Geertsen
  46  */
  47 public final class RealType extends NumberType {
  48     protected RealType() {}
  49 
  50     public String toString() {
  51         return "real";
  52     }
  53 
  54     public boolean identicalTo(Type other) {
  55         return this == other;
  56     }


 279      */
 280     public void translateBox(ClassGenerator classGen,
 281                              MethodGenerator methodGen) {
 282         translateTo(classGen, methodGen, Type.Reference);
 283     }
 284 
 285     /**
 286      * Translates an object of this type to its unboxed representation.
 287      */
 288     public void translateUnBox(ClassGenerator classGen,
 289                                MethodGenerator methodGen) {
 290         final ConstantPoolGen cpg = classGen.getConstantPool();
 291         final InstructionList il = methodGen.getInstructionList();
 292         il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS)));
 293         il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
 294                                                      DOUBLE_VALUE,
 295                                                      DOUBLE_VALUE_SIG)));
 296     }
 297 
 298     public Instruction ADD() {
 299         return InstructionConstants.DADD;
 300     }
 301 
 302     public Instruction SUB() {
 303         return InstructionConstants.DSUB;
 304     }
 305 
 306     public Instruction MUL() {
 307         return InstructionConstants.DMUL;
 308     }
 309 
 310     public Instruction DIV() {
 311         return InstructionConstants.DDIV;
 312     }
 313 
 314     public Instruction REM() {
 315         return InstructionConstants.DREM;
 316     }
 317 
 318     public Instruction NEG() {
 319         return InstructionConstants.DNEG;
 320     }
 321 
 322     public Instruction LOAD(int slot) {
 323         return new DLOAD(slot);
 324     }
 325 
 326     public Instruction STORE(int slot) {
 327         return new DSTORE(slot);
 328     }
 329 
 330     public Instruction POP() {
 331         return POP2;
 332     }
 333 
 334     public Instruction CMP(boolean less) {
 335         return less ? InstructionConstants.DCMPG : InstructionConstants.DCMPL;
 336     }
 337 
 338     public Instruction DUP() {
 339         return DUP2;
 340     }
 341 }
   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
  22 
  23 import com.sun.org.apache.bcel.internal.generic.BranchHandle;
  24 import com.sun.org.apache.bcel.internal.generic.CHECKCAST;
  25 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
  26 import com.sun.org.apache.bcel.internal.generic.DLOAD;
  27 import com.sun.org.apache.bcel.internal.generic.DSTORE;
  28 import com.sun.org.apache.bcel.internal.generic.GOTO;
  29 import com.sun.org.apache.bcel.internal.generic.IFEQ;
  30 import com.sun.org.apache.bcel.internal.generic.IFNE;
  31 import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
  32 import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
  33 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
  34 import com.sun.org.apache.bcel.internal.generic.Instruction;
  35 import com.sun.org.apache.bcel.internal.generic.InstructionConst;
  36 import com.sun.org.apache.bcel.internal.generic.InstructionList;
  37 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
  38 import com.sun.org.apache.bcel.internal.generic.NEW;
  39 import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
  40 import com.sun.org.apache.xalan.internal.xsltc.compiler.FlowList;
  41 
  42 /**
  43  * @author Jacek Ambroziak
  44  * @author Santiago Pericas-Geertsen
  45  */
  46 public final class RealType extends NumberType {
  47     protected RealType() {}
  48 
  49     public String toString() {
  50         return "real";
  51     }
  52 
  53     public boolean identicalTo(Type other) {
  54         return this == other;
  55     }


 278      */
 279     public void translateBox(ClassGenerator classGen,
 280                              MethodGenerator methodGen) {
 281         translateTo(classGen, methodGen, Type.Reference);
 282     }
 283 
 284     /**
 285      * Translates an object of this type to its unboxed representation.
 286      */
 287     public void translateUnBox(ClassGenerator classGen,
 288                                MethodGenerator methodGen) {
 289         final ConstantPoolGen cpg = classGen.getConstantPool();
 290         final InstructionList il = methodGen.getInstructionList();
 291         il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS)));
 292         il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS,
 293                                                      DOUBLE_VALUE,
 294                                                      DOUBLE_VALUE_SIG)));
 295     }
 296 
 297     public Instruction ADD() {
 298         return InstructionConst.DADD;
 299     }
 300 
 301     public Instruction SUB() {
 302         return InstructionConst.DSUB;
 303     }
 304 
 305     public Instruction MUL() {
 306         return InstructionConst.DMUL;
 307     }
 308 
 309     public Instruction DIV() {
 310         return InstructionConst.DDIV;
 311     }
 312 
 313     public Instruction REM() {
 314         return InstructionConst.DREM;
 315     }
 316 
 317     public Instruction NEG() {
 318         return InstructionConst.DNEG;
 319     }
 320 
 321     public Instruction LOAD(int slot) {
 322         return new DLOAD(slot);
 323     }
 324 
 325     public Instruction STORE(int slot) {
 326         return new DSTORE(slot);
 327     }
 328 
 329     public Instruction POP() {
 330         return POP2;
 331     }
 332 
 333     public Instruction CMP(boolean less) {
 334         return less ? InstructionConst.DCMPG : InstructionConst.DCMPL;
 335     }
 336 
 337     public Instruction DUP() {
 338         return DUP2;
 339     }
 340 }
< prev index next >