From 240765b2a317db115e6226790c356bf5a809528c Mon Sep 17 00:00:00 2001 From: Lukas Rothenberger Date: Fri, 2 Dec 2022 15:38:19 +0100 Subject: [PATCH] Release 2.0.3 * fixes #233 * fix: added missing requirements * fix: possible type error * fix: save working copy path * fix #227: loop variables not classified as private anymore * fix #229: added option to ignore metadata when determining variable names * fixes #235: updated release instructions in wiki * fixes #201: forward error codes in runDiscoPoP script * updated version files --- DiscoPoP/DiscoPoP.cpp | 32 +++++++++---------- DiscoPoP/DiscoPoP.hpp | 2 +- VERSION | 2 +- discopop_explorer/_version.py | 2 +- discopop_explorer/utils.py | 4 +-- discopop_profiler/_version.py | 2 +- .../classes/ExecutionConfiguration.py | 1 + discopop_wizard/classes/Settings.py | 14 ++++---- discopop_wizard/requirements.txt | 3 +- docs/How_to_contribute.md | 20 ++++++------ scripts/runDiscoPoP | 13 ++++++-- 11 files changed, 54 insertions(+), 41 deletions(-) diff --git a/DiscoPoP/DiscoPoP.cpp b/DiscoPoP/DiscoPoP.cpp index 954eb02ef..42fe2c858 100644 --- a/DiscoPoP/DiscoPoP.cpp +++ b/DiscoPoP/DiscoPoP.cpp @@ -244,7 +244,7 @@ string DiscoPoP::determineVariableDefLine(Instruction *I) { string varDefLine{"LineNotFound"}; bool isGlobal = false; - string varName = determineVariableName_static(&*I, isGlobal); + string varName = determineVariableName_static(&*I, isGlobal, true); // varName = refineVarName(varName); varName = (varName.find(".addr") == varName.npos) ? varName @@ -283,10 +283,10 @@ string DiscoPoP::determineVariableDefLine(Instruction *I) { if (AI) { for (User *U: AI->users()) { if (StoreInst * SI = dyn_cast(U)) { - vn = determineVariableName_static(&*SI, isGlobal); + vn = determineVariableName_static(&*SI, isGlobal, true); break; } else if (LoadInst * LI = dyn_cast(U)) { - vn = determineVariableName_static(&*LI, isGlobal); + vn = determineVariableName_static(&*LI, isGlobal, true); break; } } @@ -363,7 +363,7 @@ void DiscoPoP::populateGlobalVariablesSet(Region *TopRegion, isa(instruction)) { // NOTE: changed 'instruction' to '&*instruction' - string varName = determineVariableName_static(&*instruction, isGlobalVariable); + string varName = determineVariableName_static(&*instruction, isGlobalVariable, false); if (isGlobalVariable) // add it if it is a global variable in the program { @@ -490,7 +490,7 @@ void DiscoPoP::createCUs(Region *TopRegion, set &globalVariablesSet, Type *Ty = operand->getType(); unsigned u = DL->getTypeSizeInBits(Ty); cu->writeDataSize += u; - varName = determineVariableName_static(&*instruction, isGlobalVar); + varName = determineVariableName_static(&*instruction, isGlobalVar, false); varType = determineVariableType(&*instruction); suspiciousVariables.insert(varName); if (lid > 0) @@ -500,7 +500,7 @@ void DiscoPoP::createCUs(Region *TopRegion, set &globalVariablesSet, Type *Ty = instruction->getType(); unsigned u = DL->getTypeSizeInBits(Ty); cu->readDataSize += u; - varName = determineVariableName_static(&*instruction, isGlobalVar); + varName = determineVariableName_static(&*instruction, isGlobalVar, false); if (suspiciousVariables.count(varName)) { // VIOLATION OF CAUTIOUS PROPERTY // it is a load instruction which read the value of a global @@ -681,7 +681,7 @@ void DiscoPoP::fillCUVariables(Region *TopRegion, if (lid == 0) continue; // NOTE: changed 'instruction' to '&*instruction', next 2 lines - varName = determineVariableName_static(&*instruction, isGlobalVar); + varName = determineVariableName_static(&*instruction, isGlobalVar, false); varType = determineVariableType(&*instruction); varDefLine = determineVariableDefLine(&*instruction); @@ -2114,7 +2114,7 @@ Type *DiscoPoP::pointsToStruct(PointerType *PTy) { return structType->getTypeID() == Type::StructTyID ? structType : NULL; } -string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVariable /*=defaultIsGlobalVariableValue*/) +string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVariable /*=defaultIsGlobalVariableValue*/, bool disable_MetadataMap) { assert(I && "Instruction cannot be NULL \n"); @@ -2126,7 +2126,7 @@ string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVari if (operand == NULL) { string retVal = getOrInsertVarName_static("", builder); - if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end()) { + if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end() || disable_MetadataMap) { return retVal; // not found } else { return trueVarNamesFromMetadataMap[retVal]; // found @@ -2141,7 +2141,7 @@ string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVari //MOHAMMAD ADDED THIS FOR CHECKING isGlobalVariable = true; string retVal = string(operand->getName()); - if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end()) { + if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end() || disable_MetadataMap) { return retVal; // not found } else { return trueVarNamesFromMetadataMap[retVal]; // found @@ -2172,7 +2172,7 @@ string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVari if (ret.size() > 0) { string retVal = ret; - if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end()) { + if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end() || disable_MetadataMap) { return retVal; // not found } else { return trueVarNamesFromMetadataMap[retVal]; // found @@ -2181,7 +2181,7 @@ string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVari else { string retVal = getOrInsertVarName_static("", builder); - if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end()) { + if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end() || disable_MetadataMap) { return retVal; // not found } else { return trueVarNamesFromMetadataMap[retVal]; // found @@ -2196,12 +2196,12 @@ string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVari // we've found an array if (PTy->getPointerElementType()->getTypeID() == Type::ArrayTyID && isa(*ptrOperand)) { - return determineVariableName_static((Instruction *)ptrOperand, isGlobalVariable); + return determineVariableName_static((Instruction *)ptrOperand, isGlobalVariable, false); } - return determineVariableName_static((Instruction *)gep, isGlobalVariable); + return determineVariableName_static((Instruction *)gep, isGlobalVariable, false); } string retVal = string(operand->getName().data()); - if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end()) { + if (trueVarNamesFromMetadataMap.find(retVal) == trueVarNamesFromMetadataMap.end() || disable_MetadataMap) { return retVal; // not found } else { return trueVarNamesFromMetadataMap[retVal]; // found @@ -2211,7 +2211,7 @@ string DiscoPoP::determineVariableName_static(Instruction *I, bool &isGlobalVari if (isa(*operand) || isa(*operand)) { - return determineVariableName_static((Instruction *)(operand), isGlobalVariable); + return determineVariableName_static((Instruction *)(operand), isGlobalVariable, false); } // if we cannot determine the name, then return * return ""; //getOrInsertVarName("*", builder); diff --git a/DiscoPoP/DiscoPoP.hpp b/DiscoPoP/DiscoPoP.hpp index 616a61f99..e5bfbbfae 100644 --- a/DiscoPoP/DiscoPoP.hpp +++ b/DiscoPoP/DiscoPoP.hpp @@ -246,7 +246,7 @@ namespace { Value *determineVariableName_dynamic(Instruction *const I); - string determineVariableName_static(Instruction *I, bool &isGlobalVariable /*=defaultIsGlobalVariableValue*/); + string determineVariableName_static(Instruction *I, bool &isGlobalVariable /*=defaultIsGlobalVariableValue*/, bool disable_MetadataMap); void getTrueVarNamesFromMetadata(Region *TopRegion, Node *root, std::map *trueVarNamesFromMetadataMap); diff --git a/VERSION b/VERSION index e9307ca57..50ffc5aa7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.2 +2.0.3 diff --git a/discopop_explorer/_version.py b/discopop_explorer/_version.py index 0309ae290..5fa9130a6 100644 --- a/discopop_explorer/_version.py +++ b/discopop_explorer/_version.py @@ -1 +1 @@ -__version__ = "2.0.2" +__version__ = "2.0.3" diff --git a/discopop_explorer/utils.py b/discopop_explorer/utils.py index cf6b93810..2cb142d0b 100644 --- a/discopop_explorer/utils.py +++ b/discopop_explorer/utils.py @@ -520,9 +520,9 @@ def classify_loop_variables( waw.update(__get_dep_of_type(pet, sub_node, DepType.WAW, False)) rev_raw.update(__get_dep_of_type(pet, sub_node, DepType.RAW, True)) - # vars = pet.get_undefined_variables_inside_loop(loop) + vars = pet.get_undefined_variables_inside_loop(loop) sub = pet.subtree_of_type(loop, NodeType.CU) - vars = list(pet.get_variables(sub)) + # vars = list(pet.get_variables(sub)) for var in vars: if is_loop_index2(pet, loop, var.name): private.append(var) diff --git a/discopop_profiler/_version.py b/discopop_profiler/_version.py index 0309ae290..5fa9130a6 100644 --- a/discopop_profiler/_version.py +++ b/discopop_profiler/_version.py @@ -1 +1 @@ -__version__ = "2.0.2" +__version__ = "2.0.3" diff --git a/discopop_wizard/classes/ExecutionConfiguration.py b/discopop_wizard/classes/ExecutionConfiguration.py index 530d154e0..ff3c8c4c6 100644 --- a/discopop_wizard/classes/ExecutionConfiguration.py +++ b/discopop_wizard/classes/ExecutionConfiguration.py @@ -271,6 +271,7 @@ def save_changes(self, wizard, main_screen_obj, self.executable_arguments = executable_args.get() self.make_flags = make_flags.get() self.project_path = project_path.get() + self.working_copy_path = self.project_path + "/.discopop" self.linker_flags = project_linker_flags.get() self.make_target = make_target.get() self.notes = additional_notes.get("1.0", tk.END) diff --git a/discopop_wizard/classes/Settings.py b/discopop_wizard/classes/Settings.py index 5c4438b10..ed7ef3c52 100644 --- a/discopop_wizard/classes/Settings.py +++ b/discopop_wizard/classes/Settings.py @@ -27,13 +27,13 @@ class Settings(object): def __init__(self) -> None: # try and find default values for executables - self.clang = shutil.which("clang") - self.clangpp = shutil.which("clang++") - self.llvm_ar = shutil.which("llvm-ar-11") - self.llvm_link = shutil.which("llvm-link-11") - self.llvm_dis = shutil.which("llvm-dis-11") - self.llvm_opt = shutil.which("opt-11") - self.llvm_llc = shutil.which("llc-11") + self.llvm_llc = "" if shutil.which("llc-11") is None else shutil.which("llc-11") + self.llvm_opt = "" if shutil.which("opt-11") is None else shutil.which("opt-11") + self.llvm_dis = "" if shutil.which("llvm-dis-11") is None else shutil.which("llvm-dis-11") + self.llvm_link = "" if shutil.which("llvm-link-11") is None else shutil.which("llvm-link-11") + self.llvm_ar = "" if shutil.which("llvm-ar-11") is None else shutil.which("llvm-ar-11") + self.clangpp = "" if shutil.which("clang++") is None else shutil.which("clang++") + self.clang = "" if shutil.which("clang") is None else shutil.which("clang") def init_from_values(self, values: dict): """values stems from reading the 'add_configuration' form.""" diff --git a/discopop_wizard/requirements.txt b/discopop_wizard/requirements.txt index f17605921..61c93cbd5 100644 --- a/discopop_wizard/requirements.txt +++ b/discopop_wizard/requirements.txt @@ -6,4 +6,5 @@ # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. -tk \ No newline at end of file +tk +jsons \ No newline at end of file diff --git a/docs/How_to_contribute.md b/docs/How_to_contribute.md index 31ea2b49c..1d3d644b6 100644 --- a/docs/How_to_contribute.md +++ b/docs/How_to_contribute.md @@ -21,19 +21,21 @@ The process is identical to the previously mentioned process for contributors wh The process to solve an already known issue (bug or feature request) is basically identical to the previously described process. However, instead of creating a fork of the repository please create a branch with a descriptive name, which allows to understand it's purpose and it's relation to the targeted issue. A good and easy option for this is to use the `Create a branch` link which can be found in the `Development` section of each issue. +Follow the instructions for determining the Version number depending on the contents of your branch and create a pull request to the respective release branch. ## Creating a new release Execute the following steps in order to create a new DiscoPoP release: +- Switch to the release branch (e.g. `release/1.2.3`) which shall be released - Update the version files in the repository -- Create a branch of the `master` with the name `release/1.2.3` -- Create a tag on the newly created branch with the name `v1.2.3` - - Creating the tag triggers the automatic publication of the project to PyPi -- Create a draft for the new release - - Release target: the newly created branch `release/1.2.3` - - Release tag: `v1.2.3` - - Release title: `Version 1.2.3` - - Description should contain a summary of the most relevant changes -- If everything is fine, create the new release +- Create a pull request to the `master` branch and validate the changes +- Merge the pull request and create a tag on the `master` branch with the name `v1.2.3` + - Creating the tag triggers the automatic publication of the project to PyPi + - Creating the tag triggers the automatic creation of a release draft +- Update the newly created release draft + - Release tag: `v1.2.3` + - Release title: `Version 1.2.3` + - Description should contain a summary of the most relevant changes +- If everything is fine, publish the new release ### Determining the Version Number Lets assume a current version number `1.2.3`. diff --git a/scripts/runDiscoPoP b/scripts/runDiscoPoP index e92d2495e..ebcdaa7e0 100755 --- a/scripts/runDiscoPoP +++ b/scripts/runDiscoPoP @@ -82,6 +82,15 @@ log () { esac } +log_or_fail () { + RETVAL=$? + log $1 "$2\n" + if [ $RETVAL -ne 0 ]; then + log -e "Exiting script with code: ${RETVAL}" + exit $RETVAL + fi +} + ##### # Parse Arguments # based on https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash @@ -301,10 +310,10 @@ rm -f $PROJECT/${EXECUTABLE_NAME}_dp_dep.txt # build using gllvm as compiler log -i "Building your application..." -log -d "\n$(make CC=$GLLVM/gclang CXX=$GLLVM/gclang++ LD=$GLLVM/gclang++ $MAKE_FLAGS $MAKEFILE_TARGET)" +log_or_fail -d "\n$(make CC=$GLLVM/gclang CXX=$GLLVM/gclang++ LD=$GLLVM/gclang++ $MAKE_FLAGS $MAKEFILE_TARGET)" # create single .bc and .ll from the executable -log -v "$($GLLVM/get-bc -b -m -v $EXECUTABLE_NAME 2>&1)" +log_or_fail -v "$($GLLVM/get-bc -b -m -v $EXECUTABLE_NAME 2>&1)" $LLVM_DIS ${EXECUTABLE_NAME}.bc -o ${EXECUTABLE_NAME}.ll #####