congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Constant
Code IndexAdd Tabnine to your IDE (free)

How to use
Constant
in
io.airlift.bytecode.instruction

Best Java code snippets using io.airlift.bytecode.instruction.Constant (Showing top 20 results out of 315)

origin: prestodb/presto

block.append(loadBoolean((Boolean) value));
block.append(loadInt(((Number) value).intValue()));
block.append(loadLong((Long) value));
block.append(loadFloat((Float) value));
block.append(loadDouble((Double) value));
block.append(loadString((String) value));
origin: io.airlift/bytecode

public static Constant loadNumber(Number value)
{
  requireNonNull(value, "value is null");
  if (value instanceof Byte) {
    return loadInt((value).intValue());
  }
  if (value instanceof Short) {
    return loadInt((value).intValue());
  }
  if (value instanceof Integer) {
    return loadInt((Integer) value);
  }
  if (value instanceof Long) {
    return loadLong((Long) value);
  }
  if (value instanceof Float) {
    return loadFloat((Float) value);
  }
  if (value instanceof Double) {
    return loadDouble((Double) value);
  }
  throw new IllegalStateException("Unsupported number type " + value.getClass().getSimpleName());
}
origin: prestodb/presto

  @Override
  public BytecodeNode generateExpression(Signature signature, BytecodeGeneratorContext generatorContext, Type returnType, List<RowExpression> arguments, Optional<Variable> outputBlockVariable)
  {
    Preconditions.checkArgument(arguments.size() == 1);

    RowExpression argument = arguments.get(0);
    if (argument.getType().equals(UNKNOWN)) {
      return loadBoolean(true);
    }

    BytecodeNode value = generatorContext.generate(argument, Optional.empty());

    // evaluate the expression, pop the produced value, and load the null flag
    Variable wasNull = generatorContext.wasNull();
    BytecodeBlock block = new BytecodeBlock()
        .comment("is null")
        .append(value)
        .pop(argument.getType().getJavaType())
        .append(wasNull);

    // clear the null flag
    block.append(wasNull.set(constantFalse()));

    outputBlockVariable.ifPresent(output -> block.append(generateWrite(generatorContext, returnType, output)));
    return block;
  }
}
origin: io.airlift/bytecode

public BytecodeBlock push(int value)
{
  nodes.add(loadInt(value));
  return this;
}
origin: io.airlift/bytecode

public BytecodeBlock push(String value)
{
  nodes.add(Constant.loadString(value));
  return this;
}
origin: io.airlift/bytecode

public static BytecodeExpression constantFloat(float value)
{
  return new ConstantBytecodeExpression(float.class, loadFloat(value));
}
origin: io.airlift/bytecode

public static BytecodeExpression constantDouble(double value)
{
  return new ConstantBytecodeExpression(double.class, loadDouble(value));
}
origin: io.airlift/bytecode

public static BytecodeExpression constantLong(long value)
{
  return new ConstantBytecodeExpression(long.class, loadLong(value));
}
origin: io.airlift/bytecode

public BytecodeBlock push(Class<?> type)
{
  nodes.add(loadClass(type));
  return this;
}
origin: io.airlift/bytecode

@Override
public void accept(MethodVisitor visitor, MethodGenerationContext generationContext)
{
  loadDouble(value).accept(visitor, generationContext);
  invokeStatic(Double.class, "valueOf", Double.class, double.class).accept(visitor, generationContext);
}
origin: io.airlift/bytecode

@Override
public String toString()
{
  return toStringHelper(this)
      .add("value", getValue())
      .toString();
}
origin: io.airlift/bytecode

  case 'C':
  case 'I':
    nodes.add(loadInt(0));
    break;
  case 'F':
    nodes.add(loadFloat(0));
    break;
  case 'D':
    nodes.add(loadDouble(0));
    break;
  case 'J':
    nodes.add(loadLong(0));
    break;
  default:
nodes.add(Constant.loadNull());
origin: io.airlift/bytecode

public BytecodeBlock push(boolean value)
{
  nodes.add(loadBoolean(value));
  return this;
}
origin: io.airlift/bytecode

public BytecodeBlock putVariable(Variable variable, int value)
{
  nodes.add(loadInt(value));
  putVariable(variable);
  return this;
}
origin: io.airlift/bytecode

public static BytecodeExpression constantString(String value)
{
  return new ConstantBytecodeExpression(String.class, loadString(value));
}
origin: io.airlift/bytecode

public BytecodeBlock push(ParameterizedType type)
{
  nodes.add(loadClass(type));
  return this;
}
origin: io.airlift/bytecode

@Override
public void accept(MethodVisitor visitor, MethodGenerationContext generationContext)
{
  loadInt(value).accept(visitor, generationContext);
  invokeStatic(Integer.class, "valueOf", Integer.class, int.class).accept(visitor, generationContext);
}
origin: io.airlift/bytecode

@Override
protected String formatOneLine()
{
  return renderConstant(value.getValue());
}
origin: prestosql/presto

return block.append(loadBoolean((Boolean) value));
return block.append(loadInt(((Number) value).intValue()));
return block.append(loadLong((Long) value));
return block.append(loadFloat((Float) value));
return block.append(loadDouble((Double) value));
return block.append(loadString((String) value));
origin: io.airlift/bytecode

public BytecodeBlock putVariable(Variable variable, boolean value)
{
  nodes.add(loadBoolean(value));
  putVariable(variable);
  return this;
}
io.airlift.bytecode.instructionConstant

Most used methods

  • loadBoolean
  • loadDouble
  • loadFloat
  • loadInt
  • loadLong
  • loadString
  • accept
  • getValue
  • loadClass
  • loadNull
  • loadNumber
  • loadNumber

Popular in Java

  • Parsing JSON documents to java classes using gson
  • findViewById (Activity)
  • putExtra (Intent)
  • setRequestProperty (URLConnection)
  • Kernel (java.awt.image)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JLabel (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now