Package anvil.codec

Examples of anvil.codec.ConstantPool


  {
   
    public void compile(ByteCompiler context, int operation)
    {
      Code code = context.getCode();
      ConstantPool pool = code.getPool();
      code.aload(_framelocal);
    }
View Full Code Here



  public void compile(ByteCompiler context, int operation)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    int clazz = pool.addClass("anvil/core/Array");
    code.anew(clazz);
    code.dup();
    code.invokespecial(pool.addMethodRef(clazz, "<init>", "()V"));
    int append1 = pool.addMethodRef(clazz, "append",
          "(Lanvil/core/Any;)Lanvil/core/Array;");
    int append2 = pool.addMethodRef(clazz, "append",
          "(Lanvil/core/Any;Lanvil/core/Any;)Lanvil/core/Array;");
    int n = childs();
    for(int i=0; i<n; i++) {
      Node node = getChild(i);
      if (node.typeOf() == Node.EXPR_MAPPING) {
View Full Code Here


  public void compile(ByteCompiler context, Node child)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    context.accessInstance(_context, _target);
    child.compile(context, GET);
    code.dup_x1();
    code.putfield(_member.getTypeRef(pool));
  }
View Full Code Here


  public void compile(ByteCompiler context, int operation)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    switch(operation) {
    case GET:
      context.accessInstance(_context, _target);
      code.getfield(_member.getTypeRef(pool));
      break;
View Full Code Here


  public void compile(ByteCompiler context, int operation)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    int clazz = pool.addClass("anvil/core/AnyMap");
    code.anew(clazz);
    code.dup();
    super.compile(context, GET);
    code.invokespecial(pool.addMethodRef(clazz, "<init>",
      "(Lanvil/core/Any;Lanvil/core/Any;)V"));
    if (operation == GET_BOOLEAN) {
      context.any2boolean();
    }
  }
View Full Code Here

 

  public void compile(ByteCompiler context)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    code.aload_first();
    FunctionStatement function = getFunctionStatement();
    if (function.isGenerator()) {
      code.aload(function.getFrameIndex());
      code.invokevirtual(pool.addMethodRef("anvil/script/Generator", "setClosedState", "()V"));
    }
    _expression.compile(context, Expression.GET);
    code.invokevirtual(pool.addMethodRef(context.TYPE_CONTEXT,
      "exception", "(Lanvil/core/Any;)Lanvil/script/ScriptException;"));
    code.athrow();
 
View Full Code Here

  }


  public void compile(Code code)
  {
    ConstantPool pool = code.getPool();
    int clazz = pool.addClass("anvil/doc/Doc");
    code.anew(clazz);
    code.dup();
    code.iconst(_type);
    code.astring(_ident);
    code.astring(_text);
    if (_head != null) {
      code.iconst(getChildCount());
      code.anewarray(clazz);
      Doc p = _head;
      int i = 0;
      while (p != null) {
        code.dup();
        code.iconst(i++);
        p.compile(code);
        p = p._next;
        code.aastore();
      }
    } else {
      code.aconst_null();
    }
    code.invokespecial(pool.addMethodRef(clazz, "<init>", "(ILjava/lang/String;Ljava/lang/String;[Lanvil/doc/Doc;)V"));
  }
View Full Code Here


  public void compile(ByteCompiler context, int operation)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    int clazz = pool.addClass("anvil/core/AnyRange");
    code.anew(clazz);
    code.dup();
    super.compile(context, GET);
    code.invokespecial(pool.addMethodRef(clazz, "<init>",
      "(Lanvil/core/Any;Lanvil/core/Any;)V"));
    if (operation == GET_BOOLEAN) {
      context.any2boolean();
    }
  }
View Full Code Here

  }

  public void compile(ByteCompiler context, ExceptionHandler handler, int l_data)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    DataNode datanode = new DataNode(l_data);
   
    if (_types != null) {
      Source istrue = code.getSource();
      Source isfalse = null;
     
      int n = _types.childs();

      boolean assigned = false;
      for(int i=0; i<n; i++) {
        if (_types.getChild(i).typeOf() != Node.EXPR_TYPE) {
          _assignment.compile(context, datanode);
          code.pop();
          assigned = true;
        }
      }

      for(int i=0; i<n; i++) {
        if (isfalse != null) {
          isfalse.bind();
        }
        Node child = _types.getChild(i);
        if (child.typeOf() == Node.EXPR_TYPE) {
          code.aload(l_data);
          child.compile(context, Node.GET_TYPE);
          code.invokevirtual(pool.addMethodRef(context.TYPE_ANY, "isInstanceOf", "(Lanvil/script/Type;)Z"));
        } else {
          child.compile(context, Node.GET_BOOLEAN);
        }
        isfalse = code.if_eq();
        code.go_to(istrue);
View Full Code Here


  public void compile(ByteCompiler context, Node child)
  {
    Code code = context.getCode();
    ConstantPool pool = code.getPool();
    if (_local.isEscaped()) {
      code.aload(_local.getFrameIndex());
      code.iconst(_local.getSlot());
      child.compile(context, GET);
      code.invokevirtual(code.getPool().addMethodRef("anvil/script/StackFrame",
View Full Code Here

TOP

Related Classes of anvil.codec.ConstantPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.