Skip to content

Commit 79c1f64

Browse files
authored
Update to Clang 19 on GHA and resolve lint issues (#58)
This PR updates Ubuntu and Clang on GHA. It also resolves the various new lint issues.
2 parents 6486ada + b868da4 commit 79c1f64

24 files changed

+149
-136
lines changed

.clang-tidy

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Checks: '*,
33
-altera-id-dependent-backward-branch,
44
-altera-unroll-loops,
5+
-boost-use-ranges,
56
-bugprone-casting-through-void,
67
-bugprone-easily-swappable-parameters,
78
-bugprone-reserved-identifier,
@@ -59,6 +60,7 @@ Checks: '*,
5960
-readability-identifier-length,
6061
-readability-magic-numbers,
6162
-readability-redundant-inline-specifier,
63+
-readability-use-std-min-max,
6264
'
6365
WarningsAsErrors: '*'
6466
HeaderFilterRegex: '^.*/src/.*$'

.github/workflows/ci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
test_soms:
7-
runs-on: ubuntu-22.04
7+
runs-on: ubuntu-24.04
88
# continue-on-error: true
99
strategy:
1010
fail-fast: false # we want all jobs to run, because they may fail independently
@@ -26,24 +26,24 @@ jobs:
2626
run: |
2727
sudo apt-get install libcppunit-dev
2828
29-
- name: Install Clang 18
29+
- name: Install Clang 19
3030
run: |
3131
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
32-
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
32+
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
3333
sudo apt-get update
34-
sudo apt-get install -y clang-18 clang-tidy-18
34+
sudo apt-get install -y clang-19 clang-tidy-19
3535
if: matrix.compiler == 'clang'
3636

3737
- name: Install Clang Format
38-
run: sudo apt-get install -y clang-format-18
38+
run: sudo apt-get install -y clang-format-19
3939
if: matrix.compiler == 'clang' && matrix.gc == 'GENERATIONAL'
4040

4141
- name: Build SOM VM
4242
run: |
4343
if [ "${{ matrix.compiler }}" = "clang" ]
4444
then
45-
export CC=clang-18
46-
export CXX=clang++-18
45+
export CC=clang-19
46+
export CXX=clang++-19
4747
else
4848
export CC=gcc
4949
export CXX=g++
@@ -68,12 +68,12 @@ jobs:
6868
- name: Clang Tidy
6969
if: matrix.compiler == 'clang'
7070
run: |
71-
clang-tidy-18 --config-file=.clang-tidy src/**/*.cpp -- -fdiagnostics-absolute-paths -DGC_TYPE=${{ matrix.gc}} ${{ matrix.integers }} -DUNITTESTS
71+
clang-tidy-19 --config-file=.clang-tidy src/**/*.cpp -- -fdiagnostics-absolute-paths -DGC_TYPE=${{ matrix.gc}} ${{ matrix.integers }} -DUNITTESTS
7272
7373
- name: Clang Format
7474
if: matrix.compiler == 'clang' && matrix.gc == 'GENERATIONAL'
7575
run: |
76-
clang-format-18 --dry-run --style=file --Werror src/*.cpp src/**/*.cpp src/**/*.h
76+
clang-format-19 --dry-run --style=file --Werror src/*.cpp src/**/*.cpp src/**/*.h
7777
7878
# Disabled because it's too slow with the sanitizers
7979
# - name: Test SomSom

lint.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
2-
clang-format-mp-18 -i --style=file --Werror src/*.cpp src/**/*.cpp src/**/*.h
3-
clang-tidy-mp-18 --config-file=.clang-tidy src/**/*.cpp \
2+
clang-format-mp-19 -i --style=file --Werror src/*.cpp src/**/*.cpp src/**/*.h
3+
clang-tidy-mp-19 --config-file=.clang-tidy src/**/*.cpp \
44
--fix \
55
-- -I/opt/local/include/ -fdiagnostics-absolute-paths \
66
-DGC_TYPE=GENERATIONAL -DUSE_TAGGING=false -DCACHE_INTEGER=false -DUNITTESTS
7-
clang-format-mp-18 -i --style=file --Werror src/*.cpp src/**/*.cpp src/**/*.h
7+
clang-format-mp-19 -i --style=file --Werror src/*.cpp src/**/*.cpp src/**/*.h

rebench.conf

+53-53
Original file line numberDiff line numberDiff line change
@@ -22,94 +22,94 @@ benchmark_suites:
2222
command: "-H16MB -cp Smalltalk:Examples/Benchmarks/Richards:Examples/Benchmarks/DeltaBlue:Examples/Benchmarks/NBody:Examples/Benchmarks/Json:Examples/Benchmarks/GraphSearch Examples/Benchmarks/BenchmarkHarness.som %(benchmark)s %(iterations)s "
2323
iterations: 10
2424
benchmarks:
25-
- Richards: {iterations: 5, extra_args: 1, machines: [yuria3]}
26-
- DeltaBlue: {extra_args: 500, machines: [yuria2]}
27-
- NBody: {extra_args: 5000, machines: [yuria3]}
28-
- JsonSmall: {extra_args: 10, machines: [yuria ]}
29-
- GraphSearch: {extra_args: 7, machines: [yuria2]}
30-
- PageRank: {extra_args: 150, machines: [yuria3]}
25+
- Richards: {iterations: 5, extra_args: 1, tags: [yuria3]}
26+
- DeltaBlue: {extra_args: 500, tags: [yuria2]}
27+
- NBody: {extra_args: 5000, tags: [yuria3]}
28+
- JsonSmall: {extra_args: 10, tags: [yuria ]}
29+
- GraphSearch: {extra_args: 7, tags: [yuria2]}
30+
- PageRank: {extra_args: 150, tags: [yuria3]}
3131

3232
micro:
3333
gauge_adapter: RebenchLog
3434
command: "-cp Smalltalk:Examples/Benchmarks/LanguageFeatures:Examples/Benchmarks/TestSuite Examples/Benchmarks/BenchmarkHarness.som %(benchmark)s %(iterations)s "
3535
iterations: 10
3636
benchmarks:
37-
- Fannkuch: {extra_args: 7, machines: [yuria ]}
38-
- Fibonacci: {extra_args: 3, machines: [yuria2]}
39-
- Dispatch: {extra_args: 20, machines: [yuria3]}
40-
- Bounce: {extra_args: 10, machines: [yuria ]}
41-
- Loop: {extra_args: 50, machines: [yuria2]}
42-
- Permute: {extra_args: 3, machines: [yuria3]}
43-
- Queens: {extra_args: 10, machines: [yuria ]}
44-
- List: {extra_args: 2, machines: [yuria2]}
45-
- Recurse: {extra_args: 3, machines: [yuria3]}
46-
- Storage: {extra_args: 8, machines: [yuria ]}
47-
- Sieve: {extra_args: 4, machines: [yuria2]}
48-
- BubbleSort: {extra_args: 30, machines: [yuria3]}
49-
- QuickSort: {extra_args: 12, machines: [yuria ]}
50-
- Sum: {extra_args: 20, machines: [yuria2]}
51-
- Towers: {extra_args: 2, machines: [yuria3]}
52-
- TreeSort: {extra_args: 10, machines: [yuria ]}
53-
- IntegerLoop: {extra_args: 10, machines: [yuria2]}
54-
- FieldLoop: {extra_args: 5, machines: [yuria3]}
55-
- WhileLoop: {extra_args: 100, machines: [yuria ]}
56-
- Mandelbrot: {extra_args: 100, machines: [yuria2]}
37+
- Fannkuch: {extra_args: 7, tags: [yuria ]}
38+
- Fibonacci: {extra_args: 3, tags: [yuria2]}
39+
- Dispatch: {extra_args: 20, tags: [yuria3]}
40+
- Bounce: {extra_args: 10, tags: [yuria ]}
41+
- Loop: {extra_args: 50, tags: [yuria2]}
42+
- Permute: {extra_args: 3, tags: [yuria3]}
43+
- Queens: {extra_args: 10, tags: [yuria ]}
44+
- List: {extra_args: 2, tags: [yuria2]}
45+
- Recurse: {extra_args: 3, tags: [yuria3]}
46+
- Storage: {extra_args: 8, tags: [yuria ]}
47+
- Sieve: {extra_args: 4, tags: [yuria2]}
48+
- BubbleSort: {extra_args: 30, tags: [yuria3]}
49+
- QuickSort: {extra_args: 12, tags: [yuria ]}
50+
- Sum: {extra_args: 20, tags: [yuria2]}
51+
- Towers: {extra_args: 2, tags: [yuria3]}
52+
- TreeSort: {extra_args: 10, tags: [yuria ]}
53+
- IntegerLoop: {extra_args: 10, tags: [yuria2]}
54+
- FieldLoop: {extra_args: 5, tags: [yuria3]}
55+
- WhileLoop: {extra_args: 100, tags: [yuria ]}
56+
- Mandelbrot: {extra_args: 100, tags: [yuria2]}
5757

58-
# - Test: {invocations: 5, iterations: 1, machines: [yuria2]}
59-
- TestGC: {invocations: 5, iterations: 1, extra_args: 100, machines: [yuria2]}
58+
# - Test: {invocations: 5, iterations: 1, tags: [yuria2]}
59+
- TestGC: {invocations: 5, iterations: 1, extra_args: 100, tags: [yuria2]}
6060

6161
awfy:
6262
gauge_adapter: RebenchLog
6363
command: "-cp Examples/AreWeFastYet/CD:Examples/AreWeFastYet/Havlak:Examples/AreWeFastYet/Core:Smalltalk Examples/AreWeFastYet/Harness.som --gc %(benchmark)s %(iterations)s "
6464
iterations: 1
6565
invocations: 5
6666
benchmarks:
67-
- CD: {extra_args: 10, machines: [yuria2]}
68-
# - Havlak: {extra_args: 1, machines: [yuria3]}
67+
- CD: {extra_args: 10, tags: [yuria2]}
68+
# - Havlak: {extra_args: 1, tags: [yuria3]}
6969

7070
micro-somsom:
7171
gauge_adapter: RebenchLog
7272
command: "-cp Smalltalk:Examples/Benchmarks/LanguageFeatures Examples/Benchmarks/BenchmarkHarness.som --gc %(benchmark)s %(iterations)s "
7373
iterations: 1
7474
invocations: 5
7575
benchmarks:
76-
- Loop: {extra_args: 40, machines: [yuria3]}
77-
- Queens: {extra_args: 10, machines: [yuria2]}
78-
- List: {extra_args: 10, machines: [yuria2]}
79-
- Recurse: {extra_args: 10, machines: [yuria3]}
80-
- Mandelbrot: {extra_args: 50, machines: [yuria3]}
76+
- Loop: {extra_args: 40, tags: [yuria3]}
77+
- Queens: {extra_args: 10, tags: [yuria2]}
78+
- List: {extra_args: 10, tags: [yuria2]}
79+
- Recurse: {extra_args: 10, tags: [yuria3]}
80+
- Mandelbrot: {extra_args: 50, tags: [yuria3]}
8181

8282
som-parse:
8383
gauge_adapter: RebenchLog
8484
command: "-cp Smalltalk:Examples:Examples/Benchmarks/DeltaBlue:Examples/Benchmarks/GraphSearch:Examples/Benchmarks/Json:Examples/Benchmarks/NBody:TestSuite:core-lib/SomSom/tests:core-lib/SomSom/src/vmobjects:core-lib/SomSom/src/primitives:core-lib/SomSom/src/compiler Examples/Benchmarks/BenchmarkHarness.som --gc %(benchmark)s %(iterations)s "
8585
iterations: 1!
8686
invocations: 5
8787
benchmarks:
88-
- SomParse: {extra_args: 1, machines: [yuria2]}
89-
- SomInit: {extra_args: 10000, machines: [yuria2]}
88+
- SomParse: {extra_args: 1, tags: [yuria2]}
89+
- SomInit: {extra_args: 10000, tags: [yuria2]}
9090

9191
interpreter:
9292
description: Basic interpreter benchmarks for comparing performance of most basic concepts.
9393
gauge_adapter: RebenchLog
9494
invocations: 5
9595
command: "-cp Smalltalk:Examples/Benchmarks/Interpreter Examples/Benchmarks/BenchmarkHarness.som %(benchmark)s %(iterations)s "
9696
benchmarks:
97-
- ArgRead: {extra_args: 5, machines: [yuria2]}
98-
- ArrayReadConst: {extra_args: 5, machines: [yuria2]}
99-
- ArrayWriteConstConst: {extra_args: 5, machines: [yuria2]}
100-
- BlockSend0ConstReturn: {extra_args: 2, machines: [yuria2]}
101-
- Const: {extra_args: 5, machines: [yuria2]}
102-
- FieldConstWrite: {extra_args: 5, machines: [yuria2]}
103-
- FieldRead: {extra_args: 5, machines: [yuria2]}
104-
- FieldReadIncWrite: {extra_args: 2, machines: [yuria2]}
105-
- FieldReadWrite: {extra_args: 5, machines: [yuria3]}
106-
- GlobalRead: {extra_args: 5, machines: [yuria3]}
107-
- LocalConstWrite: {extra_args: 5, machines: [yuria3]}
108-
- LocalRead: {extra_args: 5, machines: [yuria3]}
109-
- LocalReadIncWrite: {extra_args: 5, machines: [yuria3]}
110-
- LocalReadWrite: {extra_args: 5, machines: [yuria3]}
111-
- SelfSend0: {extra_args: 2, machines: [yuria3]}
112-
- SelfSend0BlockConstNonLocalReturn: {extra_args: 1, machines: [yuria3]}
97+
- ArgRead: {extra_args: 5, tags: [yuria2]}
98+
- ArrayReadConst: {extra_args: 5, tags: [yuria2]}
99+
- ArrayWriteConstConst: {extra_args: 5, tags: [yuria2]}
100+
- BlockSend0ConstReturn: {extra_args: 2, tags: [yuria2]}
101+
- Const: {extra_args: 5, tags: [yuria2]}
102+
- FieldConstWrite: {extra_args: 5, tags: [yuria2]}
103+
- FieldRead: {extra_args: 5, tags: [yuria2]}
104+
- FieldReadIncWrite: {extra_args: 2, tags: [yuria2]}
105+
- FieldReadWrite: {extra_args: 5, tags: [yuria3]}
106+
- GlobalRead: {extra_args: 5, tags: [yuria3]}
107+
- LocalConstWrite: {extra_args: 5, tags: [yuria3]}
108+
- LocalRead: {extra_args: 5, tags: [yuria3]}
109+
- LocalReadIncWrite: {extra_args: 5, tags: [yuria3]}
110+
- LocalReadWrite: {extra_args: 5, tags: [yuria3]}
111+
- SelfSend0: {extra_args: 2, tags: [yuria3]}
112+
- SelfSend0BlockConstNonLocalReturn: {extra_args: 1, tags: [yuria3]}
113113

114114
executors:
115115
som-gcc-generational-inttag: {path: ., executable: som-gcc-generational-inttag }

src/compiler/MethodGenerationContext.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ int64_t MethodGenerationContext::GetFieldIndex(VMSymbol* field) {
298298
return idx;
299299
}
300300

301-
bool Contains(std::vector<Variable>& vec, std::string& name) {
301+
static bool Contains(std::vector<Variable>& vec, std::string& name) {
302302
for (Variable const& v : vec) {
303303
if (v.IsNamed(name)) {
304304
return true;
@@ -308,7 +308,7 @@ bool Contains(std::vector<Variable>& vec, std::string& name) {
308308
return false;
309309
}
310310

311-
int64_t IndexOf(std::vector<Variable>& vec, std::string& name) {
311+
static int64_t IndexOf(std::vector<Variable>& vec, std::string& name) {
312312
int64_t i = 0;
313313
for (Variable const& v : vec) {
314314
if (v.IsNamed(name)) {

src/compiler/Parser.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,15 @@ void Parser::genPopVariable(MethodGenerationContext& mgenc, std::string& var) {
180180
// grammar
181181
//
182182

183-
Symbol singleOpSyms[] = {Not, And, Or, Star, Div, Mod, Plus, Equal,
184-
More, Less, Comma, At, Per, Minus, NONE};
183+
static Symbol singleOpSyms[] = {Not, And, Or, Star, Div,
184+
Mod, Plus, Equal, More, Less,
185+
Comma, At, Per, Minus, NONE};
185186

186-
Symbol binaryOpSyms[] = {Or, Comma, Minus, Equal, Not, And, Or, Star, Div,
187-
Mod, Plus, Equal, More, Less, Comma, At, Per, NONE};
187+
static Symbol binaryOpSyms[] = {Or, Comma, Minus, Equal, Not, And,
188+
Or, Star, Div, Mod, Plus, Equal,
189+
More, Less, Comma, At, Per, NONE};
188190

189-
Symbol keywordSelectorSyms[] = {Keyword, KeywordSequence};
191+
static Symbol keywordSelectorSyms[] = {Keyword, KeywordSequence};
190192

191193
void Parser::Classdef(ClassGenerationContext& cgenc) {
192194
cgenc.SetName(SymbolFor(text));

src/interpreter/Interpreter.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ vm_oop_t Interpreter::StartAndPrintBytecodes() {
7878

7979
vm_oop_t Interpreter::Start() {
8080
#undef PROLOGUE
81-
#define PROLOGUE(bcCount) \
82-
{ bytecodeIndexGlobal += (bcCount); }
81+
#define PROLOGUE(bcCount) \
82+
{ \
83+
bytecodeIndexGlobal += (bcCount); \
84+
}
8385
#define HACK_INLINE_START
8486
#include "InterpreterLoop.h"
8587
#undef HACK_INLINE_START

src/interpreter/Interpreter.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
#include "../vmobjects/VMFrame.h"
3232
#include "../vmobjects/VMMethod.h"
3333

34-
#define DISPATCH_NOGC() \
35-
{ goto* loopTargets[currentBytecodes[bytecodeIndexGlobal]]; }
34+
#define DISPATCH_NOGC() \
35+
{ \
36+
goto* loopTargets[currentBytecodes[bytecodeIndexGlobal]]; \
37+
}
3638

3739
#define DISPATCH_GC() \
3840
{ \

src/memory/Heap.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* macro for padding - only word-aligned memory must be allocated
3939
*/
4040
#define PADDED_SIZE(N) \
41-
((((size_t)(N)) + (sizeof(void*) - 1) & ~(sizeof(void*) - 1)))
41+
(((((size_t)(N)) + (sizeof(void*) - 1)) & ~(sizeof(void*) - 1)))
4242

4343
#define IS_PADDED_SIZE(N) ((N) == PADDED_SIZE((N)))
4444

@@ -47,11 +47,15 @@ using namespace std;
4747
template <class HEAP_T>
4848
class Heap {
4949
friend class GarbageCollector<HEAP_T>;
50+
friend HEAP_T;
51+
52+
private:
53+
explicit Heap(GarbageCollector<HEAP_T>* const gc) : gc(gc) {}
5054

5155
public:
5256
static void InitializeHeap(size_t objectSpaceSize);
5357
static void DestroyHeap();
54-
explicit Heap(GarbageCollector<HEAP_T>* const gc) : gc(gc) {}
58+
5559
~Heap();
5660
inline void requestGC() { gcWasRequested = true; }
5761
inline void resetGCTrigger() { gcWasRequested = false; }

src/misc/Timer.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ static int64_t get_microseconds() {
88
#if defined(CLOCK_PROCESS_CPUTIME_ID)
99
// this is for Linux
1010
timespec now{};
11-
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &now);
11+
if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &now) != 0) {
12+
return -1;
13+
}
1214

1315
return (now.tv_sec * 1000 * 1000) + // seconds
1416
(now.tv_nsec / 1000); // nanoseconds

src/primitives/Double.h

+3
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ class _Double : public PrimitiveContainer {
3333
public:
3434
_Double();
3535
};
36+
37+
double coerceDouble(vm_oop_t x);
38+
vm_oop_t dblPercent(vm_oop_t leftPtr, vm_oop_t rightObj);

src/primitives/Integer.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,12 @@
4141
#include "../vmobjects/VMDouble.h"
4242
#include "../vmobjects/VMFrame.h"
4343
#include "../vmobjects/VMString.h"
44+
#include "Double.h"
4445

4546
//
4647
// arithmetic operations
4748
//
4849

49-
double coerceDouble(vm_oop_t x);
50-
5150
#define doDoubleOpIfNeeded(leftInt, rightObj, op) \
5251
{ \
5352
VMClass* cl = CLASS_OF(rightObj); \
@@ -146,8 +145,6 @@ static vm_oop_t intPercent(vm_oop_t leftObj, vm_oop_t rightObj) {
146145
return NEW_INT(result);
147146
}
148147

149-
vm_oop_t dblPercent(vm_oop_t leftPtr, vm_oop_t rightObj);
150-
151148
static vm_oop_t intRem(vm_oop_t leftObj, vm_oop_t rightObj) {
152149
VMClass* cl = CLASS_OF(rightObj);
153150
if (cl == load_ptr(doubleClass)) {
@@ -157,7 +154,7 @@ static vm_oop_t intRem(vm_oop_t leftObj, vm_oop_t rightObj) {
157154
auto const l = INT_VAL(leftObj);
158155
auto const r = INT_VAL(rightObj);
159156

160-
int64_t const result = l - (l / r) * r;
157+
int64_t const result = l - ((l / r) * r);
161158

162159
return NEW_INT(result);
163160
}

src/primitives/Method.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static vm_oop_t mSignature(vm_oop_t rcvr) {
1919
return self->GetSignature();
2020
}
2121

22-
void mInvokeOnWith(VMFrame* frame) {
22+
static void mInvokeOnWith(VMFrame* frame) {
2323
// REM: this is a clone with _Primitive::InvokeOn_With_
2424
auto* args = static_cast<VMArray*>(frame->Pop());
2525
auto* rcvr = frame->Pop();

0 commit comments

Comments
 (0)