Skip to content

Commit

Permalink
Fix typos and grammar in comments
Browse files Browse the repository at this point in the history
Co-authored-by: Hinduja Balasubramaniyam <28644893+HindujaB@users.noreply.github.com>
  • Loading branch information
Nadeeshan96 and HindujaB authored Aug 15, 2023
1 parent d537d77 commit 39dea0f
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,18 +414,18 @@ SplitPointDetails> getSplitPointsForMap(List<BIRBasicBlock> bbs, Set<BIROperand>
// Here we also handle globalAndArgVarKeyOrValueLhsOperands and globalAndArgVarKeyOrValueRelatedIns
// which is related to global or arg vars.

// For a key value entry give both key value are temp/synthetic,
// we do not populate the map value if we do not have key operand before
// For a key-value entry given both key values are temp/synthetic,
// we do not populate the map value if we do not have a key operand before
// the value operand. We have to check that when processing split points. Hence, we have to find where
// the map key operands are located. That is done in the same loop below.

// a copy of arrayValueOperands is made to find first found map element operands from bottom
Set<BIROperand> remainingArrayValueOperands = new HashSet<>(mapValueOperands);

// Split points means the places which is eligible for a split. i.e. we can split the parent function by
// Split points mean the places which are eligible for a split. i.e. we can split the parent function by
// moving instructions and terminators until this one (including this) to a new function.
// Criteria for choosing split point is as follows. We go from bottom to top searching for map value operands
// in both rhs and lhs. If we find one, that is a split point, unless we find that previously in the same BB.
// The criteria for choosing a split point are as follows. We go from bottom to top searching for map value operands
// in both RHS and LHS. If we find one, that is a split point, unless we find that previously in the same BB.
// A new flag is added to the split point to depict whether to split the function here (splitHere).
// If it is false only map entry populating instructions are added, no split is done.
Map<BIRAbstractInstruction, SplitPointDetails> insSplitPoints = new HashMap<>();
Expand Down Expand Up @@ -481,15 +481,15 @@ private int getLastInsNumAndHandleTerminator(List<BIRBasicBlock> bbs, Set<BIROpe
lastInsNum = bbInstructions.size() - 1;
BIRTerminator bbTerminator = bb.terminator;
if (bbTerminator.kind != InstructionKind.BRANCH) {
// branch terminators are omitted from terminators because its boolean operand appear
// branch terminators are omitted from terminators because their boolean operands appear
// in a preceding instruction before the terminator. There we can do the split
populateInsSplitPoints(arrayOrMapValueOperands, insSplitPoints, bbTerminator, operandsInSameBB,
remainingArrayValueOperands);
}
if (bbTerminator.kind == InstructionKind.CALL) {
// When arrays have new objects created inside them, the object is created in one instruction
// and it is initialized/populated later by passing it as an argument to the $init$ function
// hence spilt function should be created after such function call
// hence split function should be created after such function call
// only in this case we have to consider RHS operands (only function arguments)
BIRTerminator.Call callIns = (BIRTerminator.Call) bbTerminator;
if (callIns.name.value.contains(OBJECT_INITIALIZATION_FUNCTION_NAME)) {
Expand All @@ -508,10 +508,10 @@ private Map<BIRAbstractInstruction, SplitPointDetails> getSplitPointsForArray(Li
// a copy of arrayValueOperands is made to find first found array element operands from bottom
Set<BIROperand> remainingArrayValueOperands = new HashSet<>(arrayValuesOperands);

// Split points means the places which is eligible for a split. i.e. we can split the parent function by
// Split points mean the places which are eligible for a split. i.e. we can split the parent function by
// moving instructions and terminators until this one (including this) to a new function.
// Criteria for choosing split point is as follows. We go from bottom to top searching for array value operands
// in both rhs and lhs. If we find one, that is a split point, unless we find that previously in the same BB.
// The criteria for choosing a split point are as follows. We go from bottom to top searching for array value operands
// in both RHS and LHS. If we find one, that is a split point, unless we find that previously in the same BB.
// A new flag is added to the split point to depict whether to split the function here (splitHere).
// If it is false only array populating instructions are added.
Map<BIRAbstractInstruction, SplitPointDetails> insSplitPoints = new HashMap<>();
Expand Down Expand Up @@ -595,7 +595,7 @@ private void splitParentFuncForPeriodicMapSplits(BIRFunction parentFunc, List<BI
Map<BIRAbstractInstruction, SplitPointDetails> insSplitPoints = getSplitPointsForMap(bbs, mapValuesOperands,
globalAndArgVarKeyOrValueLhsOperands, globalAndArgVarKeyOrValueRelatedIns, mapKeyOperandLocations);
Map<BIROperand, Integer> errorOperandsAndTargetBBs = getErrorOperandsAndTargetBBs(parentFunc.errorTable);
// When an error table operand is found as an array element operand in the LHS of an non terminator,
// When an error table operand is found as an array element operand in the LHS of a non-terminator,
// the array element populating instructions should be put in the targetBB for the try-catch to work correctly.
List<BIRNonTerminator> nextBBPendingIns = new ArrayList<>();
List<BIRNonTerminator> newBBInsList;
Expand Down Expand Up @@ -628,8 +628,8 @@ private void splitParentFuncForPeriodicMapSplits(BIRFunction parentFunc, List<BI
mapElementSet, bb, bbIns, bbInsLhsOp);
}
handleBBInstructions(splitFuncEnv, bb);
// next consider lhs op in BIR terminator, branch terms won't have array element as lhs op
// if we found a lhs op, we need to create a new BB and change the terminator
// Next consider LHS op in the BIR terminator, branch terms won't have an array element as LHS op
//If we found a LHS op, we need to create a new BB and change the terminator
populateSplitFuncArgsAndLocalVarList(splitFuncEnv, bb.terminator);
splitFuncEnv.periodicSplitInsCount++;
newBBInsList = new ArrayList<>();
Expand Down Expand Up @@ -734,8 +734,8 @@ private void splitParentFuncForPeriodicArraySplits(BIRFunction parentFunc, List<
Map<BIRAbstractInstruction, SplitPointDetails> insSplitPoints = getSplitPointsForArray(bbs,
arrayValuesOperands);
Map<BIROperand, Integer> errorOperandsAndTargetBBs = getErrorOperandsAndTargetBBs(parentFunc.errorTable);
// When an error table operand is found as an array element operand in the LHS of an non terminator,
// the array element populating instructions should be put in the targetBB for the try-catch to work correctly.
// When an error table operand is found as an array element operand in the LHS of a non-terminator,
// The array element populating instructions should be put in the targetBB for the try-catch to work correctly.
List<BIRNonTerminator> nextBBPendingIns = new ArrayList<>();
List<BIRNonTerminator> newBBInsList;
boolean arrayElementSet;
Expand Down Expand Up @@ -768,8 +768,8 @@ private void splitParentFuncForPeriodicArraySplits(BIRFunction parentFunc, List<

handleBBInstructions(splitFuncEnv, bb);

// next consider lhs op in BIR terminator, branch terms won't have array element as lhs op
// if we found a lhs op, we need to create a new BB and change the terminator
// Next consider LHS op in the BIR terminator, branch terms won't have an array element as LHS op
// If we found a LHS op, we need to create a new BB and change the terminator
populateSplitFuncArgsAndLocalVarList(splitFuncEnv, bb.terminator);
splitFuncEnv.periodicSplitInsCount++;
newBBInsList = new ArrayList<>();
Expand All @@ -796,7 +796,7 @@ private void createNewFuncForPeriodicSplit(BIRFunction parentFunc, List<BIRFunct
splitFuncEnv.splitFuncArgs.add(handleArray);
}

//create new spilt BIRFunction
// Create a new split BIRFunction
List<BType> paramTypes = new ArrayList<>();
for (BIRVariableDcl funcArg : splitFuncEnv.splitFuncArgs) {
paramTypes.add(funcArg.type);
Expand Down Expand Up @@ -1485,7 +1485,7 @@ private void generateSplits(BIRFunction function, List<Split> possibleSplits,
// unused temp and synthetic vars in the original function are removed
// and onlyUsedInSingleBB flag in BIRVariableDcl is changed in needed places
removeUnusedVarsAndSetVarUsage(function);
// renumbering BBs is not necessary here as it will be done later and fixing error table does not require order
// renumbering BBs is not necessary here as it will be done later and fixing the error table does not require an order
// set error table changed BBs
fixErrorTableEndBBs(function.errorTable, changedErrorTableEndBB);
}
Expand Down

0 comments on commit 39dea0f

Please sign in to comment.