本文整理汇总了Java中org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.ATTR_VARS属性的典型用法代码示例。如果您正苦于以下问题:Java ClassFileConstants.ATTR_VARS属性的具体用法?Java ClassFileConstants.ATTR_VARS怎么用?Java ClassFileConstants.ATTR_VARS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants
的用法示例。
在下文中一共展示了ClassFileConstants.ATTR_VARS属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exitUserScope
public void exitUserScope(BlockScope currentScope) {
// mark all the scope's locals as losing their definite assignment
if ((this.generateAttributes & (ClassFileConstants.ATTR_VARS
| ClassFileConstants.ATTR_STACK_MAP_TABLE
| ClassFileConstants.ATTR_STACK_MAP)) == 0)
return;
int index = this.visibleLocalsCount - 1;
while (index >= 0) {
LocalVariableBinding visibleLocal = this.visibleLocals[index];
if (visibleLocal == null || visibleLocal.declaringScope != currentScope) {
// left currentScope
index--;
continue;
}
// there may be some preserved locals never initialized
if (visibleLocal.initializationCount > 0) {
visibleLocal.recordInitializationEndPC(this.position);
}
this.visibleLocals[index--] = null; // this variable is no longer visible afterwards
}
}
示例2: addDefinitelyAssignedVariables
public void addDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
// Required to fix 1PR0XVS: LFRE:WINNT - Compiler: variable table for method appears incorrect
if ((this.generateAttributes & (ClassFileConstants.ATTR_VARS
| ClassFileConstants.ATTR_STACK_MAP_TABLE
| ClassFileConstants.ATTR_STACK_MAP)) == 0)
return;
for (int i = 0; i < this.visibleLocalsCount; i++) {
LocalVariableBinding localBinding = this.visibleLocals[i];
if (localBinding != null) {
// Check if the local is definitely assigned
if (isDefinitelyAssigned(scope, initStateIndex, localBinding)) {
if ((localBinding.initializationCount == 0) || (localBinding.initializationPCs[((localBinding.initializationCount - 1) << 1) + 1] != -1)) {
/* There are two cases:
* 1) there is no initialization interval opened ==> add an opened interval
* 2) there is already some initialization intervals but the last one is closed ==> add an opened interval
* An opened interval means that the value at localBinding.initializationPCs[localBinding.initializationCount - 1][1]
* is equals to -1.
* initializationPCs is a collection of pairs of int:
* first value is the startPC and second value is the endPC. -1 one for the last value means that the interval
* is not closed yet.
*/
localBinding.recordInitializationStartPC(this.position);
}
}
}
}
}
示例3: addVisibleLocalVariable
public void addVisibleLocalVariable(LocalVariableBinding localBinding) {
if ((this.generateAttributes & (ClassFileConstants.ATTR_VARS
| ClassFileConstants.ATTR_STACK_MAP_TABLE
| ClassFileConstants.ATTR_STACK_MAP)) == 0)
return;
if (this.visibleLocalsCount >= this.visibleLocals.length)
System.arraycopy(this.visibleLocals, 0, this.visibleLocals = new LocalVariableBinding[this.visibleLocalsCount * 2], 0, this.visibleLocalsCount);
this.visibleLocals[this.visibleLocalsCount++] = localBinding;
}
示例4: record
public void record(LocalVariableBinding local) {
if ((this.generateAttributes & (ClassFileConstants.ATTR_VARS
| ClassFileConstants.ATTR_STACK_MAP_TABLE
| ClassFileConstants.ATTR_STACK_MAP)) == 0)
return;
if (this.allLocalsCounter == this.locals.length) {
// resize the collection
System.arraycopy(this.locals, 0, this.locals = new LocalVariableBinding[this.allLocalsCounter + LOCALS_INCREMENT], 0, this.allLocalsCounter);
}
this.locals[this.allLocalsCounter++] = local;
local.initializationPCs = new int[4];
local.initializationCount = 0;
}
示例5: removeNotDefinitelyAssignedVariables
public void removeNotDefinitelyAssignedVariables(Scope scope, int initStateIndex) {
// given some flow info, make sure we did not loose some variables initialization
// if this happens, then we must update their pc entries to reflect it in debug attributes
if ((this.generateAttributes & (ClassFileConstants.ATTR_VARS
| ClassFileConstants.ATTR_STACK_MAP_TABLE
| ClassFileConstants.ATTR_STACK_MAP)) == 0)
return;
for (int i = 0; i < this.visibleLocalsCount; i++) {
LocalVariableBinding localBinding = this.visibleLocals[i];
if (localBinding != null && !isDefinitelyAssigned(scope, initStateIndex, localBinding) && localBinding.initializationCount > 0) {
localBinding.recordInitializationEndPC(this.position);
}
}
}
示例6: place
public void place() { // Currently lacking wide support.
// if ((this.tagBits & USED) == 0 && this.forwardReferenceCount == 0) {
// return;
// }
//TODO how can position be set already ? cannot place more than once
if (this.position == Label.POS_NOT_SET) {
this.position = this.codeStream.position;
this.codeStream.addLabel(this);
int oldPosition = this.position;
boolean isOptimizedBranch = false;
if (this.forwardReferenceCount != 0) {
isOptimizedBranch = (this.forwardReferences[this.forwardReferenceCount - 1] + 2 == this.position) && (this.codeStream.bCodeStream[this.codeStream.classFileOffset - 3] == Opcodes.OPC_goto);
if (isOptimizedBranch) {
if (this.codeStream.lastAbruptCompletion == this.position) {
this.codeStream.lastAbruptCompletion = -1;
}
this.codeStream.position = (this.position -= 3);
this.codeStream.classFileOffset -= 3;
this.forwardReferenceCount--;
if (this.codeStream.lastEntryPC == oldPosition) {
this.codeStream.lastEntryPC = this.position;
}
// end of new code
if ((this.codeStream.generateAttributes & (ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_STACK_MAP_TABLE | ClassFileConstants.ATTR_STACK_MAP)) != 0) {
LocalVariableBinding locals[] = this.codeStream.locals;
for (int i = 0, max = locals.length; i < max; i++) {
LocalVariableBinding local = locals[i];
if ((local != null) && (local.initializationCount > 0)) {
if (local.initializationPCs[((local.initializationCount - 1) << 1) + 1] == oldPosition) {
// we want to prevent interval of size 0 to have a negative size.
// see PR 1GIRQLA: ITPJCORE:ALL - ClassFormatError for local variable attribute
local.initializationPCs[((local.initializationCount - 1) << 1) + 1] = this.position;
}
if (local.initializationPCs[(local.initializationCount - 1) << 1] == oldPosition) {
local.initializationPCs[(local.initializationCount - 1) << 1] = this.position;
}
}
}
}
if ((this.codeStream.generateAttributes & ClassFileConstants.ATTR_LINES) != 0) {
// we need to remove all entries that is beyond this.position inside the pcToSourcerMap table
this.codeStream.removeUnusedPcToSourceMapEntries();
}
}
}
for (int i = 0; i < this.forwardReferenceCount; i++) {
this.codeStream.writePosition(this, this.forwardReferences[i]);
}
// For all labels placed at that position we check if we need to rewrite the jump
// offset. It is the case each time a label had a forward reference to the current position.
// Like we change the current position, we have to change the jump offset. See 1F4IRD9 for more details.
if (isOptimizedBranch) {
this.codeStream.optimizeBranch(oldPosition, this);
}
}
}