Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime cxxmodules aarch64 #215

Open
wants to merge 12 commits into
base: cms/master/2c8521e17d
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions cmake/modules/RootBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,6 @@ elseif(APPLE)
set(x11_defvalue OFF)
endif()

# Current limitations for modules:
#---Modules are disabled on aarch64 platform (due ODR violations)
if(CMAKE_SYSTEM_PROCESSOR MATCHES aarch64)
set(runtime_cxxmodules_defvalue OFF)
endif()

# builtin_openssl is only supported on macOS
if(builtin_openssl AND NOT APPLE)
message(FATAL_ERROR ">>> Option 'builtin_openssl' is only supported on macOS.")
Expand Down
2 changes: 1 addition & 1 deletion core/base/src/TUrl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void TUrl::SetUrl(const char *url, Bool_t defaultIsFile)
// allow url of form: "proto://"
} else {
if (defaultIsFile) {
const std::size_t bufferSize = strlen("file:") + strlen(u0) + 1;
const std::size_t bufferSize = std::char_traits<char>::length("file:") + strlen(u0) + 1;
char *newu = new char [bufferSize];
snprintf(newu, bufferSize, "file:%s", u0);
delete [] u0;
Expand Down
63 changes: 34 additions & 29 deletions core/foundation/src/TClassEdit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@ bool TClassEdit::IsDefAlloc(const char *allocname, const char *classname)
string_view a( allocname );
// In Windows, allocname might be 'class const std::allocator<int>',
// (never 'const class ...'), so we start by stripping the 'class ', if any
constexpr static int clalloclen = std::char_traits<char>::length("class ");
constexpr auto length = std::char_traits<char>::length;
constexpr static int clalloclen = length("class ");
if (a.compare(0,clalloclen,"class ") == 0) {
a.remove_prefix(clalloclen);
}
Expand All @@ -634,7 +635,7 @@ bool TClassEdit::IsDefAlloc(const char *allocname, const char *classname)
if (a=="__default_alloc_template<true,0>") return true;
if (a=="__malloc_alloc_template<0>") return true;

constexpr static int alloclen = std::char_traits<char>::length("allocator<");
constexpr static int alloclen = length("allocator<");
if (a.compare(0,alloclen,"allocator<") != 0) {
return false;
}
Expand Down Expand Up @@ -683,15 +684,16 @@ bool TClassEdit::IsDefAlloc(const char *allocname,
string_view a( allocname );
RemoveStd(a);

constexpr static int alloclen = std::char_traits<char>::length("allocator<");
constexpr auto length = std::char_traits<char>::length;
constexpr static int alloclen = length("allocator<");
if (a.compare(0,alloclen,"allocator<") != 0) {
return false;
}
a.remove_prefix(alloclen);

RemoveStd(a);

constexpr static int pairlen = std::char_traits<char>::length("pair<");
constexpr static int pairlen = length("pair<");
if (a.compare(0,pairlen,"pair<") != 0) {
return false;
}
Expand Down Expand Up @@ -1082,8 +1084,10 @@ int TClassEdit::GetSplit(const char *type, vector<string>& output, int &nestedLo
if (full.compare(offset, 5, "std::") == 0) {
offset += 5;
}
static const char* char_traits_s = "char_traits<char>";
static const unsigned int char_traits_len = strlen(char_traits_s);
constexpr auto char_traits_s = "char_traits<char>";
// or
// static constexpr char const* const char_traits_s = "char_traits<char>";
static constexpr unsigned int char_traits_len = std::char_traits<char>::length(char_traits_s);
if (full.compare(offset, char_traits_len, char_traits_s) == 0) {
offset += char_traits_len;
if ( full[offset] == '>') {
Expand Down Expand Up @@ -1347,7 +1351,7 @@ bool TClassEdit::IsInterpreterDetail(const char *type)
bool TClassEdit::IsSTLBitset(const char *classname)
{
size_t offset = StdLen(classname);
if ( strncmp(classname+offset,"bitset<",strlen("bitset<"))==0) return true;
if ( strncmp(classname+offset,"bitset<",std::char_traits<char>::length("bitset<"))==0) return true;
return false;
}

Expand Down Expand Up @@ -1424,32 +1428,33 @@ int TClassEdit::IsSTLCont(const char *type, int testAlloc)

bool TClassEdit::IsStdClass(const char *classname)
{
constexpr auto length = std::char_traits<char>::length;
classname += StdLen( classname );
if ( strcmp(classname,"string")==0 ) return true;
if ( strncmp(classname,"bitset<",strlen("bitset<"))==0) return true;
if ( strncmp(classname,"bitset<",length("bitset<"))==0) return true;
if ( IsStdPair(classname) ) return true;
if ( strcmp(classname,"allocator")==0) return true;
if ( strncmp(classname,"allocator<",strlen("allocator<"))==0) return true;
if ( strncmp(classname,"greater<",strlen("greater<"))==0) return true;
if ( strncmp(classname,"less<",strlen("less<"))==0) return true;
if ( strncmp(classname,"equal_to<",strlen("equal_to<"))==0) return true;
if ( strncmp(classname,"hash<",strlen("hash<"))==0) return true;
if ( strncmp(classname,"auto_ptr<",strlen("auto_ptr<"))==0) return true;

if ( strncmp(classname,"vector<",strlen("vector<"))==0) return true;
if ( strncmp(classname,"list<",strlen("list<"))==0) return true;
if ( strncmp(classname,"forward_list<",strlen("forward_list<"))==0) return true;
if ( strncmp(classname,"deque<",strlen("deque<"))==0) return true;
if ( strncmp(classname,"map<",strlen("map<"))==0) return true;
if ( strncmp(classname,"multimap<",strlen("multimap<"))==0) return true;
if ( strncmp(classname,"set<",strlen("set<"))==0) return true;
if ( strncmp(classname,"multiset<",strlen("multiset<"))==0) return true;
if ( strncmp(classname,"unordered_set<",strlen("unordered_set<"))==0) return true;
if ( strncmp(classname,"unordered_multiset<",strlen("unordered_multiset<"))==0) return true;
if ( strncmp(classname,"unordered_map<",strlen("unordered_map<"))==0) return true;
if ( strncmp(classname,"unordered_multimap<",strlen("unordered_multimap<"))==0) return true;
if ( strncmp(classname,"bitset<",strlen("bitset<"))==0) return true;
if ( strncmp(classname,"ROOT::VecOps::RVec<",strlen("ROOT::VecOps::RVec<"))==0) return true;
if ( strncmp(classname,"allocator<",length("allocator<"))==0) return true;
if ( strncmp(classname,"greater<",length("greater<"))==0) return true;
if ( strncmp(classname,"less<",length("less<"))==0) return true;
if ( strncmp(classname,"equal_to<",length("equal_to<"))==0) return true;
if ( strncmp(classname,"hash<",length("hash<"))==0) return true;
if ( strncmp(classname,"auto_ptr<",length("auto_ptr<"))==0) return true;

if ( strncmp(classname,"vector<",length("vector<"))==0) return true;
if ( strncmp(classname,"list<",length("list<"))==0) return true;
if ( strncmp(classname,"forward_list<",length("forward_list<"))==0) return true;
if ( strncmp(classname,"deque<",length("deque<"))==0) return true;
if ( strncmp(classname,"map<",length("map<"))==0) return true;
if ( strncmp(classname,"multimap<",length("multimap<"))==0) return true;
if ( strncmp(classname,"set<",length("set<"))==0) return true;
if ( strncmp(classname,"multiset<",length("multiset<"))==0) return true;
if ( strncmp(classname,"unordered_set<",length("unordered_set<"))==0) return true;
if ( strncmp(classname,"unordered_multiset<",length("unordered_multiset<"))==0) return true;
if ( strncmp(classname,"unordered_map<",length("unordered_map<"))==0) return true;
if ( strncmp(classname,"unordered_multimap<",length("unordered_multimap<"))==0) return true;
if ( strncmp(classname,"bitset<",length("bitset<"))==0) return true;
if ( strncmp(classname,"ROOT::VecOps::RVec<",length("ROOT::VecOps::RVec<"))==0) return true;

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion core/meta/src/TClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3220,7 +3220,7 @@ TClass *TClass::GetClass(const char *name, Bool_t load, Bool_t silent, size_t hi
return pairinfo->GetClass();
} else {
// Check if we have an STL container that might provide it.
static const size_t slen = strlen("pair");
static constexpr size_t slen = std::char_traits<char>::length("pair");
static const char *associativeContainer[] = { "map", "unordered_map", "multimap",
"unordered_multimap", "set", "unordered_set", "multiset", "unordered_multiset" };
for(auto contname : associativeContainer) {
Expand Down
2 changes: 1 addition & 1 deletion core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4096,7 +4096,7 @@ void TCling::SetClassInfo(TClass* cl, Bool_t reload, Bool_t silent)
// Handle the special case of 'tuple' where we ignore the real implementation
// details and just overlay a 'simpler'/'simplistic' version that is easy
// for the I/O to understand and handle.
if (strncmp(cl->GetName(),"tuple<",strlen("tuple<"))==0) {
if (strncmp(cl->GetName(),"tuple<",std::char_traits<char>::length("tuple<"))==0) {
if (!reload)
name = AlternateTuple(cl->GetName(), fInterpreter->getLookupHelper(), silent);
if (reload || name.empty()) {
Expand Down
7 changes: 4 additions & 3 deletions graf3d/gl/src/gl2ps.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include <stdarg.h>
#include <time.h>
#include <float.h>
#include <string>

#if defined(GL2PS_HAVE_ZLIB)
#include <zlib.h>
Expand Down Expand Up @@ -4428,10 +4429,10 @@ static int gl2psPrintPDFShaderMask(int obj, int childobj)
obj,
(int)gl2ps->viewport[0], (int)gl2ps->viewport[1],
(int)gl2ps->viewport[2], (int)gl2ps->viewport[3]);

constexpr auto length = std::char_traits<char>::length;
len = (childobj>0)
? strlen("/TrSh sh\n") + (int)log10((double)childobj)+1
: strlen("/TrSh0 sh\n");
? length("/TrSh sh\n") + (int)log10((double)childobj)+1
: length("/TrSh0 sh\n");

offs += fprintf(gl2ps->stream,
"/Length %d\n"
Expand Down
10 changes: 9 additions & 1 deletion gui/webgui6/inc/TWebPainting.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class TColor;
class TWebPainting : public TObject {

protected:
std::string fClassName; ///< class name of object produced this painting
std::string fObjectName; ///< object name
std::string fOper; ///< list of operations, separated by semicolons
Int_t fSize{0}; ///<! filled buffer size
TArrayF fBuf; ///< array of points for all operations
Expand All @@ -37,6 +39,12 @@ class TWebPainting : public TObject {
TWebPainting();
~TWebPainting() override = default;

void SetClassName(const std::string &classname) { fClassName = classname; }
const std::string &GetClassName() const { return fClassName; }

void SetObjectName(const std::string &objname) { fObjectName = objname; }
const std::string &GetObjectName() const { return fObjectName; }

Bool_t IsEmpty() const { return fOper.empty() && (fBuf.GetSize() == 0); }

void AddOper(const std::string &oper);
Expand All @@ -56,7 +64,7 @@ class TWebPainting : public TObject {
static std::string MakeTextOper(const char *str);


ClassDefOverride(TWebPainting, 1) // store for all paint operation of TVirtualPadPainter
ClassDefOverride(TWebPainting, 2) // store for all paint operation of TVirtualPadPainter
};

#endif
2 changes: 2 additions & 0 deletions gui/webgui6/src/TWebCanvas.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ void TWebCanvas::CreateObjectSnapshot(TPadWebSnapshot &master, TPad *pad, TObjec
TVirtualPS *saveps = gVirtualPS;

TWebPS ps;
ps.GetPainting()->SetClassName(obj->ClassName());
ps.GetPainting()->SetObjectName(obj->GetName());
gVirtualPS = masterps ? masterps : &ps;
if (painter)
painter->SetPainting(ps.GetPainting());
Expand Down
5 changes: 3 additions & 2 deletions hist/hist/src/HFitImpl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -760,14 +760,15 @@ void ROOT::Fit::FitOptionsMake(EFitObjectType type, const char *option, Foption_
//for robust fitting, see if # of good points is defined
// decode parameters for robust fitting
Double_t h=0;
constexpr auto length = std::char_traits<char>::length;
if (opt.Contains("H=0.")) {
int start = opt.Index("H=0.");
int numpos = start + strlen("H=0.");
int numpos = start + length("H=0.");
int numlen = 0;
int len = opt.Length();
while( (numpos+numlen<len) && isdigit(opt[numpos+numlen]) ) numlen++;
TString num = opt(numpos,numlen);
opt.Remove(start+strlen("H"),strlen("=0.")+numlen);
opt.Remove(start+length("H"),length("=0.")+numlen);
h = atof(num.Data());
h*=TMath::Power(10, -numlen);
}
Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2~dev
1.3~dev
8 changes: 4 additions & 4 deletions interpreter/cling/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ Introduction
============

This document contains the release notes for the interactive C++ interpreter
Cling, release 1.2. Cling is built on top of [Clang](http://clang.llvm.org) and
Cling, release 1.3. Cling is built on top of [Clang](http://clang.llvm.org) and
[LLVM](http://llvm.org>) compiler infrastructure. Here we
describe the status of Cling in some detail, including major
improvements from the previous release and new feature work.

Note that if you are reading this file from a git checkout or the main Cling
web page, this document applies to the *next* release, not the current one.

What's New in Cling 1.2?
What's New in Cling 1.3?
========================

Some of the major new features and improvements to Cling are listed
Expand Down Expand Up @@ -43,7 +43,7 @@ Fixed Bugs
[ROOT-XXXX](https://sft.its.cern.ch/jira/browse/ROOT-XXXX)

<!---Get release bugs
git log v1.1..master | grep -i "fix" | grep '#' | sed -E 's,.*\#([0-9]*).*,\[\1\]\(https://github.com/root-project/cling/issues/\1\),g' | sort
git log v1.2..master | grep -i "fix" | grep '#' | sed -E 's,.*\#([0-9]*).*,\[\1\]\(https://github.com/root-project/cling/issues/\1\),g' | sort
--->
<!---Standard MarkDown doesn't support neither variables nor <base>
[ROOT-XXX](https://sft.its.cern.ch/jira/browse/ROOT-XXX)
Expand All @@ -69,6 +69,6 @@ listed in the form of Firstname Lastname (#contributions):
FirstName LastName (#commits)

<!---Find contributor list for this release
git log --pretty=format:"%an" v1.1...master | sort | uniq -c | sort -rn |\
git log --pretty=format:"%an" v1.2...master | sort | uniq -c | sort -rn |\
sed -E 's,^ *([0-9]+) (.*)$,\2 \(\1\),'
--->
27 changes: 16 additions & 11 deletions interpreter/cling/lib/Interpreter/BackendPasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,24 @@ namespace {
namespace {
class PreventLocalOptPass : public PassInfoMixin<PreventLocalOptPass> {
bool runOnGlobal(GlobalValue& GV) {
if (!GV.isDeclaration())
return false; // no change.

// GV is a declaration with no definition. Make sure to prevent any
// optimization that tries to take advantage of the actual definition
// being "local" because we have no influence on the memory layout of
// data sections and how "close" they are to the code.

bool changed = false;

// Prevent any optimization that tries to take advantage of the actual
// definition being "local" because we have no influence on the memory
// layout of sections and how "close" they are.

if (GV.hasLocalLinkage()) {
GV.setLinkage(llvm::GlobalValue::ExternalLinkage);
changed = true;
if (GV.isDeclaration()) {
// For declarations with no definition, we can simply adjust the
// linkage.
GV.setLinkage(llvm::GlobalValue::ExternalLinkage);
changed = true;
} else {
// FIXME: Not clear what would be the right linkage. We also cannot
// continue because "GlobalValue with local linkage [...] must be
// dso_local!"
return false;
}
}

if (!GV.hasDefaultVisibility()) {
Expand All @@ -172,7 +177,7 @@ namespace {
}

// Set DSO locality last because setLinkage() and setVisibility() check
// isImplicitDSOLocal().
// isImplicitDSOLocal() and then might call setDSOLocal(true).
if (GV.isDSOLocal()) {
GV.setDSOLocal(false);
changed = true;
Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/lib/Interpreter/ForwardDeclPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace cling {
// FIXME: Once the C++ modules replaced the forward decls, remove this.
if (D->getASTContext().getLangOpts().Modules &&
llvm::StringRef(includeText).starts_with("include ")) {
includeText += strlen("include ");
includeText += std::char_traits<char>::length("include ");
}

assert((includeText[0] == '<' || includeText[0] == '"') &&
Expand Down
4 changes: 4 additions & 0 deletions interpreter/cling/www/news.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<body class="news">
<div>
<h3>Latest News</h3>
<h4>Cling release 1.2 is out</h4>
<h5>Dec 10th, 2024</h5>
<p> <a href="https://github.com/vgvassilev/cling/blob/v1.2/docs/ReleaseNotes.md" target="_blank">Read more</a></p>
<p></p>
<h4>Cling release 1.1 is out</h4>
<h5>Aug 28th, 2023</h5>
<p> <a href="https://github.com/vgvassilev/cling/blob/v1.1/docs/ReleaseNotes.md" target="_blank">Read more</a></p>
Expand Down
4 changes: 2 additions & 2 deletions io/io/src/TFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3086,7 +3086,7 @@ void TFile::MakeProject(const char *dirname, const char * /*classes*/,
if (info->IsA() != TStreamerInfo::Class()) {
continue;
}
if (strncmp(info->GetName(), "auto_ptr<", strlen("auto_ptr<")) == 0) {
if (strncmp(info->GetName(), "auto_ptr<", std::char_traits<char>::length("auto_ptr<")) == 0) {
continue;
}
TClass *cl = TClass::GetClass(info->GetName());
Expand Down Expand Up @@ -4129,7 +4129,7 @@ TFile *TFile::Open(const char *url, Option_t *options, const char *ftitle,
TString opts(options);
Int_t ito = opts.Index("TIMEOUT=");
if (ito != kNPOS) {
TString sto = opts(ito + strlen("TIMEOUT="), opts.Length());
TString sto = opts(ito + std::char_traits<char>::length("TIMEOUT="), opts.Length());
while (!(sto.IsDigit()) && !(sto.IsNull())) { sto.Remove(sto.Length()-1,1); }
if (!(sto.IsNull())) {
// Timeout in millisecs
Expand Down
2 changes: 1 addition & 1 deletion io/io/src/TMakeProject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ UInt_t TMakeProject::GenerateIncludeForTemplate(FILE *fp, const char *clname, ch
} else if (TClassEdit::IsStdPair(incName)) {
AddInclude(fp, "utility", kTRUE, inclist);
ninc += GenerateIncludeForTemplate(fp, incName, inclist, forward, extrainfos);
} else if (strncmp(incName.Data(), "auto_ptr<", strlen("auto_ptr<")) == 0) {
} else if (strncmp(incName.Data(), "auto_ptr<", std::char_traits<char>::length("auto_ptr<")) == 0) {
AddInclude(fp, "memory", kTRUE, inclist);
ninc += GenerateIncludeForTemplate(fp, incName, inclist, forward, extrainfos);
} else if (TClassEdit::IsStdClass(incName)) {
Expand Down
Loading