use of com.oracle.svm.core.nodes.SafepointCheckNode in project graal by oracle.
the class NodeLLVMBuilder method emitCondition.
private LLVMValueRef emitCondition(LogicNode condition) {
if (condition instanceof IsNullNode) {
return builder.buildIsNull(llvmOperand(((IsNullNode) condition).getValue()));
}
if (condition instanceof LogicConstantNode) {
return builder.constantBoolean(((LogicConstantNode) condition).getValue());
}
if (condition instanceof CompareNode) {
CompareNode compareNode = (CompareNode) condition;
return builder.buildCompare(compareNode.condition().asCondition(), llvmOperand(compareNode.getX()), llvmOperand(compareNode.getY()), compareNode.unorderedIsTrue());
}
if (condition instanceof IntegerTestNode) {
IntegerTestNode integerTestNode = (IntegerTestNode) condition;
LLVMValueRef and = builder.buildAnd(llvmOperand(integerTestNode.getX()), llvmOperand(integerTestNode.getY()));
return builder.buildIsNull(and);
}
if (condition instanceof SafepointCheckNode) {
LLVMValueRef threadData = gen.getSpecialRegisterValue(SpecialRegister.ThreadPointer);
threadData = builder.buildIntToPtr(threadData, builder.rawPointerType());
LLVMValueRef safepointCounterAddr = builder.buildGEP(threadData, builder.constantInt(Safepoint.getThreadLocalSafepointRequestedOffset()));
LLVMValueRef safepointCount = builder.buildLoad(safepointCounterAddr, builder.intType());
if (ThreadingSupportImpl.isRecurringCallbackSupported()) {
safepointCount = builder.buildSub(safepointCount, builder.constantInt(1));
builder.buildStore(safepointCount, builder.buildBitcast(safepointCounterAddr, builder.pointerType(builder.intType())));
}
return builder.buildICmp(Condition.LE, safepointCount, builder.constantInt(0));
}
throw shouldNotReachHere("logic node: " + condition.getClass().getName());
}
Aggregations