Search in sources :

Example 96 with EnumSet

use of java.util.EnumSet in project dubbo by alibaba.

the class Hessian2EnumSetTest method none.

@Test
public void none() throws Exception {
    EnumSet<Type> types = EnumSet.noneOf(Type.class);
    EnumSet set = baseHession2Serialize(types);
    TestCase.assertEquals(set, EnumSet.noneOf(Type.class));
}
Also used : Type(com.alibaba.com.caucho.hessian.io.beans.Type) EnumSet(java.util.EnumSet) Test(org.junit.Test)

Example 97 with EnumSet

use of java.util.EnumSet in project dubbo by alibaba.

the class EnumSetHandler method readResolve.

@SuppressWarnings("unchecked")
private Object readResolve() {
    EnumSet enumSet = EnumSet.noneOf(type);
    enumSet.addAll(Arrays.asList(objects));
    return enumSet;
}
Also used : EnumSet(java.util.EnumSet)

Example 98 with EnumSet

use of java.util.EnumSet in project graal by oracle.

the class RegisterVerifier method processOperations.

void processOperations(AbstractBlockBase<?> block, final Interval[] inputState) {
    ArrayList<LIRInstruction> ops = allocator.getLIR().getLIRforBlock(block);
    DebugContext debug = allocator.getDebug();
    InstructionValueConsumer useConsumer = new InstructionValueConsumer() {

        @Override
        public void visitValue(LIRInstruction op, Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
            // we skip spill moves inserted by the spill position optimization
            if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand) && op.id() != LinearScan.DOMINATOR_SPILL_MOVE_ID) {
                Interval interval = intervalAt(operand);
                if (op.id() != -1) {
                    interval = interval.getSplitChildAtOpId(op.id(), mode, allocator);
                }
                assert checkState(block, op, inputState, interval.operand, interval.location(), interval.splitParent());
            }
        }
    };
    InstructionValueConsumer defConsumer = (op, operand, mode, flags) -> {
        if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand)) {
            Interval interval = intervalAt(operand);
            if (op.id() != -1) {
                interval = interval.getSplitChildAtOpId(op.id(), mode, allocator);
            }
            statePut(debug, inputState, interval.location(), interval.splitParent());
        }
    };
    // visit all instructions of the block
    for (int i = 0; i < ops.size(); i++) {
        final LIRInstruction op = ops.get(i);
        if (debug.isLogEnabled()) {
            debug.log("%s", op.toStringWithIdPrefix());
        }
        // check if input operands are correct
        op.visitEachInput(useConsumer);
        // invalidate all caller save registers at calls
        if (op.destroysCallerSavedRegisters()) {
            for (Register r : allocator.getRegisterAllocationConfig().getRegisterConfig().getCallerSaveRegisters()) {
                statePut(debug, inputState, r.asValue(), null);
            }
        }
        op.visitEachAlive(useConsumer);
        // set temp operands (some operations use temp operands also as output operands, so
        // can't set them null)
        op.visitEachTemp(defConsumer);
        // set output operands
        op.visitEachOutput(defConsumer);
    }
}
Also used : AbstractBlockBase(org.graalvm.compiler.core.common.cfg.AbstractBlockBase) OperandMode(org.graalvm.compiler.lir.LIRInstruction.OperandMode) LIRInstruction(org.graalvm.compiler.lir.LIRInstruction) Register(jdk.vm.ci.code.Register) ArrayList(java.util.ArrayList) BlockMap(org.graalvm.compiler.core.common.cfg.BlockMap) InstructionValueConsumer(org.graalvm.compiler.lir.InstructionValueConsumer) Value(jdk.vm.ci.meta.Value) OperandFlag(org.graalvm.compiler.lir.LIRInstruction.OperandFlag) DebugContext(org.graalvm.compiler.debug.DebugContext) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) Indent(org.graalvm.compiler.debug.Indent) GraalError(org.graalvm.compiler.debug.GraalError) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) EnumSet(java.util.EnumSet) InstructionValueConsumer(org.graalvm.compiler.lir.InstructionValueConsumer) Register(jdk.vm.ci.code.Register) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) LIRInstruction(org.graalvm.compiler.lir.LIRInstruction) EnumSet(java.util.EnumSet) Value(jdk.vm.ci.meta.Value) DebugContext(org.graalvm.compiler.debug.DebugContext) OperandMode(org.graalvm.compiler.lir.LIRInstruction.OperandMode)

Example 99 with EnumSet

use of java.util.EnumSet in project graal by oracle.

the class LIRVerifier method verify.

private void verify() {
    ValueConsumer useConsumer = new ValueConsumer() {

        @Override
        public void visitValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
            use(value, mode, flags);
        }
    };
    ValueConsumer defConsumer = new ValueConsumer() {

        @Override
        public void visitValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
            def(value, mode, flags);
        }
    };
    int maxRegisterNum = maxRegisterNum();
    curRegistersDefined = new BitSet();
    for (AbstractBlockBase<?> block : lir.linearScanOrder()) {
        curBlock = block;
        curVariablesLive = new BitSet();
        curRegistersLive = new Value[maxRegisterNum];
        if (block.getDominator() != null) {
            curVariablesLive.or(liveOutFor(block.getDominator()));
        }
        assert lir.getLIRforBlock(block).get(0) instanceof StandardOp.LabelOp : "block must start with label";
        if (block.getSuccessorCount() > 0) {
            LIRInstruction last = lir.getLIRforBlock(block).get(lir.getLIRforBlock(block).size() - 1);
            assert last instanceof StandardOp.JumpOp : "block with successor must end with unconditional jump";
        }
        if (block.getPredecessorCount() > 1) {
            SSAUtil.verifyPhi(lir, block);
        }
        for (LIRInstruction op : lir.getLIRforBlock(block)) {
            curInstruction = op;
            op.visitEachInput(useConsumer);
            if (op.destroysCallerSavedRegisters()) {
                for (Register register : frameMap.getRegisterConfig().getCallerSaveRegisters()) {
                    curRegistersLive[register.number] = null;
                }
            }
            curRegistersDefined.clear();
            op.visitEachAlive(useConsumer);
            op.visitEachState(useConsumer);
            op.visitEachTemp(defConsumer);
            op.visitEachOutput(defConsumer);
            curInstruction = null;
        }
        setLiveOutFor(block, curVariablesLive);
    }
}
Also used : Register(jdk.vm.ci.code.Register) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) EnumSet(java.util.EnumSet) LIRValueUtil.isStackSlotValue(org.graalvm.compiler.lir.LIRValueUtil.isStackSlotValue) Value(jdk.vm.ci.meta.Value) BitSet(java.util.BitSet) OperandMode(org.graalvm.compiler.lir.LIRInstruction.OperandMode)

Example 100 with EnumSet

use of java.util.EnumSet in project graal by oracle.

the class RegisterVerifier method processOperations.

void processOperations(AbstractBlockBase<?> block, final TraceInterval[] inputState) {
    ArrayList<LIRInstruction> ops = allocator.getLIR().getLIRforBlock(block);
    DebugContext debug = allocator.getDebug();
    InstructionValueConsumer useConsumer = new InstructionValueConsumer() {

        @Override
        public void visitValue(LIRInstruction op, Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
            // we skip spill moves inserted by the spill position optimization
            if (isVariableOrRegister(operand) && allocator.isProcessed(operand) && op.id() != TraceLinearScanPhase.DOMINATOR_SPILL_MOVE_ID) {
                TraceInterval interval = intervalAt(asVariable(operand));
                if (op.id() != -1) {
                    interval = interval.getSplitChildAtOpId(op.id(), mode);
                }
                assert checkState(block, op, inputState, allocator.getOperand(interval), interval.location(), interval.splitParent());
            }
        }
    };
    InstructionValueConsumer defConsumer = (op, operand, mode, flags) -> {
        if (isVariableOrRegister(operand) && allocator.isProcessed(operand)) {
            TraceInterval interval = intervalAt(asVariable(operand));
            if (op.id() != -1) {
                interval = interval.getSplitChildAtOpId(op.id(), mode);
            }
            statePut(debug, inputState, interval.location(), interval.splitParent());
        }
    };
    // visit all instructions of the block
    for (int i = 0; i < ops.size(); i++) {
        final LIRInstruction op = ops.get(i);
        if (debug.isLogEnabled()) {
            debug.log("%s", op.toStringWithIdPrefix());
        }
        // check if input operands are correct
        op.visitEachInput(useConsumer);
        // invalidate all caller save registers at calls
        if (op.destroysCallerSavedRegisters()) {
            for (Register r : allocator.getRegisterAllocationConfig().getRegisterConfig().getCallerSaveRegisters()) {
                statePut(debug, inputState, r.asValue(), null);
            }
        }
        op.visitEachAlive(useConsumer);
        // set temp operands (some operations use temp operands also as output operands, so
        // can't set them null)
        op.visitEachTemp(defConsumer);
        // set output operands
        op.visitEachOutput(defConsumer);
    }
}
Also used : AbstractBlockBase(org.graalvm.compiler.core.common.cfg.AbstractBlockBase) OperandMode(org.graalvm.compiler.lir.LIRInstruction.OperandMode) Variable(org.graalvm.compiler.lir.Variable) TraceLinearScanPhase.isVariableOrRegister(org.graalvm.compiler.lir.alloc.trace.lsra.TraceLinearScanPhase.isVariableOrRegister) TraceLinearScan(org.graalvm.compiler.lir.alloc.trace.lsra.TraceLinearScanPhase.TraceLinearScan) LIRValueUtil.asVariable(org.graalvm.compiler.lir.LIRValueUtil.asVariable) LIRInstruction(org.graalvm.compiler.lir.LIRInstruction) Register(jdk.vm.ci.code.Register) ArrayList(java.util.ArrayList) BlockMap(org.graalvm.compiler.core.common.cfg.BlockMap) InstructionValueConsumer(org.graalvm.compiler.lir.InstructionValueConsumer) Value(jdk.vm.ci.meta.Value) OperandFlag(org.graalvm.compiler.lir.LIRInstruction.OperandFlag) DebugContext(org.graalvm.compiler.debug.DebugContext) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) Indent(org.graalvm.compiler.debug.Indent) GraalError(org.graalvm.compiler.debug.GraalError) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) EnumSet(java.util.EnumSet) InstructionValueConsumer(org.graalvm.compiler.lir.InstructionValueConsumer) TraceLinearScanPhase.isVariableOrRegister(org.graalvm.compiler.lir.alloc.trace.lsra.TraceLinearScanPhase.isVariableOrRegister) Register(jdk.vm.ci.code.Register) ValueUtil.isRegister(jdk.vm.ci.code.ValueUtil.isRegister) ValueUtil.asRegister(jdk.vm.ci.code.ValueUtil.asRegister) LIRInstruction(org.graalvm.compiler.lir.LIRInstruction) EnumSet(java.util.EnumSet) Value(jdk.vm.ci.meta.Value) DebugContext(org.graalvm.compiler.debug.DebugContext) OperandMode(org.graalvm.compiler.lir.LIRInstruction.OperandMode)

Aggregations

EnumSet (java.util.EnumSet)151 Set (java.util.Set)44 ArrayList (java.util.ArrayList)43 Map (java.util.Map)30 List (java.util.List)29 HashMap (java.util.HashMap)27 HashSet (java.util.HashSet)27 Collection (java.util.Collection)22 Test (org.junit.Test)20 Collectors (java.util.stream.Collectors)19 IOException (java.io.IOException)16 Collections (java.util.Collections)14 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)13 IteratorScope (org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope)12 TreeSet (java.util.TreeSet)11 File (java.io.File)10 Arrays (java.util.Arrays)10 LinkedHashSet (java.util.LinkedHashSet)10 AccumuloClient (org.apache.accumulo.core.client.AccumuloClient)9 TreeMap (java.util.TreeMap)8