Java Code Examples for jdk.nashorn.internal.ir.Block#getSymbols()

The following examples show how to use jdk.nashorn.internal.ir.Block#getSymbols() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalVariableTypesCalculator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterBlock(final Block block) {
    boolean cloned = false;
    for(final Symbol symbol: block.getSymbols()) {
        if(symbol.isBytecodeLocal()) {
            if (getLocalVariableTypeOrNull(symbol) == null) {
                if (!cloned) {
                    cloneOrNewLocalVariableTypes();
                    cloned = true;
                }
                localVariableTypes.put(symbol, LvarType.UNDEFINED);
            }
            // In case we're repeating analysis of a lexical scope (e.g. it's in a loop),
            // make sure all symbols lexically scoped by the block become valid again.
            invalidatedSymbols.remove(symbol);
        }
    }
    return true;
}
 
Example 2
Source File: LocalVariableTypesCalculator.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterBlock(final Block block) {
    boolean cloned = false;
    for(final Symbol symbol: block.getSymbols()) {
        if(symbol.isBytecodeLocal()) {
            if (getLocalVariableTypeOrNull(symbol) == null) {
                if (!cloned) {
                    cloneOrNewLocalVariableTypes();
                    cloned = true;
                }
                localVariableTypes.put(symbol, LvarType.UNDEFINED);
            }
            // In case we're repeating analysis of a lexical scope (e.g. it's in a loop),
            // make sure all symbols lexically scoped by the block become valid again.
            invalidatedSymbols.remove(symbol);
        }
    }
    return true;
}
 
Example 3
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterBlock(final Block block) {
    boolean cloned = false;
    for(final Symbol symbol: block.getSymbols()) {
        if(symbol.isBytecodeLocal()) {
            if (getLocalVariableTypeOrNull(symbol) == null) {
                if (!cloned) {
                    cloneOrNewLocalVariableTypes();
                    cloned = true;
                }
                localVariableTypes.put(symbol, LvarType.UNDEFINED);
            }
            // In case we're repeating analysis of a lexical scope (e.g. it's in a loop),
            // make sure all symbols lexically scoped by the block become valid again.
            invalidatedSymbols.remove(symbol);
        }
    }
    return true;
}
 
Example 4
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterBlock(final Block block) {
    boolean cloned = false;
    for(final Symbol symbol: block.getSymbols()) {
        if(symbol.isBytecodeLocal()) {
            if (getLocalVariableTypeOrNull(symbol) == null) {
                if (!cloned) {
                    cloneOrNewLocalVariableTypes();
                    cloned = true;
                }
                localVariableTypes.put(symbol, LvarType.UNDEFINED);
            }
            // In case we're repeating analysis of a lexical scope (e.g. it's in a loop),
            // make sure all symbols lexically scoped by the block become valid again.
            invalidatedSymbols.remove(symbol);
        }
    }
    return true;
}
 
Example 5
Source File: LocalVariableTypesCalculator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean enterBlock(final Block block) {
    boolean cloned = false;
    for(final Symbol symbol: block.getSymbols()) {
        if(symbol.isBytecodeLocal()) {
            if (getLocalVariableTypeOrNull(symbol) == null) {
                if (!cloned) {
                    cloneOrNewLocalVariableTypes();
                    cloned = true;
                }
                localVariableTypes.put(symbol, LvarType.UNDEFINED);
            }
            // In case we're repeating analysis of a lexical scope (e.g. it's in a loop),
            // make sure all symbols lexically scoped by the block become valid again.
            invalidatedSymbols.remove(symbol);
        }
    }
    return true;
}
 
Example 6
Source File: CodeGenerator.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create symbol debug information.
 *
 * @param block block containing symbols.
 */
private void symbolInfo(final Block block) {
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            method.localVariable(symbol, block.getEntryLabel(), block.getBreakLabel());
        }
    }
}
 
Example 7
Source File: CodeGeneratorLexicalContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private int assignSlots(final Block block, final int firstSlot) {
    int fromSlot = firstSlot;
    final MethodEmitter method = methodEmitters.peek();
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setFirstSlot(fromSlot);
            final int toSlot = fromSlot + symbol.slotCount();
            method.defineBlockLocalVariable(fromSlot, toSlot);
            fromSlot = toSlot;
        }
    }
    return fromSlot;
}
 
Example 8
Source File: CodeGeneratorLexicalContext.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static int assignSlots(final Block block, final int firstSlot) {
    int nextSlot = firstSlot;
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setSlot(nextSlot);
            nextSlot += symbol.slotCount();
        }
    }
    return nextSlot;
}
 
Example 9
Source File: CodeGeneratorLexicalContext.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private int assignSlots(final Block block, final int firstSlot) {
    int fromSlot = firstSlot;
    final MethodEmitter method = methodEmitters.peek();
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setFirstSlot(fromSlot);
            final int toSlot = fromSlot + symbol.slotCount();
            method.defineBlockLocalVariable(fromSlot, toSlot);
            fromSlot = toSlot;
        }
    }
    return fromSlot;
}
 
Example 10
Source File: CodeGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create symbol debug information.
 *
 * @param block block containing symbols.
 */
private void symbolInfo(final Block block) {
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            method.localVariable(symbol, block.getEntryLabel(), block.getBreakLabel());
        }
    }
}
 
Example 11
Source File: CodeGeneratorLexicalContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static int assignSlots(final Block block, final int firstSlot) {
    int nextSlot = firstSlot;
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setSlot(nextSlot);
            nextSlot += symbol.slotCount();
        }
    }
    return nextSlot;
}
 
Example 12
Source File: CodeGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create symbol debug information.
 *
 * @param block block containing symbols.
 */
private void symbolInfo(final Block block) {
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            method.localVariable(symbol, block.getEntryLabel(), block.getBreakLabel());
        }
    }
}
 
Example 13
Source File: CodeGeneratorLexicalContext.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static int assignSlots(final Block block, final int firstSlot) {
    int nextSlot = firstSlot;
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setSlot(nextSlot);
            nextSlot += symbol.slotCount();
        }
    }
    return nextSlot;
}
 
Example 14
Source File: LocalVariableTypesCalculator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterBlock(final Block block) {
    for(final Symbol symbol: block.getSymbols()) {
        if(symbol.isBytecodeLocal() && getLocalVariableTypeOrNull(symbol) == null) {
            setType(symbol, LvarType.UNDEFINED);
        }
    }
    return true;
}
 
Example 15
Source File: CodeGeneratorLexicalContext.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private int assignSlots(final Block block, final int firstSlot) {
    int fromSlot = firstSlot;
    final MethodEmitter method = methodEmitters.peek();
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setFirstSlot(fromSlot);
            final int toSlot = fromSlot + symbol.slotCount();
            method.defineBlockLocalVariable(fromSlot, toSlot);
            fromSlot = toSlot;
        }
    }
    return fromSlot;
}
 
Example 16
Source File: CodeGeneratorLexicalContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private int assignSlots(final Block block, final int firstSlot) {
    int fromSlot = firstSlot;
    final MethodEmitter method = methodEmitters.peek();
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setFirstSlot(fromSlot);
            final int toSlot = fromSlot + symbol.slotCount();
            method.defineBlockLocalVariable(fromSlot, toSlot);
            fromSlot = toSlot;
        }
    }
    return fromSlot;
}
 
Example 17
Source File: CodeGeneratorLexicalContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private int assignSlots(final Block block, final int firstSlot) {
    int fromSlot = firstSlot;
    final MethodEmitter method = methodEmitters.peek();
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setFirstSlot(fromSlot);
            final int toSlot = fromSlot + symbol.slotCount();
            method.defineBlockLocalVariable(fromSlot, toSlot);
            fromSlot = toSlot;
        }
    }
    return fromSlot;
}
 
Example 18
Source File: CodeGeneratorLexicalContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private int assignSlots(final Block block, final int firstSlot) {
    int fromSlot = firstSlot;
    final MethodEmitter method = methodEmitters.peek();
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setFirstSlot(fromSlot);
            final int toSlot = fromSlot + symbol.slotCount();
            method.defineBlockLocalVariable(fromSlot, toSlot);
            fromSlot = toSlot;
        }
    }
    return fromSlot;
}
 
Example 19
Source File: LocalVariableTypesCalculator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean enterBlock(final Block block) {
    for(final Symbol symbol: block.getSymbols()) {
        if(symbol.isBytecodeLocal() && getLocalVariableTypeOrNull(symbol) == null) {
            setType(symbol, LvarType.UNDEFINED);
        }
    }
    return true;
}
 
Example 20
Source File: CodeGeneratorLexicalContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private int assignSlots(final Block block, final int firstSlot) {
    int fromSlot = firstSlot;
    final MethodEmitter method = methodEmitters.peek();
    for (final Symbol symbol : block.getSymbols()) {
        if (symbol.hasSlot()) {
            symbol.setFirstSlot(fromSlot);
            final int toSlot = fromSlot + symbol.slotCount();
            method.defineBlockLocalVariable(fromSlot, toSlot);
            fromSlot = toSlot;
        }
    }
    return fromSlot;
}