Search in sources :

Example 1 with ConstantPool

use of org.wso2.ballerinalang.programfile.cpentries.ConstantPool in project ballerina by ballerina-lang.

the class CodeGenerator method addVarCountAttrInfo.

private void addVarCountAttrInfo(ConstantPool constantPool, AttributeInfoPool attributeInfoPool, VariableIndex fieldCount) {
    int attrNameCPIndex = addUTF8CPEntry(constantPool, AttributeInfo.Kind.VARIABLE_TYPE_COUNT_ATTRIBUTE.value());
    VarTypeCountAttributeInfo varCountAttribInfo = new VarTypeCountAttributeInfo(attrNameCPIndex);
    varCountAttribInfo.setMaxLongVars(fieldCount.tInt);
    varCountAttribInfo.setMaxDoubleVars(fieldCount.tFloat);
    varCountAttribInfo.setMaxStringVars(fieldCount.tString);
    varCountAttribInfo.setMaxIntVars(fieldCount.tBoolean);
    varCountAttribInfo.setMaxByteVars(fieldCount.tBlob);
    varCountAttribInfo.setMaxRefVars(fieldCount.tRef);
    attributeInfoPool.addAttributeInfo(AttributeInfo.Kind.VARIABLE_TYPE_COUNT_ATTRIBUTE, varCountAttribInfo);
}
Also used : VarTypeCountAttributeInfo(org.wso2.ballerinalang.programfile.attributes.VarTypeCountAttributeInfo) BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Example 2 with ConstantPool

use of org.wso2.ballerinalang.programfile.cpentries.ConstantPool in project ballerina by ballerina-lang.

the class CodeGenerator method addPackageRefCPEntry.

private int addPackageRefCPEntry(ConstantPool pool, PackageID pkgID) {
    int nameCPIndex = addUTF8CPEntry(pool, pkgID.bvmAlias());
    int versionCPIndex = addUTF8CPEntry(pool, pkgID.version.value);
    PackageRefCPEntry packageRefCPEntry = new PackageRefCPEntry(nameCPIndex, versionCPIndex);
    return pool.addCPEntry(packageRefCPEntry);
}
Also used : PackageRefCPEntry(org.wso2.ballerinalang.programfile.cpentries.PackageRefCPEntry) BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Example 3 with ConstantPool

use of org.wso2.ballerinalang.programfile.cpentries.ConstantPool in project ballerina by ballerina-lang.

the class CodeGenerator method addVariableCountAttributeInfo.

private void addVariableCountAttributeInfo(ConstantPool constantPool, AttributeInfoPool attributeInfoPool, int[] fieldCount) {
    UTF8CPEntry attribNameCPEntry = new UTF8CPEntry(AttributeInfo.Kind.VARIABLE_TYPE_COUNT_ATTRIBUTE.toString());
    int attribNameCPIndex = constantPool.addCPEntry(attribNameCPEntry);
    VarTypeCountAttributeInfo varCountAttribInfo = new VarTypeCountAttributeInfo(attribNameCPIndex);
    varCountAttribInfo.setMaxLongVars(fieldCount[INT_OFFSET]);
    varCountAttribInfo.setMaxDoubleVars(fieldCount[FLOAT_OFFSET]);
    varCountAttribInfo.setMaxStringVars(fieldCount[STRING_OFFSET]);
    varCountAttribInfo.setMaxIntVars(fieldCount[BOOL_OFFSET]);
    varCountAttribInfo.setMaxByteVars(fieldCount[BLOB_OFFSET]);
    varCountAttribInfo.setMaxRefVars(fieldCount[REF_OFFSET]);
    attributeInfoPool.addAttributeInfo(AttributeInfo.Kind.VARIABLE_TYPE_COUNT_ATTRIBUTE, varCountAttribInfo);
}
Also used : VarTypeCountAttributeInfo(org.wso2.ballerinalang.programfile.attributes.VarTypeCountAttributeInfo) UTF8CPEntry(org.wso2.ballerinalang.programfile.cpentries.UTF8CPEntry) BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Aggregations

BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)3 VarTypeCountAttributeInfo (org.wso2.ballerinalang.programfile.attributes.VarTypeCountAttributeInfo)2 PackageRefCPEntry (org.wso2.ballerinalang.programfile.cpentries.PackageRefCPEntry)1 UTF8CPEntry (org.wso2.ballerinalang.programfile.cpentries.UTF8CPEntry)1