Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ConstantPool


   public void storeConstants (RecordTable<ConstantRecord> aConstantTable,
      RecordTable<ConstantValue> aConstantValues) throws TinyVMException
   {
      // _logger.log(Level.INFO, "Processing other constants in " + iName);

      ConstantPool pPool = iCF.getConstantPool();
      Constant[] constants = pPool.getConstantPool();
      for (int i = 0; i < constants.length; i++)
      {
         Constant pEntry = constants[i];
         if (pEntry instanceof ConstantString
            || pEntry instanceof ConstantDouble
View Full Code Here


    printC2Image();
    System.out.printf("into   %s\n", singleFile?new File(HaikuDefs.getProperty("APP_BASE")+"/"+Haikufy.choice("haikuJava")+"/haikuJava.c"):cf.getCanonicalPath());
    Verbose.println();
   
   
    ConstantPool cp=jc.getConstantPool();
    Constant[] c=cp.getConstantPool();
    for (int i=0; i< c.length; i++) {
      if (c[i]==null) continue;
      if (c[i].getTag()==Constants.CONSTANT_Class) {
        ConstantClass cc= (ConstantClass)c[i];
        String classname=cc.getBytes(cp);
View Full Code Here

    outc.println("*/");
    outc.println();
    outc.println();
    includes(outc);

    ConstantPool cp=jc.getConstantPool();
    Constant[] cons=cp.getConstantPool();
    Set<String> incSet=new HashSet<String>();
    for (int i=0; i< cons.length; i++) {
      if (cons[i]==null) continue;
      if (cons[i].getTag()==Constants.CONSTANT_Class) {
        ConstantClass cc= (ConstantClass)cons[i];
View Full Code Here

    outh.printf("\n");
    outc.printf("};\n");

   
    CodeException[] et = code.getExceptionTable();
    ConstantPool cp=jc.getConstantPool();
    Constant[] cons=cp.getConstantPool();

    for (int i = 0; i < et.length; i++) {
      int ct=et[i].getCatchType();
      String ex;
      if (ct==0) {
        ex="&java_lang_Object__class";
      } else {
        ex="&"+mangle(cp.constantToString(ct, Constants.CONSTANT_Class))+"__class";
      }
      //Haikout.println(ex);
      exceptionTable+="\t{&"+methodName+".op"+et[i].getStartPC()+", &"+methodName+".op"+et[i].getEndPC()+", &"+methodName+".op"+et[i].getHandlerPC()+", "+ex+"},\n";
    }
  }
View Full Code Here

    }
    return new Formatter().format("%-70s // %s", ccode+";", jcode).toString();
  }
 
  private String getConstExt(int i) {
    ConstantPool cp=jc.getConstantPool();
    Constant[] cons=cp.getConstantPool();
    int tag=cons[i].getTag();
    switch (tag) {
    case Constants.CONSTANT_String:
      return "S";
    case Constants.CONSTANT_Float:
View Full Code Here

      return ""; // Error
    }
  }

  private String getConstSpec(int i, int constrain) {
    ConstantPool cp=jc.getConstantPool();
    Constant[] cons=cp.getConstantPool();
    int tag=cons[i].getTag();
    String value, key;
        switch (tag) {
        case Constants.CONSTANT_String:
        value=escape(((ConstantUtf8)cons[((ConstantString)cons[i]).getStringIndex()]).getBytes());
View Full Code Here

    }
  }

    private void collectExceptions(JavaClass jc, Code code, String level) {
    CodeException[] et = code.getExceptionTable();
    ConstantPool cp=jc.getConstantPool();

    for (int i = 0; i < et.length; i++) {
      int ct=et[i].getCatchType();
      if (ct==0) {
      } else {
        String ex=cp.constantToString(ct, Constants.CONSTANT_Class);
        if (!contains(ex))
          try {
            new Closure(new Reason(ex, classname+": exception closure")).collectClass(level+"  ");
          } catch (IOException e) {
            e.printStackTrace();
View Full Code Here

    Verbose.printf("  into %s\n", cf.getPath());
    if (cf.getParentFile()!=null) cf.getParentFile().mkdirs();
    printJ2C();
   
   
    ConstantPool cp=jc.getConstantPool();
    Constant[] c=cp.getConstantPool();
    for (int i=0; i< c.length; i++) {
      if (c[i]==null) continue;
      if (c[i].getTag()==Constants.CONSTANT_Class) {
        ConstantClass cc= (ConstantClass)c[i];
        Compile2C jp=new Compile2C(cc.getBytes(cp));
View Full Code Here

    outc.println("*/");
    outc.println();
    outc.println();
    includes(outc);
 
    ConstantPool cp=jc.getConstantPool();
    Constant[] c=cp.getConstantPool();
    for (int i=0; i< c.length; i++) {
      if (c[i]==null) continue;
      if (c[i].getTag()==Constants.CONSTANT_Class) {
        ConstantClass cc= (ConstantClass)c[i];
        String include=cc.getBytes(cp);
View Full Code Here

    /**
     * @return intermediate constant pool
     */
    public ConstantPool getConstantPool() {
        return new ConstantPool(constants);
    }
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.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.