本文整理汇总了Java中jdk.vm.ci.code.site.Site类的典型用法代码示例。如果您正苦于以下问题:Java Site类的具体用法?Java Site怎么用?Java Site使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Site类属于jdk.vm.ci.code.site包,在下文中一共展示了Site类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HotSpotCompiledCode
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `sites`, `targetCode`, `comments`, `methods`, `dataSection`, `dataSectionPatches` and `assumptions`")
public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot) {
this.name = name;
this.targetCode = targetCode;
this.targetCodeSize = targetCodeSize;
this.sites = sites;
this.assumptions = assumptions;
this.methods = methods;
this.comments = comments;
this.dataSection = dataSection;
this.dataSectionAlignment = dataSectionAlignment;
this.dataSectionPatches = dataSectionPatches;
this.isImmutablePIC = isImmutablePIC;
this.totalFrameSize = totalFrameSize;
this.deoptRescueSlot = deoptRescueSlot;
assert validateFrames();
}
示例2: HotSpotCompiledCode
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot) {
this.name = name;
this.targetCode = targetCode;
this.targetCodeSize = targetCodeSize;
this.sites = sites;
this.assumptions = assumptions;
this.methods = methods;
this.comments = comments;
this.dataSection = dataSection;
this.dataSectionAlignment = dataSectionAlignment;
this.dataSectionPatches = dataSectionPatches;
this.isImmutablePIC = isImmutablePIC;
this.totalFrameSize = totalFrameSize;
this.deoptRescueSlot = deoptRescueSlot;
assert validateFrames();
}
示例3: hasMark
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
boolean hasMark(Site call, MarkId id) {
for (Mark m : compilationResult.getMarks()) {
// TODO: X64-specific code.
// Call instructions are aligned to 8
// bytes - 1 on x86 to patch address atomically,
int adjOffset = (m.pcOffset & (-8)) + 7;
// Mark points before aligning nops.
if ((call.pcOffset == adjOffset) && MarkId.getEnum((int) m.id) == id) {
return true;
}
}
return false;
}
示例4: compare
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@Override
public int compare(Site s1, Site s2) {
if (s1.pcOffset == s2.pcOffset) {
// Marks must come first since patching a call site
// may need to know the mark denoting the call type
// (see uses of CodeInstaller::_next_call_type).
boolean s1IsMark = s1 instanceof Mark;
boolean s2IsMark = s2 instanceof Mark;
if (s1IsMark != s2IsMark) {
return s1IsMark ? -1 : 1;
}
// Infopoints must group together so put them after
// other Site types.
boolean s1IsInfopoint = s1 instanceof Infopoint;
boolean s2IsInfopoint = s2 instanceof Infopoint;
if (s1IsInfopoint != s2IsInfopoint) {
return s1IsInfopoint ? 1 : -1;
}
if (s1IsInfopoint) {
sawCollidingInfopoints = true;
return checkCollision((Infopoint) s1, (Infopoint) s2);
}
}
return s1.pcOffset - s2.pcOffset;
}
示例5: HotSpotCompiledNmethod
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
public HotSpotCompiledNmethod(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot, HotSpotResolvedJavaMethod method, int entryBCI,
int id, long jvmciEnv, boolean hasUnsafeAccess) {
super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC, totalFrameSize, deoptRescueSlot);
this.method = method;
this.entryBCI = entryBCI;
this.id = id;
this.jvmciEnv = jvmciEnv;
this.hasUnsafeAccess = hasUnsafeAccess;
}
示例6: finish
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
public HotSpotCompiledCode finish(HotSpotResolvedJavaMethod method) {
int id = method.allocateCompileId(0);
byte[] finishedCode = code.finish();
Site[] finishedSites = sites.toArray(new Site[0]);
byte[] finishedData = data.finish();
DataPatch[] finishedDataPatches = dataPatches.toArray(new DataPatch[0]);
return new HotSpotCompiledNmethod(method.getName(), finishedCode, finishedCode.length, finishedSites, new Assumption[0], new ResolvedJavaMethod[]{method}, new Comment[0], finishedData, 16,
finishedDataPatches, false, frameSize, deoptRescue, method, 0, id, 0L, false);
}
示例7: compareSites
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
public static int compareSites(Site s1, Site s2) {
if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) {
return s1 instanceof Mark ? -1 : 1;
}
return s1.pcOffset - s2.pcOffset;
}
示例8: createCompiledCode
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
public static HotSpotCompiledCode createCompiledCode(CodeCacheProvider codeCache, ResolvedJavaMethod method, HotSpotCompilationRequest compRequest, CompilationResult compResult) {
String name = compResult.getName();
byte[] targetCode = compResult.getTargetCode();
int targetCodeSize = compResult.getTargetCodeSize();
Site[] sites = getSortedSites(codeCache, compResult);
Assumption[] assumptions = compResult.getAssumptions();
ResolvedJavaMethod[] methods = compResult.getMethods();
List<CodeAnnotation> annotations = compResult.getAnnotations();
Comment[] comments = new Comment[annotations.size()];
if (!annotations.isEmpty()) {
for (int i = 0; i < comments.length; i++) {
CodeAnnotation annotation = annotations.get(i);
String text;
if (annotation instanceof CodeComment) {
CodeComment codeComment = (CodeComment) annotation;
text = codeComment.value;
} else if (annotation instanceof JumpTable) {
JumpTable jumpTable = (JumpTable) annotation;
text = "JumpTable [" + jumpTable.low + " .. " + jumpTable.high + "]";
} else {
text = annotation.toString();
}
comments[i] = new Comment(annotation.position, text);
}
}
DataSection data = compResult.getDataSection();
byte[] dataSection = new byte[data.getSectionSize()];
ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder());
Builder<DataPatch> patchBuilder = Stream.builder();
data.buildDataSection(buffer, vmConstant -> {
patchBuilder.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
});
int dataSectionAlignment = data.getSectionAlignment();
DataPatch[] dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]);
int totalFrameSize = compResult.getTotalFrameSize();
StackSlot customStackArea = compResult.getCustomStackArea();
boolean isImmutablePIC = compResult.isImmutablePIC();
if (method instanceof HotSpotResolvedJavaMethod) {
HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method;
int entryBCI = compResult.getEntryBCI();
boolean hasUnsafeAccess = compResult.hasUnsafeAccess();
int id;
long jvmciEnv;
if (compRequest != null) {
id = compRequest.getId();
jvmciEnv = compRequest.getJvmciEnv();
} else {
id = hsMethod.allocateCompileId(entryBCI);
jvmciEnv = 0L;
}
return new HotSpotCompiledNmethod(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC,
totalFrameSize, customStackArea, hsMethod, entryBCI, id, jvmciEnv, hasUnsafeAccess);
} else {
return new HotSpotCompiledCode(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC,
totalFrameSize, customStackArea);
}
}
示例9: getSortedSites
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
/**
* HotSpot expects sites to be presented in ascending order of PC (see
* {@code DebugInformationRecorder::add_new_pc_offset}). In addition, it expects
* {@link Infopoint} PCs to be unique.
*/
private static Site[] getSortedSites(CodeCacheProvider codeCache, CompilationResult target) {
List<Site> sites = new ArrayList<>(
target.getExceptionHandlers().size() + target.getInfopoints().size() + target.getDataPatches().size() + target.getMarks().size() + target.getSourceMappings().size());
sites.addAll(target.getExceptionHandlers());
sites.addAll(target.getInfopoints());
sites.addAll(target.getDataPatches());
sites.addAll(target.getMarks());
/*
* Translate the source mapping into appropriate info points. In HotSpot only one position
* can really be represented and recording the end PC seems to give the best results and
* corresponds with what C1 and C2 do.
*/
if (codeCache.shouldDebugNonSafepoints()) {
for (SourceMapping source : target.getSourceMappings()) {
sites.add(new Infopoint(source.getEndOffset(), new DebugInfo(source.getSourcePosition()), InfopointReason.BYTECODE_POSITION));
assert verifySourcePositionReceivers(source.getSourcePosition());
}
}
SiteComparator c = new SiteComparator();
Collections.sort(sites, c);
if (c.sawCollidingInfopoints) {
Infopoint lastInfopoint = null;
List<Site> copy = new ArrayList<>(sites.size());
for (Site site : sites) {
if (site instanceof Infopoint) {
Infopoint info = (Infopoint) site;
if (lastInfopoint == null || lastInfopoint.pcOffset != info.pcOffset) {
lastInfopoint = info;
copy.add(info);
} else {
// Omit this colliding infopoint
assert lastInfopoint.reason.compareTo(info.reason) <= 0;
}
} else {
copy.add(site);
}
}
sites = copy;
}
return sites.toArray(new Site[sites.size()]);
}
示例10: testInvalidAssumption
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testInvalidAssumption() {
installEmptyCode(new Site[0], new Assumption[]{new InvalidAssumption()}, new Comment[0], 16, new DataPatch[0], null);
}
示例11: testInvalidAlignment
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testInvalidAlignment() {
installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 7, new DataPatch[0], null);
}
示例12: testNullDataPatchInDataSection
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@Test(expected = NullPointerException.class)
public void testNullDataPatchInDataSection() {
installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{null}, null);
}
示例13: testNullReferenceInDataSection
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@Test(expected = NullPointerException.class)
public void testNullReferenceInDataSection() {
installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, null)}, null);
}
示例14: testInvalidDataSectionReference
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testInvalidDataSectionReference() {
DataSectionReference ref = new DataSectionReference();
ref.setOffset(0);
installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
}
示例15: testInvalidNarrowMethodInDataSection
import jdk.vm.ci.code.site.Site; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testInvalidNarrowMethodInDataSection() {
HotSpotConstant c = (HotSpotConstant) dummyMethod.getEncoding();
ConstantReference ref = new ConstantReference((VMConstant) c.compress());
installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
}