当前位置: 首页>>代码示例>>Java>>正文


Java ProfiledType类代码示例

本文整理汇总了Java中jdk.vm.ci.meta.JavaTypeProfile.ProfiledType的典型用法代码示例。如果您正苦于以下问题:Java ProfiledType类的具体用法?Java ProfiledType怎么用?Java ProfiledType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProfiledType类属于jdk.vm.ci.meta.JavaTypeProfile包,在下文中一共展示了ProfiledType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: adjustProfileForInvocationPlugin

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
/**
 * Adjusts the profile for an indirect invocation of a virtual method for which there is an
 * intrinsic. The adjustment made by this method is to remove all types from the profile that do
 * not override {@code targetMethod}.
 *
 * @param profile the profile to adjust
 * @param targetMethod the virtual method for which there is an intrinsic
 * @return the adjusted profile or the original {@code profile} object if no adjustment was made
 */
protected JavaTypeProfile adjustProfileForInvocationPlugin(JavaTypeProfile profile, ResolvedJavaMethod targetMethod) {
    if (profile.getTypes().length > 0) {
        List<ProfiledType> retained = new ArrayList<>();
        double notRecordedProbability = profile.getNotRecordedProbability();
        for (ProfiledType ptype : profile.getTypes()) {
            if (!ptype.getType().resolveMethod(targetMethod, method.getDeclaringClass()).equals(targetMethod)) {
                retained.add(ptype);
            } else {
                notRecordedProbability += ptype.getProbability();
            }
        }
        if (!retained.isEmpty()) {
            if (retained.size() != profile.getTypes().length) {
                return new JavaTypeProfile(profile.getNullSeen(), notRecordedProbability, retained.toArray(new ProfiledType[retained.size()]));
            }
        } else {
            return new JavaTypeProfile(profile.getNullSeen(), notRecordedProbability, new ProfiledType[0]);
        }
    }
    return profile;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:BytecodeParser.java

示例2: restrict

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
public JavaTypeProfile restrict(JavaTypeProfile otherProfile) {
    if (otherProfile.getNotRecordedProbability() > 0.0) {
        // Not useful for restricting since there is an unknown set of types occurring.
        return this;
    }

    if (this.getNotRecordedProbability() > 0.0) {
        // We are unrestricted, so the other profile is always a better estimate.
        return otherProfile;
    }

    ArrayList<ProfiledType> result = new ArrayList<>();
    for (int i = 0; i < getItems().length; i++) {
        ProfiledType ptype = getItems()[i];
        ResolvedJavaType type = ptype.getItem();
        if (otherProfile.isIncluded(type)) {
            result.add(ptype);
        }
    }

    TriState newNullSeen = (otherProfile.getNullSeen() == TriState.FALSE) ? TriState.FALSE : getNullSeen();
    double newNotRecorded = getNotRecordedProbability();
    return createAdjustedProfile(result, newNullSeen, newNotRecorded);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:JavaTypeProfile.java

示例3: MultiTypeGuardInlineInfo

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
public MultiTypeGuardInlineInfo(Invoke invoke, ArrayList<ResolvedJavaMethod> concretes, ArrayList<ProfiledType> ptypes, ArrayList<Integer> typesToConcretes, double notRecordedTypeProbability) {
    super(invoke);
    assert concretes.size() > 0 : "must have at least one method";
    assert ptypes.size() == typesToConcretes.size() : "array lengths must match";

    this.concretes = concretes;
    this.ptypes = ptypes;
    this.typesToConcretes = typesToConcretes;
    this.notRecordedTypeProbability = notRecordedTypeProbability;
    this.inlineableElements = new Inlineable[concretes.size()];
    this.methodProbabilities = computeMethodProbabilities();
    this.maximumMethodProbability = maximumMethodProbability();
    assert maximumMethodProbability > 0;
    assert assertUniqueTypes(ptypes);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:MultiTypeGuardInlineInfo.java

示例4: assertUniqueTypes

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
private static boolean assertUniqueTypes(ArrayList<ProfiledType> ptypes) {
    EconomicSet<ResolvedJavaType> set = EconomicSet.create(Equivalence.DEFAULT);
    for (ProfiledType ptype : ptypes) {
        set.add(ptype.getType());
    }
    return set.size() == ptypes.size();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:MultiTypeGuardInlineInfo.java

示例5: profile

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
protected JavaTypeProfile profile(TriState nullSeen, Class<?>... types) {
    if (types.length == 0) {
        return null;
    }
    ProfiledType[] ptypes = new ProfiledType[types.length];
    for (int i = 0; i < types.length; i++) {
        ptypes[i] = new ProfiledType(getMetaAccess().lookupJavaType(types[i]), 1.0D / types.length);
    }
    return new JavaTypeProfile(nullSeen, 0.0D, ptypes);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TypeCheckTest.java

示例6: makeHints

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
private static Hint[] makeHints(TypeReference targetType, JavaTypeProfile profile, double minHintHitProbability, int maxHints, Double[] hitProbability) {
    double hitProb = 0.0d;
    Hint[] hintsBuf = NO_HINTS;
    if (profile != null) {
        double notRecordedTypes = profile.getNotRecordedProbability();
        ProfiledType[] ptypes = profile.getTypes();
        if (notRecordedTypes < (1D - minHintHitProbability) && ptypes != null && ptypes.length > 0) {
            hintsBuf = new Hint[ptypes.length];
            int hintCount = 0;
            for (ProfiledType ptype : ptypes) {
                if (targetType != null) {
                    ResolvedJavaType hintType = ptype.getType();
                    hintsBuf[hintCount++] = new Hint(hintType, targetType.getType().isAssignableFrom(hintType));
                    hitProb += ptype.getProbability();
                }
                if (hintCount == maxHints) {
                    break;
                }
            }
            if (hitProb >= minHintHitProbability) {
                if (hintsBuf.length != hintCount || hintCount > maxHints) {
                    hintsBuf = Arrays.copyOf(hintsBuf, Math.min(maxHints, hintCount));
                }
            } else {
                hintsBuf = NO_HINTS;
                hitProb = 0.0d;
            }
        }
    }
    hitProbability[0] = hitProb;
    return hintsBuf;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:TypeCheckHints.java

示例7: createAdjustedProfile

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
private JavaTypeProfile createAdjustedProfile(ArrayList<ProfiledType> result, TriState newNullSeen, double newNotRecorded) {
    if (result.size() != this.getItems().length || newNotRecorded != getNotRecordedProbability() || newNullSeen != getNullSeen()) {
        if (result.size() == 0) {
            return new JavaTypeProfile(newNullSeen, 1.0, EMPTY_ARRAY);
        }
        double factor;
        if (result.size() == this.getItems().length) {
            /* List of types did not change, no need to recompute probabilities. */
            factor = 1.0;
        } else {
            double probabilitySum = 0.0;
            for (int i = 0; i < result.size(); i++) {
                probabilitySum += result.get(i).getProbability();
            }
            probabilitySum += newNotRecorded;

            factor = 1.0 / probabilitySum; // Normalize to 1.0
            assert factor >= 1.0;
        }
        ProfiledType[] newResult = new ProfiledType[result.size()];
        for (int i = 0; i < newResult.length; ++i) {
            ProfiledType curType = result.get(i);
            newResult[i] = new ProfiledType(curType.getItem(), Math.min(1.0, curType.getProbability() * factor));
        }
        double newNotRecordedTypeProbability = Math.min(1.0, newNotRecorded * factor);
        return new JavaTypeProfile(newNullSeen, newNotRecordedTypeProbability, newResult);
    }
    return this;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:JavaTypeProfile.java

示例8: toString

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
@Override
public String toString() {
    StringBuilder buf = new StringBuilder("JavaTypeProfile<nullSeen=").append(getNullSeen()).append(", types=[");
    for (int j = 0; j < getTypes().length; j++) {
        if (j != 0) {
            buf.append(", ");
        }
        ProfiledType ptype = getTypes()[j];
        buf.append(String.format("%.6f:%s", ptype.getProbability(), ptype.getType()));
    }
    return buf.append(String.format("], notRecorded:%.6f>", getNotRecordedProbability())).toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:JavaTypeProfile.java

示例9: JavaTypeProfile

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
public JavaTypeProfile(TriState nullSeen, double notRecordedProbability, ProfiledType[] pitems) {
    super(notRecordedProbability, pitems);
    this.nullSeen = nullSeen;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:JavaTypeProfile.java

示例10: ProfiledType

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
public ProfiledType(ResolvedJavaType type, double probability) {
    super(type, probability);
    assert type.isArray() || type.isConcrete() : type;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:JavaTypeProfile.java

示例11: getTypes

import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; //导入依赖的package包/类
/**
 * A list of types for which the runtime has recorded probability information. Note that this
 * includes both positive and negative types where a positive type is a subtype of the checked
 * type and a negative type is not.
 */
public ProfiledType[] getTypes() {
    return getItems();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:JavaTypeProfile.java


注:本文中的jdk.vm.ci.meta.JavaTypeProfile.ProfiledType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。