Esempio n. 1
0
 /**
  * Cast expression code generation
  *
  * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
  * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
  * @param valueRequired boolean
  */
 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
   int pc = codeStream.position;
   boolean needRuntimeCheckcast = (this.bits & ASTNode.GenerateCheckcast) != 0;
   if (this.constant != Constant.NotAConstant) {
     if (valueRequired
         || needRuntimeCheckcast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting
       // check
       codeStream.generateConstant(this.constant, this.implicitConversion);
       if (needRuntimeCheckcast) {
         codeStream.checkcast(this.resolvedType);
       }
       if (!valueRequired) {
         // the resolveType cannot be double or long
         codeStream.pop();
       }
     }
     codeStream.recordPositionsFrom(pc, this.sourceStart);
     return;
   }
   this.expression.generateCode(currentScope, codeStream, valueRequired || needRuntimeCheckcast);
   if (needRuntimeCheckcast
       && this.expression.postConversionType(currentScope)
           != this.resolvedType
               .erasure()) { // no need to issue a checkcast if already done as genericCast
     codeStream.checkcast(this.resolvedType);
   }
   if (valueRequired) {
     codeStream.generateImplicitConversion(this.implicitConversion);
   } else if (needRuntimeCheckcast) {
     codeStream.pop();
   }
   codeStream.recordPositionsFrom(pc, this.sourceStart);
 }
  /** Code generation for a array allocation expression */
  public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {

    int pc = codeStream.position;

    if (initializer != null) {
      initializer.generateCode(currentScope, codeStream, valueRequired);
      return;
    }

    int nonNullDimensionsLength = 0;
    for (int i = 0, max = dimensions.length; i < max; i++)
      if (dimensions[i] != null) {
        dimensions[i].generateCode(currentScope, codeStream, true);
        nonNullDimensionsLength++;
      }

    // Generate a sequence of bytecodes corresponding to an array allocation
    if (this.resolvedType.dimensions() == 1) {
      // Mono-dimensional array
      codeStream.newArray((ArrayBinding) this.resolvedType);
    } else {
      // Multi-dimensional array
      codeStream.multianewarray(this.resolvedType, nonNullDimensionsLength);
    }

    if (valueRequired) {
      codeStream.generateImplicitConversion(implicitConversion);
    } else {
      codeStream.pop();
    }

    codeStream.recordPositionsFrom(pc, this.sourceStart);
  }
 /**
  * Code generation for instanceOfExpression
  *
  * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
  * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
  * @param valueRequired boolean
  */
 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
   int pc = codeStream.position;
   this.expression.generateCode(currentScope, codeStream, true);
   codeStream.instance_of(this.type.resolvedType);
   if (valueRequired) {
     codeStream.generateImplicitConversion(this.implicitConversion);
   } else {
     codeStream.pop();
   }
   codeStream.recordPositionsFrom(pc, this.sourceStart);
 }
  /**
   * MessageSendDotClass code generation
   *
   * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
   * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
   * @param valueRequired boolean
   */
  public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
    // {ObjectTeams: role class literal?
    if (this.roleClassLiteralAccess != null) {
      this.roleClassLiteralAccess.generateCode(currentScope, codeStream, valueRequired);
      return;
    }
    // SH}
    int pc = codeStream.position;

    // in interface case, no caching occurs, since cannot make a cache field for interface
    if (valueRequired) {
      codeStream.generateClassLiteralAccessForType(this.type.resolvedType, this.syntheticField);
      codeStream.generateImplicitConversion(this.implicitConversion);
    }
    codeStream.recordPositionsFrom(pc, this.sourceStart);
  }
Esempio n. 5
0
 /**
  * Cast expression code generation
  *
  * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
  * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
  * @param valueRequired boolean
  */
 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
   int pc = codeStream.position;
   boolean annotatedCast = (this.type.bits & ASTNode.HasTypeAnnotations) != 0;
   boolean needRuntimeCheckcast = (this.bits & ASTNode.GenerateCheckcast) != 0;
   if (this.constant != Constant.NotAConstant) {
     if (valueRequired
         || needRuntimeCheckcast
         || annotatedCast) { // Added for: 1F1W9IG: IVJCOM:WINNT - Compiler omits casting check
       codeStream.generateConstant(this.constant, this.implicitConversion);
       if (needRuntimeCheckcast || annotatedCast) {
         codeStream.checkcast(this.type, this.resolvedType, pc);
       }
       if (!valueRequired) {
         // the resolveType cannot be double or long
         codeStream.pop();
       }
     }
     codeStream.recordPositionsFrom(pc, this.sourceStart);
     return;
   }
   this.expression.generateCode(
       currentScope, codeStream, annotatedCast || valueRequired || needRuntimeCheckcast);
   if (annotatedCast
       || (needRuntimeCheckcast
           && TypeBinding.notEquals(
               this.expression.postConversionType(currentScope),
               this.resolvedType
                   .erasure()))) { // no need to issue a checkcast if already done as genericCast
     codeStream.checkcast(this.type, this.resolvedType, pc);
   }
   if (valueRequired) {
     codeStream.generateImplicitConversion(this.implicitConversion);
   } else if (annotatedCast || needRuntimeCheckcast) {
     switch (this.resolvedType.id) {
       case T_long:
       case T_double:
         codeStream.pop2();
         break;
       default:
         codeStream.pop();
         break;
     }
   }
   codeStream.recordPositionsFrom(pc, this.sourceStart);
 }
  /**
   * Normal == or != code generation.
   *
   * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
   * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
   * @param valueRequired boolean
   */
  public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {

    int pc = codeStream.position;
    if (this.constant != Constant.NotAConstant) {
      if (valueRequired) codeStream.generateConstant(this.constant, this.implicitConversion);
      codeStream.recordPositionsFrom(pc, this.sourceStart);
      return;
    }

    if ((this.left.implicitConversion & COMPILE_TYPE_MASK) /*compile-time*/ == T_boolean) {
      generateBooleanEqual(currentScope, codeStream, valueRequired);
    } else {
      generateNonBooleanEqual(currentScope, codeStream, valueRequired);
    }
    if (valueRequired) {
      codeStream.generateImplicitConversion(this.implicitConversion);
    }
    codeStream.recordPositionsFrom(pc, this.sourceStart);
  }
 public void generateAssignment(
     BlockScope currentScope,
     CodeStream codeStream,
     Assignment assignment,
     boolean valueRequired) {
   int pc = codeStream.position;
   FieldBinding codegenBinding = this.binding.original();
   this.receiver.generateCode(currentScope, codeStream, !codegenBinding.isStatic());
   codeStream.recordPositionsFrom(pc, this.sourceStart);
   assignment.expression.generateCode(currentScope, codeStream, true);
   fieldStore(
       currentScope,
       codeStream,
       codegenBinding,
       this.syntheticAccessors == null ? null : this.syntheticAccessors[FieldReference.WRITE],
       this.actualReceiverType,
       this.receiver.isImplicitThis(),
       valueRequired);
   if (valueRequired) {
     codeStream.generateImplicitConversion(assignment.implicitConversion);
   }
   // no need for generic cast as value got dupped
 }
  /** Code generation for a binary operation */
  public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
    int pc = codeStream.position;
    if (this.constant != Constant.NotAConstant) {
      // inlined value
      if (valueRequired) codeStream.generateConstant(this.constant, this.implicitConversion);
      codeStream.recordPositionsFrom(pc, this.sourceStart);
      return;
    }
    Constant cst = this.right.constant;
    if (cst != Constant.NotAConstant) {
      // <expr> || true --> true
      if (cst.booleanValue() == true) {
        this.left.generateCode(currentScope, codeStream, false);
        if (valueRequired) codeStream.iconst_1();
      } else {
        // <expr>|| false --> <expr>
        this.left.generateCode(currentScope, codeStream, valueRequired);
      }
      if (this.mergedInitStateIndex != -1) {
        codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex);
      }
      codeStream.generateImplicitConversion(this.implicitConversion);
      codeStream.recordPositionsFrom(pc, this.sourceStart);
      return;
    }

    BranchLabel trueLabel = new BranchLabel(codeStream), endLabel;
    cst = this.left.optimizedBooleanConstant();
    boolean leftIsConst = cst != Constant.NotAConstant;
    boolean leftIsTrue = leftIsConst && cst.booleanValue() == true;

    cst = this.right.optimizedBooleanConstant();
    boolean rightIsConst = cst != Constant.NotAConstant;
    boolean rightIsTrue = rightIsConst && cst.booleanValue() == true;

    generateOperands:
    {
      if (leftIsConst) {
        this.left.generateCode(currentScope, codeStream, false);
        if (leftIsTrue) {
          break generateOperands; // no need to generate right operand
        }
      } else {
        this.left.generateOptimizedBoolean(currentScope, codeStream, trueLabel, null, true);
        // need value, e.g. if (a == 1 || ((b = 2) > 0)) {} -> shouldn't initialize 'b' if a==1
      }
      if (this.rightInitStateIndex != -1) {
        codeStream.addDefinitelyAssignedVariables(currentScope, this.rightInitStateIndex);
      }
      if (rightIsConst) {
        this.right.generateCode(currentScope, codeStream, false);
      } else {
        this.right.generateOptimizedBoolean(
            currentScope, codeStream, trueLabel, null, valueRequired);
      }
    }
    if (this.mergedInitStateIndex != -1) {
      codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.mergedInitStateIndex);
    }
    /*
     * improving code gen for such a case: boolean b = i < 0 || true since
     * the label has never been used, we have the inlined value on the
     * stack.
     */
    if (valueRequired) {
      if (leftIsConst && leftIsTrue) {
        codeStream.iconst_1();
        codeStream.recordPositionsFrom(codeStream.position, this.left.sourceEnd);
      } else {
        if (rightIsConst && rightIsTrue) {
          codeStream.iconst_1();
          codeStream.recordPositionsFrom(codeStream.position, this.left.sourceEnd);
        } else {
          codeStream.iconst_0();
        }
        if (trueLabel.forwardReferenceCount() > 0) {
          if ((this.bits & IsReturnedValue) != 0) {
            codeStream.generateImplicitConversion(this.implicitConversion);
            codeStream.generateReturnBytecode(this);
            trueLabel.place();
            codeStream.iconst_1();
          } else {
            codeStream.goto_(endLabel = new BranchLabel(codeStream));
            codeStream.decrStackSize(1);
            trueLabel.place();
            codeStream.iconst_1();
            endLabel.place();
          }
        } else {
          trueLabel.place();
        }
      }
      codeStream.generateImplicitConversion(this.implicitConversion);
      codeStream.recordPositionsFrom(codeStream.position, this.sourceEnd);
    } else {
      trueLabel.place();
    }
  }
  public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
    if (!valueRequired) currentScope.problemReporter().unusedObjectAllocation(this);
    int pc = codeStream.position;
    MethodBinding codegenBinding = this.binding.original();
    ReferenceBinding allocatedType = codegenBinding.declaringClass;
    codeStream.new_(allocatedType);
    boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
    if (valueRequired || isUnboxing) {
      codeStream.dup();
    }
    // better highlight for allocation: display the type individually
    if (this.type != null) { // null for enum constant body
      codeStream.recordPositionsFrom(pc, this.type.sourceStart);
    } else {
      // push enum constant name and ordinal
      codeStream.ldc(String.valueOf(this.enumConstant.name));
      codeStream.generateInlinedValue(this.enumConstant.binding.id);
    }
    // handling innerclass instance allocation - enclosing instance arguments
    if (allocatedType.isNestedType()) {
      codeStream.generateSyntheticEnclosingInstanceValues(
          currentScope, allocatedType, enclosingInstance(), this);
    }
    // generate the arguments for constructor
    generateArguments(this.binding, this.arguments, currentScope, codeStream);
    // handling innerclass instance allocation - outer local arguments
    if (allocatedType.isNestedType()) {
      codeStream.generateSyntheticOuterArgumentValues(currentScope, allocatedType, this);
    }

    // invoke constructor
    if (this.syntheticAccessor == null) {
      codeStream.invoke(
          Opcodes.OPC_invokespecial, codegenBinding, null /* default declaringClass */);
    } else {
      // synthetic accessor got some extra arguments appended to its signature, which need values
      for (int i = 0,
              max = this.syntheticAccessor.parameters.length - codegenBinding.parameters.length;
          i < max;
          i++) {
        codeStream.aconst_null();
      }
      codeStream.invoke(
          Opcodes.OPC_invokespecial, this.syntheticAccessor, null /* default declaringClass */);
    }
    if (valueRequired) {
      codeStream.generateImplicitConversion(this.implicitConversion);
    } else if (isUnboxing) {
      // conversion only generated if unboxing
      codeStream.generateImplicitConversion(this.implicitConversion);
      switch (postConversionType(currentScope).id) {
        case T_long:
        case T_double:
          codeStream.pop2();
          break;
        default:
          codeStream.pop();
      }
    }
    codeStream.recordPositionsFrom(pc, this.sourceStart);

    if (this.anonymousType != null) {
      this.anonymousType.generateCode(currentScope, codeStream);
    }
  }
 public void generatePostIncrement(
     BlockScope currentScope,
     CodeStream codeStream,
     CompoundAssignment postIncrement,
     boolean valueRequired) {
   boolean isStatic;
   // check if postIncrement is the only usage of a private field
   reportOnlyUselesslyReadPrivateField(currentScope, this.binding, valueRequired);
   FieldBinding codegenBinding = this.binding.original();
   this.receiver.generateCode(currentScope, codeStream, !(isStatic = codegenBinding.isStatic()));
   if (isStatic) {
     if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
       TypeBinding constantPoolDeclaringClass =
           CodeStream.getConstantPoolDeclaringClass(
               currentScope,
               codegenBinding,
               this.actualReceiverType,
               this.receiver.isImplicitThis());
       codeStream.fieldAccess(Opcodes.OPC_getstatic, codegenBinding, constantPoolDeclaringClass);
     } else {
       codeStream.invoke(
           Opcodes.OPC_invokestatic,
           this.syntheticAccessors[FieldReference.READ],
           null /* default declaringClass */);
     }
   } else {
     codeStream.dup();
     if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
       TypeBinding constantPoolDeclaringClass =
           CodeStream.getConstantPoolDeclaringClass(
               currentScope,
               codegenBinding,
               this.actualReceiverType,
               this.receiver.isImplicitThis());
       codeStream.fieldAccess(Opcodes.OPC_getfield, codegenBinding, constantPoolDeclaringClass);
     } else {
       codeStream.invoke(
           Opcodes.OPC_invokestatic,
           this.syntheticAccessors[FieldReference.READ],
           null /* default declaringClass */);
     }
   }
   TypeBinding operandType;
   if (this.genericCast != null) {
     codeStream.checkcast(this.genericCast);
     operandType = this.genericCast;
   } else {
     operandType = codegenBinding.type;
   }
   if (valueRequired) {
     if (isStatic) {
       switch (operandType.id) {
         case TypeIds.T_long:
         case TypeIds.T_double:
           codeStream.dup2();
           break;
         default:
           codeStream.dup();
           break;
       }
     } else { // Stack:  [owner][old field value]  ---> [old field value][owner][old field value]
       switch (operandType.id) {
         case TypeIds.T_long:
         case TypeIds.T_double:
           codeStream.dup2_x1();
           break;
         default:
           codeStream.dup_x1();
           break;
       }
     }
   }
   codeStream.generateImplicitConversion(this.implicitConversion);
   codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion);
   codeStream.sendOperator(
       postIncrement.operator, this.implicitConversion & TypeIds.COMPILE_TYPE_MASK);
   codeStream.generateImplicitConversion(postIncrement.preAssignImplicitConversion);
   fieldStore(
       currentScope,
       codeStream,
       codegenBinding,
       this.syntheticAccessors == null ? null : this.syntheticAccessors[FieldReference.WRITE],
       this.actualReceiverType,
       this.receiver.isImplicitThis(),
       false);
 }
 public void generateCompoundAssignment(
     BlockScope currentScope,
     CodeStream codeStream,
     Expression expression,
     int operator,
     int assignmentImplicitConversion,
     boolean valueRequired) {
   boolean isStatic;
   // check if compound assignment is the only usage of a private field
   reportOnlyUselesslyReadPrivateField(currentScope, this.binding, valueRequired);
   FieldBinding codegenBinding = this.binding.original();
   this.receiver.generateCode(currentScope, codeStream, !(isStatic = codegenBinding.isStatic()));
   if (isStatic) {
     if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
       TypeBinding constantPoolDeclaringClass =
           CodeStream.getConstantPoolDeclaringClass(
               currentScope,
               codegenBinding,
               this.actualReceiverType,
               this.receiver.isImplicitThis());
       codeStream.fieldAccess(Opcodes.OPC_getstatic, codegenBinding, constantPoolDeclaringClass);
     } else {
       codeStream.invoke(
           Opcodes.OPC_invokestatic,
           this.syntheticAccessors[FieldReference.READ],
           null /* default declaringClass */);
     }
   } else {
     codeStream.dup();
     if (this.syntheticAccessors == null || this.syntheticAccessors[FieldReference.READ] == null) {
       TypeBinding constantPoolDeclaringClass =
           CodeStream.getConstantPoolDeclaringClass(
               currentScope,
               codegenBinding,
               this.actualReceiverType,
               this.receiver.isImplicitThis());
       codeStream.fieldAccess(Opcodes.OPC_getfield, codegenBinding, constantPoolDeclaringClass);
     } else {
       codeStream.invoke(
           Opcodes.OPC_invokestatic,
           this.syntheticAccessors[FieldReference.READ],
           null /* default declaringClass */);
     }
   }
   int operationTypeID;
   switch (operationTypeID = (this.implicitConversion & TypeIds.IMPLICIT_CONVERSION_MASK) >> 4) {
     case T_JavaLangString:
     case T_JavaLangObject:
     case T_undefined:
       codeStream.generateStringConcatenationAppend(currentScope, null, expression);
       break;
     default:
       if (this.genericCast != null) codeStream.checkcast(this.genericCast);
       // promote the array reference to the suitable operation type
       codeStream.generateImplicitConversion(this.implicitConversion);
       // generate the increment value (will by itself  be promoted to the operation value)
       if (expression == IntLiteral.One) { // prefix operation
         codeStream.generateConstant(expression.constant, this.implicitConversion);
       } else {
         expression.generateCode(currentScope, codeStream, true);
       }
       // perform the operation
       codeStream.sendOperator(operator, operationTypeID);
       // cast the value back to the array reference type
       codeStream.generateImplicitConversion(assignmentImplicitConversion);
   }
   fieldStore(
       currentScope,
       codeStream,
       codegenBinding,
       this.syntheticAccessors == null ? null : this.syntheticAccessors[FieldReference.WRITE],
       this.actualReceiverType,
       this.receiver.isImplicitThis(),
       valueRequired);
   // no need for generic cast as value got dupped
 }
Esempio n. 12
0
  /** Code generation for a array initializer */
  public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {

    // Flatten the values and compute the dimensions, by iterating in depth into nested array
    // initializers
    int pc = codeStream.position;
    int expressionLength = (this.expressions == null) ? 0 : this.expressions.length;
    codeStream.generateInlinedValue(expressionLength);
    codeStream.newArray(this.binding);
    if (this.expressions != null) {
      // binding is an ArrayType, so I can just deal with the dimension
      int elementsTypeID = this.binding.dimensions > 1 ? -1 : this.binding.leafComponentType.id;
      for (int i = 0; i < expressionLength; i++) {
        Expression expr;
        if ((expr = this.expressions[i]).constant != Constant.NotAConstant) {
          switch (elementsTypeID) { // filter out initializations to default values
            case T_int:
            case T_short:
            case T_byte:
            case T_char:
            case T_long:
              if (expr.constant.longValue() != 0) {
                codeStream.dup();
                codeStream.generateInlinedValue(i);
                expr.generateCode(currentScope, codeStream, true);
                codeStream.arrayAtPut(elementsTypeID, false);
              }
              break;
            case T_float:
            case T_double:
              double constantValue = expr.constant.doubleValue();
              if (constantValue == -0.0 || constantValue != 0) {
                codeStream.dup();
                codeStream.generateInlinedValue(i);
                expr.generateCode(currentScope, codeStream, true);
                codeStream.arrayAtPut(elementsTypeID, false);
              }
              break;
            case T_boolean:
              if (expr.constant.booleanValue() != false) {
                codeStream.dup();
                codeStream.generateInlinedValue(i);
                expr.generateCode(currentScope, codeStream, true);
                codeStream.arrayAtPut(elementsTypeID, false);
              }
              break;
            default:
              if (!(expr instanceof NullLiteral)) {
                codeStream.dup();
                codeStream.generateInlinedValue(i);
                expr.generateCode(currentScope, codeStream, true);
                codeStream.arrayAtPut(elementsTypeID, false);
              }
          }
        } else if (!(expr instanceof NullLiteral)) {
          codeStream.dup();
          codeStream.generateInlinedValue(i);
          expr.generateCode(currentScope, codeStream, true);
          codeStream.arrayAtPut(elementsTypeID, false);
        }
      }
    }
    if (valueRequired) {
      codeStream.generateImplicitConversion(this.implicitConversion);
    } else {
      codeStream.pop();
    }
    codeStream.recordPositionsFrom(pc, this.sourceStart);
  }
Esempio n. 13
0
  /**
   * MessageSend code generation
   *
   * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
   * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
   * @param valueRequired boolean
   */
  public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
    int pc = codeStream.position;
    MethodBinding codegenBinding = this.binding.original();
    if (codegenBinding.canBeSeenBy(this.actualReceiverType, this, currentScope)) {
      // generate receiver/enclosing instance access
      boolean isStatic = codegenBinding.isStatic();
      // outer access ?
      if (!isStatic && ((this.bits & DepthMASK) != 0)) {
        // outer method can be reached through emulation
        ReferenceBinding targetType =
            currentScope
                .enclosingSourceType()
                .enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT);
        Object[] path =
            currentScope.getEmulationPath(
                targetType, true /*only exact match*/, false /*consider enclosing arg*/);
        if (path == null) {
          // emulation was not possible (should not happen per construction)
          currentScope.problemReporter().needImplementation(this);
        } else {
          codeStream.generateOuterAccess(path, this, targetType, currentScope);
        }
      } else {
        this.receiver.generateCode(currentScope, codeStream, !isStatic);
        if ((this.bits & NeedReceiverGenericCast) != 0) {
          codeStream.checkcast(this.actualReceiverType);
        }
        codeStream.recordPositionsFrom(pc, this.sourceStart);
      }
      // generate arguments
      generateArguments(this.binding, this.arguments, currentScope, codeStream);
      // actual message invocation
      TypeBinding constantPoolDeclaringClass =
          CodeStream.getConstantPoolDeclaringClass(
              currentScope,
              codegenBinding,
              this.actualReceiverType,
              this.receiver.isImplicitThis());
      if (isStatic) {
        codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass);
      } else if ((this.receiver.isSuper()) || codegenBinding.isPrivate()) {
        codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass);
      } else {
        if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
          codeStream.invoke(
              Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass);
        } else {
          codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass);
        }
      }
    } else {
      codeStream.generateEmulationForMethod(currentScope, codegenBinding);
      // generate receiver/enclosing instance access
      boolean isStatic = codegenBinding.isStatic();
      // outer access ?
      if (!isStatic && ((this.bits & DepthMASK) != 0)) {
        // not supported yet
        currentScope.problemReporter().needImplementation(this);
      } else {
        this.receiver.generateCode(currentScope, codeStream, !isStatic);
        if ((this.bits & NeedReceiverGenericCast) != 0) {
          codeStream.checkcast(this.actualReceiverType);
        }
        codeStream.recordPositionsFrom(pc, this.sourceStart);
      }
      if (isStatic) {
        // we need an object on the stack which is ignored for the method invocation
        codeStream.aconst_null();
      }
      // generate arguments
      if (this.arguments != null) {
        int argsLength = this.arguments.length;
        codeStream.generateInlinedValue(argsLength);
        codeStream.newArray(
            currentScope.createArrayType(
                currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
        codeStream.dup();
        for (int i = 0; i < argsLength; i++) {
          codeStream.generateInlinedValue(i);
          this.arguments[i].generateCode(currentScope, codeStream, true);
          TypeBinding parameterBinding = codegenBinding.parameters[i];
          if (parameterBinding.isBaseType() && parameterBinding != TypeBinding.NULL) {
            codeStream.generateBoxingConversion(codegenBinding.parameters[i].id);
          }
          codeStream.aastore();
          if (i < argsLength - 1) {
            codeStream.dup();
          }
        }
      } else {
        codeStream.generateInlinedValue(0);
        codeStream.newArray(
            currentScope.createArrayType(
                currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
      }
      codeStream.invokeJavaLangReflectMethodInvoke();

      // convert the return value to the appropriate type for primitive types
      if (codegenBinding.returnType.isBaseType()) {
        int typeID = codegenBinding.returnType.id;
        if (typeID == T_void) {
          // remove the null from the stack
          codeStream.pop();
        }
        codeStream.checkcast(typeID);
        codeStream.getBaseTypeValue(typeID);
      } else {
        codeStream.checkcast(codegenBinding.returnType);
      }
    }
    // required cast must occur even if no value is required
    if (this.valueCast != null) codeStream.checkcast(this.valueCast);
    if (valueRequired) {
      // implicit conversion if necessary
      codeStream.generateImplicitConversion(this.implicitConversion);
    } else {
      boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
      // conversion only generated if unboxing
      if (isUnboxing) codeStream.generateImplicitConversion(this.implicitConversion);
      switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) {
        case T_long:
        case T_double:
          codeStream.pop2();
          break;
        case T_void:
          break;
        default:
          codeStream.pop();
      }
    }
    codeStream.recordPositionsFrom(
        pc, (int) (this.nameSourcePosition >>> 32)); // highlight selector
  }
  /** Boolean generation for == with non-boolean operands */
  public void generateNonBooleanEqual(
      BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {

    boolean isEqualOperator = ((this.bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL;
    if (((this.left.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4) == T_int) {
      Constant cst;
      if ((cst = this.left.constant) != Constant.NotAConstant && cst.intValue() == 0) {
        // optimized case: 0 == x, 0 != x
        this.right.generateCode(currentScope, codeStream, valueRequired);
        if (valueRequired) {
          BranchLabel falseLabel = new BranchLabel(codeStream);
          if (isEqualOperator) {
            codeStream.ifne(falseLabel);
          } else {
            codeStream.ifeq(falseLabel);
          }
          // comparison is TRUE
          codeStream.iconst_1();
          if ((this.bits & IsReturnedValue) != 0) {
            codeStream.generateImplicitConversion(this.implicitConversion);
            codeStream.generateReturnBytecode(this);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_0();
          } else {
            BranchLabel endLabel = new BranchLabel(codeStream);
            codeStream.goto_(endLabel);
            codeStream.decrStackSize(1);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_0();
            endLabel.place();
          }
        }
        return;
      }
      if ((cst = this.right.constant) != Constant.NotAConstant && cst.intValue() == 0) {
        // optimized case: x == 0, x != 0
        this.left.generateCode(currentScope, codeStream, valueRequired);
        if (valueRequired) {
          BranchLabel falseLabel = new BranchLabel(codeStream);
          if (isEqualOperator) {
            codeStream.ifne(falseLabel);
          } else {
            codeStream.ifeq(falseLabel);
          }
          // comparison is TRUE
          codeStream.iconst_1();
          if ((this.bits & IsReturnedValue) != 0) {
            codeStream.generateImplicitConversion(this.implicitConversion);
            codeStream.generateReturnBytecode(this);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_0();
          } else {
            BranchLabel endLabel = new BranchLabel(codeStream);
            codeStream.goto_(endLabel);
            codeStream.decrStackSize(1);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_0();
            endLabel.place();
          }
        }
        return;
      }
    }

    // null cases
    if (this.right instanceof NullLiteral) {
      if (this.left instanceof NullLiteral) {
        // null == null, null != null
        if (valueRequired) {
          if (isEqualOperator) {
            codeStream.iconst_1();
          } else {
            codeStream.iconst_0();
          }
        }
      } else {
        // x == null, x != null
        this.left.generateCode(currentScope, codeStream, valueRequired);
        if (valueRequired) {
          BranchLabel falseLabel = new BranchLabel(codeStream);
          if (isEqualOperator) {
            codeStream.ifnonnull(falseLabel);
          } else {
            codeStream.ifnull(falseLabel);
          }
          // comparison is TRUE
          codeStream.iconst_1();
          if ((this.bits & IsReturnedValue) != 0) {
            codeStream.generateImplicitConversion(this.implicitConversion);
            codeStream.generateReturnBytecode(this);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_0();
          } else {
            BranchLabel endLabel = new BranchLabel(codeStream);
            codeStream.goto_(endLabel);
            codeStream.decrStackSize(1);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_0();
            endLabel.place();
          }
        }
      }
      return;
    } else if (this.left instanceof NullLiteral) {
      // null = x, null != x
      this.right.generateCode(currentScope, codeStream, valueRequired);
      if (valueRequired) {
        BranchLabel falseLabel = new BranchLabel(codeStream);
        if (isEqualOperator) {
          codeStream.ifnonnull(falseLabel);
        } else {
          codeStream.ifnull(falseLabel);
        }
        // comparison is TRUE
        codeStream.iconst_1();
        if ((this.bits & IsReturnedValue) != 0) {
          codeStream.generateImplicitConversion(this.implicitConversion);
          codeStream.generateReturnBytecode(this);
          // comparison is FALSE
          falseLabel.place();
          codeStream.iconst_0();
        } else {
          BranchLabel endLabel = new BranchLabel(codeStream);
          codeStream.goto_(endLabel);
          codeStream.decrStackSize(1);
          // comparison is FALSE
          falseLabel.place();
          codeStream.iconst_0();
          endLabel.place();
        }
      }
      return;
    }

    // default case
    this.left.generateCode(currentScope, codeStream, valueRequired);
    this.right.generateCode(currentScope, codeStream, valueRequired);
    if (valueRequired) {
      BranchLabel falseLabel = new BranchLabel(codeStream);
      if (isEqualOperator) {
        switch ((this.left.implicitConversion & IMPLICIT_CONVERSION_MASK)
            >> 4) { // operand runtime type
          case T_int:
            codeStream.if_icmpne(falseLabel);
            break;
          case T_float:
            codeStream.fcmpl();
            codeStream.ifne(falseLabel);
            break;
          case T_long:
            codeStream.lcmp();
            codeStream.ifne(falseLabel);
            break;
          case T_double:
            codeStream.dcmpl();
            codeStream.ifne(falseLabel);
            break;
          default:
            codeStream.if_acmpne(falseLabel);
        }
      } else {
        switch ((this.left.implicitConversion & IMPLICIT_CONVERSION_MASK)
            >> 4) { // operand runtime type
          case T_int:
            codeStream.if_icmpeq(falseLabel);
            break;
          case T_float:
            codeStream.fcmpl();
            codeStream.ifeq(falseLabel);
            break;
          case T_long:
            codeStream.lcmp();
            codeStream.ifeq(falseLabel);
            break;
          case T_double:
            codeStream.dcmpl();
            codeStream.ifeq(falseLabel);
            break;
          default:
            codeStream.if_acmpeq(falseLabel);
        }
      }
      // comparison is TRUE
      codeStream.iconst_1();
      if ((this.bits & IsReturnedValue) != 0) {
        codeStream.generateImplicitConversion(this.implicitConversion);
        codeStream.generateReturnBytecode(this);
        // comparison is FALSE
        falseLabel.place();
        codeStream.iconst_0();
      } else {
        BranchLabel endLabel = new BranchLabel(codeStream);
        codeStream.goto_(endLabel);
        codeStream.decrStackSize(1);
        // comparison is FALSE
        falseLabel.place();
        codeStream.iconst_0();
        endLabel.place();
      }
    }
  }
  /**
   * Boolean generation for == with boolean operands
   *
   * <p>Note this code does not optimize conditional constants !!!!
   */
  public void generateBooleanEqual(
      BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {

    // optimized cases: <something equivalent to true> == x, <something equivalent to false> == x,
    // optimized cases: <something equivalent to false> != x, <something equivalent to true> != x,
    boolean isEqualOperator = ((this.bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL;
    Constant cst = this.left.optimizedBooleanConstant();
    if (cst != Constant.NotAConstant) {
      Constant rightCst = this.right.optimizedBooleanConstant();
      if (rightCst != Constant.NotAConstant) {
        // <something equivalent to true> == <something equivalent to true>, <something equivalent
        // to false> != <something equivalent to true>
        // <something equivalent to true> == <something equivalent to false>, <something equivalent
        // to false> != <something equivalent to false>
        this.left.generateCode(currentScope, codeStream, false);
        this.right.generateCode(currentScope, codeStream, false);
        if (valueRequired) {
          boolean leftBool = cst.booleanValue();
          boolean rightBool = rightCst.booleanValue();
          if (isEqualOperator) {
            if (leftBool == rightBool) {
              codeStream.iconst_1();
            } else {
              codeStream.iconst_0();
            }
          } else {
            if (leftBool != rightBool) {
              codeStream.iconst_1();
            } else {
              codeStream.iconst_0();
            }
          }
        }
      } else if (cst.booleanValue() == isEqualOperator) {
        // <something equivalent to true> == x, <something equivalent to false> != x
        this.left.generateCode(currentScope, codeStream, false);
        this.right.generateCode(currentScope, codeStream, valueRequired);
      } else {
        // <something equivalent to false> == x, <something equivalent to true> != x
        if (valueRequired) {
          BranchLabel falseLabel = new BranchLabel(codeStream);
          this.left.generateCode(currentScope, codeStream, false);
          this.right.generateOptimizedBoolean(
              currentScope, codeStream, null, falseLabel, valueRequired);
          // comparison is TRUE
          codeStream.iconst_0();
          if ((this.bits & IsReturnedValue) != 0) {
            codeStream.generateImplicitConversion(this.implicitConversion);
            codeStream.generateReturnBytecode(this);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_1();
          } else {
            BranchLabel endLabel = new BranchLabel(codeStream);
            codeStream.goto_(endLabel);
            codeStream.decrStackSize(1);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_1();
            endLabel.place();
          }
        } else {
          this.left.generateCode(currentScope, codeStream, false);
          this.right.generateCode(currentScope, codeStream, false);
        }
        //				left.generateCode(currentScope, codeStream, false);
        //				right.generateCode(currentScope, codeStream, valueRequired);
        //				if (valueRequired) {
        //					codeStream.iconst_1();
        //					codeStream.ixor(); // negate
        //				}
      }
      return;
    }
    cst = this.right.optimizedBooleanConstant();
    if (cst != Constant.NotAConstant) {
      if (cst.booleanValue() == isEqualOperator) {
        // x == <something equivalent to true>, x != <something equivalent to false>
        this.left.generateCode(currentScope, codeStream, valueRequired);
        this.right.generateCode(currentScope, codeStream, false);
      } else {
        // x == <something equivalent to false>, x != <something equivalent to true>
        if (valueRequired) {
          BranchLabel falseLabel = new BranchLabel(codeStream);
          this.left.generateOptimizedBoolean(
              currentScope, codeStream, null, falseLabel, valueRequired);
          this.right.generateCode(currentScope, codeStream, false);
          // comparison is TRUE
          codeStream.iconst_0();
          if ((this.bits & IsReturnedValue) != 0) {
            codeStream.generateImplicitConversion(this.implicitConversion);
            codeStream.generateReturnBytecode(this);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_1();
          } else {
            BranchLabel endLabel = new BranchLabel(codeStream);
            codeStream.goto_(endLabel);
            codeStream.decrStackSize(1);
            // comparison is FALSE
            falseLabel.place();
            codeStream.iconst_1();
            endLabel.place();
          }
        } else {
          this.left.generateCode(currentScope, codeStream, false);
          this.right.generateCode(currentScope, codeStream, false);
        }
        //				left.generateCode(currentScope, codeStream, valueRequired);
        //				right.generateCode(currentScope, codeStream, false);
        //				if (valueRequired) {
        //					codeStream.iconst_1();
        //					codeStream.ixor(); // negate
        //				}
      }
      return;
    }
    // default case
    this.left.generateCode(currentScope, codeStream, valueRequired);
    this.right.generateCode(currentScope, codeStream, valueRequired);

    if (valueRequired) {
      if (isEqualOperator) {
        BranchLabel falseLabel;
        codeStream.if_icmpne(falseLabel = new BranchLabel(codeStream));
        // comparison is TRUE
        codeStream.iconst_1();
        if ((this.bits & IsReturnedValue) != 0) {
          codeStream.generateImplicitConversion(this.implicitConversion);
          codeStream.generateReturnBytecode(this);
          // comparison is FALSE
          falseLabel.place();
          codeStream.iconst_0();
        } else {
          BranchLabel endLabel = new BranchLabel(codeStream);
          codeStream.goto_(endLabel);
          codeStream.decrStackSize(1);
          // comparison is FALSE
          falseLabel.place();
          codeStream.iconst_0();
          endLabel.place();
        }
      } else {
        codeStream.ixor();
      }
    }
  }
 /**
  * Field reference code generation
  *
  * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
  * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
  * @param valueRequired boolean
  */
 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
   int pc = codeStream.position;
   if (this.constant != Constant.NotAConstant) {
     if (valueRequired) {
       codeStream.generateConstant(this.constant, this.implicitConversion);
     }
     codeStream.recordPositionsFrom(pc, this.sourceStart);
     return;
   }
   FieldBinding codegenBinding = this.binding.original();
   boolean isStatic = codegenBinding.isStatic();
   boolean isThisReceiver = this.receiver instanceof ThisReference;
   Constant fieldConstant = codegenBinding.constant();
   if (fieldConstant != Constant.NotAConstant) {
     if (!isThisReceiver) {
       this.receiver.generateCode(currentScope, codeStream, !isStatic);
       if (!isStatic) {
         codeStream.invokeObjectGetClass();
         codeStream.pop();
       }
     }
     if (valueRequired) {
       codeStream.generateConstant(fieldConstant, this.implicitConversion);
     }
     codeStream.recordPositionsFrom(pc, this.sourceStart);
     return;
   }
   if (valueRequired
       || (!isThisReceiver
           && currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4)
       || ((this.implicitConversion & TypeIds.UNBOXING) != 0)
       || (this.genericCast != null)) {
     this.receiver.generateCode(currentScope, codeStream, !isStatic);
     if ((this.bits & NeedReceiverGenericCast) != 0) {
       codeStream.checkcast(this.actualReceiverType);
     }
     pc = codeStream.position;
     if (codegenBinding.declaringClass == null) { // array length
       codeStream.arraylength();
       if (valueRequired) {
         codeStream.generateImplicitConversion(this.implicitConversion);
       } else {
         // could occur if !valueRequired but compliance >= 1.4
         codeStream.pop();
       }
     } else {
       if (this.syntheticAccessors == null
           || this.syntheticAccessors[FieldReference.READ] == null) {
         TypeBinding constantPoolDeclaringClass =
             CodeStream.getConstantPoolDeclaringClass(
                 currentScope,
                 codegenBinding,
                 this.actualReceiverType,
                 this.receiver.isImplicitThis());
         if (isStatic) {
           codeStream.fieldAccess(
               Opcodes.OPC_getstatic, codegenBinding, constantPoolDeclaringClass);
         } else {
           codeStream.fieldAccess(
               Opcodes.OPC_getfield, codegenBinding, constantPoolDeclaringClass);
         }
       } else {
         codeStream.invoke(
             Opcodes.OPC_invokestatic,
             this.syntheticAccessors[FieldReference.READ],
             null /* default declaringClass */);
       }
       // required cast must occur even if no value is required
       if (this.genericCast != null) codeStream.checkcast(this.genericCast);
       if (valueRequired) {
         codeStream.generateImplicitConversion(this.implicitConversion);
       } else {
         boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
         // conversion only generated if unboxing
         if (isUnboxing) codeStream.generateImplicitConversion(this.implicitConversion);
         switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.type.id) {
           case T_long:
           case T_double:
             codeStream.pop2();
             break;
           default:
             codeStream.pop();
         }
       }
     }
   } else {
     if (isThisReceiver) {
       if (isStatic) {
         // if no valueRequired, still need possible side-effects of <clinit> invocation, if field
         // belongs to different class
         if (this.binding.original().declaringClass != this.actualReceiverType.erasure()) {
           MethodBinding accessor =
               this.syntheticAccessors == null
                   ? null
                   : this.syntheticAccessors[FieldReference.READ];
           if (accessor == null) {
             TypeBinding constantPoolDeclaringClass =
                 CodeStream.getConstantPoolDeclaringClass(
                     currentScope,
                     codegenBinding,
                     this.actualReceiverType,
                     this.receiver.isImplicitThis());
             codeStream.fieldAccess(
                 Opcodes.OPC_getstatic, codegenBinding, constantPoolDeclaringClass);
           } else {
             codeStream.invoke(
                 Opcodes.OPC_invokestatic, accessor, null /* default declaringClass */);
           }
           switch (codegenBinding.type.id) {
             case T_long:
             case T_double:
               codeStream.pop2();
               break;
             default:
               codeStream.pop();
           }
         }
       }
     } else {
       this.receiver.generateCode(currentScope, codeStream, !isStatic);
       if (!isStatic) {
         codeStream.invokeObjectGetClass(); // perform null check
         codeStream.pop();
       }
     }
   }
   codeStream.recordPositionsFrom(pc, this.sourceEnd);
 }
Esempio n. 17
0
 /**
  * MessageSend code generation
  *
  * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
  * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
  * @param valueRequired boolean
  */
 public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
   int pc = codeStream.position;
   // generate receiver/enclosing instance access
   MethodBinding codegenBinding =
       this.binding instanceof PolymorphicMethodBinding ? this.binding : this.binding.original();
   boolean isStatic = codegenBinding.isStatic();
   if (isStatic) {
     this.receiver.generateCode(currentScope, codeStream, false);
   } else if ((this.bits & ASTNode.DepthMASK) != 0
       && this.receiver.isImplicitThis()) { // outer access ?
     // outer method can be reached through emulation if implicit access
     ReferenceBinding targetType =
         currentScope
             .enclosingSourceType()
             .enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
     Object[] path =
         currentScope.getEmulationPath(
             targetType, true /*only exact match*/, false /*consider enclosing arg*/);
     codeStream.generateOuterAccess(path, this, targetType, currentScope);
   } else {
     this.receiver.generateCode(currentScope, codeStream, true);
     if ((this.bits & NeedReceiverGenericCast) != 0) {
       codeStream.checkcast(this.actualReceiverType);
     }
   }
   codeStream.recordPositionsFrom(pc, this.sourceStart);
   // generate arguments
   generateArguments(this.binding, this.arguments, currentScope, codeStream);
   pc = codeStream.position;
   // actual message invocation
   if (this.syntheticAccessor == null) {
     TypeBinding constantPoolDeclaringClass =
         CodeStream.getConstantPoolDeclaringClass(
             currentScope,
             codegenBinding,
             this.actualReceiverType,
             this.receiver.isImplicitThis());
     if (isStatic) {
       codeStream.invoke(Opcodes.OPC_invokestatic, codegenBinding, constantPoolDeclaringClass);
     } else if ((this.receiver.isSuper()) || codegenBinding.isPrivate()) {
       codeStream.invoke(Opcodes.OPC_invokespecial, codegenBinding, constantPoolDeclaringClass);
     } else if (constantPoolDeclaringClass.isInterface()) { // interface or annotation type
       codeStream.invoke(Opcodes.OPC_invokeinterface, codegenBinding, constantPoolDeclaringClass);
     } else {
       codeStream.invoke(Opcodes.OPC_invokevirtual, codegenBinding, constantPoolDeclaringClass);
     }
   } else {
     codeStream.invoke(
         Opcodes.OPC_invokestatic, this.syntheticAccessor, null /* default declaringClass */);
   }
   // required cast must occur even if no value is required
   if (this.valueCast != null) codeStream.checkcast(this.valueCast);
   if (valueRequired) {
     // implicit conversion if necessary
     codeStream.generateImplicitConversion(this.implicitConversion);
   } else {
     boolean isUnboxing = (this.implicitConversion & TypeIds.UNBOXING) != 0;
     // conversion only generated if unboxing
     if (isUnboxing) codeStream.generateImplicitConversion(this.implicitConversion);
     switch (isUnboxing ? postConversionType(currentScope).id : codegenBinding.returnType.id) {
       case T_long:
       case T_double:
         codeStream.pop2();
         break;
       case T_void:
         break;
       default:
         codeStream.pop();
     }
   }
   codeStream.recordPositionsFrom(
       pc, (int) (this.nameSourcePosition >>> 32)); // highlight selector
 }