本文整理汇总了Java中jdk.nashorn.internal.ir.LocalVariableConversion类的典型用法代码示例。如果您正苦于以下问题:Java LocalVariableConversion类的具体用法?Java LocalVariableConversion怎么用?Java LocalVariableConversion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalVariableConversion类属于jdk.nashorn.internal.ir包,在下文中一共展示了LocalVariableConversion类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createConversion
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
private LocalVariableConversion createConversion(final Symbol symbol, final LvarType branchLvarType,
final Map<Symbol, LvarType> joinLvarTypes, final LocalVariableConversion next) {
final LvarType targetType = joinLvarTypes.get(symbol);
assert targetType != null;
if(targetType == branchLvarType) {
return next;
}
// NOTE: we could naively just use symbolIsUsed(symbol, branchLvarType) here, but that'd be wrong. While
// technically a conversion will read the value of the symbol with that type, but it will also write it to a new
// type, and that type might be dead (we can't know yet). For this reason, we don't treat conversion reads as
// real uses until we know their target type is live. If we didn't do this, and just did a symbolIsUsed here,
// we'd introduce false live variables which could nevertheless turn into dead ones in a subsequent
// deoptimization, causing a shift in the list of live locals that'd cause erroneous restoration of
// continuations (since RewriteException's byteCodeSlots carries an array and not a name-value map).
symbolIsConverted(symbol, branchLvarType, targetType);
//symbolIsUsed(symbol, branchLvarType);
return new LocalVariableConversion(symbol, branchLvarType.type, targetType.type, next);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:LocalVariableTypesCalculator.java
示例2: createConversion
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
private LocalVariableConversion createConversion(final Symbol symbol, final LvarType branchLvarType,
final Map<Symbol, LvarType> joinLvarTypes, final LocalVariableConversion next) {
if (invalidatedSymbols.contains(symbol)) {
return next;
}
final LvarType targetType = joinLvarTypes.get(symbol);
assert targetType != null;
if(targetType == branchLvarType) {
return next;
}
// NOTE: we could naively just use symbolIsUsed(symbol, branchLvarType) here, but that'd be wrong. While
// technically a conversion will read the value of the symbol with that type, but it will also write it to a new
// type, and that type might be dead (we can't know yet). For this reason, we don't treat conversion reads as
// real uses until we know their target type is live. If we didn't do this, and just did a symbolIsUsed here,
// we'd introduce false live variables which could nevertheless turn into dead ones in a subsequent
// deoptimization, causing a shift in the list of live locals that'd cause erroneous restoration of
// continuations (since RewriteException's byteCodeSlots carries an array and not a name-value map).
symbolIsConverted(symbol, branchLvarType, targetType);
return new LocalVariableConversion(symbol, branchLvarType.type, targetType.type, next);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:LocalVariableTypesCalculator.java
示例3: createConversion
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
private LocalVariableConversion createConversion(final Symbol symbol, final LvarType branchLvarType,
final Map<Symbol, LvarType> joinLvarTypes, final LocalVariableConversion next) {
final LvarType targetType = joinLvarTypes.get(symbol);
assert targetType != null;
if(targetType == branchLvarType) {
return next;
}
// NOTE: we could naively just use symbolIsUsed(symbol, branchLvarType) here, but that'd be wrong. While
// technically a conversion will read the value of the symbol with that type, but it will also write it to a new
// type, and that type might be dead (we can't know yet). For this reason, we don't treat conversion reads as
// real uses until we know their target type is live. If we didn't do this, and just did a symbolIsUsed here,
// we'd introduce false live variables which could nevertheless turn into dead ones in a subsequent
// deoptimization, causing a shift in the list of live locals that'd cause erroneous restoration of
// continuations (since RewriteException's byteCodeSlots carries an array and not a name-value map).
symbolIsConverted(symbol, branchLvarType, targetType);
return new LocalVariableConversion(symbol, branchLvarType.type, targetType.type, next);
}
开发者ID:campolake,项目名称:openjdk9,代码行数:19,代码来源:LocalVariableTypesCalculator.java
示例4: beforeJoinPoint
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
void beforeJoinPoint(final JoinPredecessor joinPredecessor) {
LocalVariableConversion next = joinPredecessor.getLocalVariableConversion();
while(next != null) {
final Symbol symbol = next.getSymbol();
if(next.isLive()) {
emitLocalVariableConversion(next, true);
} else {
markDeadLocalVariable(symbol);
}
next = next.getNext();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:MethodEmitter.java
示例5: beforeTry
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
void beforeTry(final TryNode tryNode, final Label recovery) {
LocalVariableConversion next = tryNode.getLocalVariableConversion();
while(next != null) {
if(next.isLive()) {
final Type to = emitLocalVariableConversion(next, false);
recovery.getStack().onLocalStore(to, next.getSymbol().getSlot(to), true);
}
next = next.getNext();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:MethodEmitter.java
示例6: emitLocalVariableConversion
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
private Type emitLocalVariableConversion(final LocalVariableConversion conversion, final boolean onlySymbolLiveValue) {
final Type from = conversion.getFrom();
final Type to = conversion.getTo();
final Symbol symbol = conversion.getSymbol();
assert symbol.isBytecodeLocal();
if(from == Type.UNDEFINED) {
loadUndefined(to);
} else {
load(symbol, from).convert(to);
}
store(symbol, to, onlySymbolLiveValue);
return to;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:MethodEmitter.java
示例7: optimizeLogicalOperand
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
private void optimizeLogicalOperand(final Expression expr, final Label label, final boolean state, final boolean isRhs) {
final JoinPredecessorExpression jpexpr = (JoinPredecessorExpression)expr;
if(LocalVariableConversion.hasLiveConversion(jpexpr)) {
final Label after = new Label("after");
branchOptimizer(jpexpr.getExpression(), after, !state);
method.beforeJoinPoint(jpexpr);
method._goto(label);
method.label(after);
if(isRhs) {
method.beforeJoinPoint(jpexpr);
}
} else {
branchOptimizer(jpexpr.getExpression(), label, state);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:BranchOptimizer.java
示例8: enterDoWhile
import jdk.nashorn.internal.ir.LocalVariableConversion; //导入依赖的package包/类
private void enterDoWhile(final WhileNode whileNode) {
final int liveLocalsOnContinueOrBreak = method.getUsedSlotsWithLiveTemporaries();
method.beforeJoinPoint(whileNode);
final Block body = whileNode.getBody();
body.accept(this);
emitContinueLabel(whileNode.getContinueLabel(), liveLocalsOnContinueOrBreak);
if(method.isReachable()) {
lineNumber(whileNode);
final JoinPredecessorExpression test = whileNode.getTest();
final Label bodyEntryLabel = body.getEntryLabel();
final boolean testHasLiveConversion = LocalVariableConversion.hasLiveConversion(test);
if(Expression.isAlwaysFalse(test)) {
loadAndDiscard(test);
if(testHasLiveConversion) {
method.beforeJoinPoint(test);
}
} else if(testHasLiveConversion) {
// If we have conversions after the test in do-while, they need to be effected on both branches.
final Label beforeExit = new Label("do_while_preexit");
emitBranch(test.getExpression(), beforeExit, false);
method.beforeJoinPoint(test);
method._goto(bodyEntryLabel);
method.label(beforeExit);
method.beforeJoinPoint(test);
} else {
emitBranch(test.getExpression(), bodyEntryLabel, true);
}
}
method.breakLabel(whileNode.getBreakLabel(), liveLocalsOnContinueOrBreak);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:CodeGenerator.java
注:本文中的jdk.nashorn.internal.ir.LocalVariableConversion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论