Skip to content

Commit c828b96

Browse files
Introduce stdlib.cat (#751)
Signed-off-by: Hernan Ponce de Leon <[email protected]> Co-authored-by: Hernan Ponce de Leon <[email protected]>
1 parent 7ffb695 commit c828b96

File tree

9 files changed

+21
-18
lines changed

9 files changed

+21
-18
lines changed

cat/c11-orig.cat

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Rewritten by Luc Maranget for herd7
99

1010
*)
1111

12-
include "basic.cat"
1312
include "c11_cos.cat"
1413
include "c11_los.cat"
1514

cat/c11.cat

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Rewritten by Luc Maranget for herd7
1414
may be missing. As a consequence, reads may have no rf-edge if they read from initial memory.
1515
*)
1616

17-
include "basic.cat"
1817
include "c11_cos.cat"
1918
include "c11_los.cat"
2019

cat/cos.cat

-5
This file was deleted.

cat/imm.cat

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
* following GenMC's implementation
99
*)
1010

11-
include "basic.cat"
12-
1311
(* coherence *)
1412
let rs = [W];po-loc;[W] | [W];(po-loc?;rf;rmw)* (* release sequence *)
1513
(* GenMC uses the same sw definition as RC11 *)

cat/ptx-v6.0.cat

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ PTX
1212
// GPU: Graphics processing unit. The GPU scope is the set of all threads executing in the same cluster as the current thread.
1313
// SYS: System. The SYS scope is the set of all threads in the current program.
1414

15-
include "basic.cat"
16-
1715
(*******************)
1816
(* Auxiliaries *)
1917
(*******************)

cat/ptx-v7.5.cat

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ PTX
2626
// The ASPLOS'19 paper and the documentation refer to "rf | fr" (non-optional).
2727
// We follow the later.
2828

29-
include "basic.cat"
30-
3129
(*******************)
3230
(* Auxiliaries *)
3331
(*******************)
File renamed without changes.

cat/vmm.cat

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (C) Huawei Technologies Co., Ltd. 2024. All rights reserved.
33
* SPDX-License-Identifier: MIT
44
*
5-
* Version 0.9.1
5+
* Version 0.9.3
66
*/
77

88
(* Notation
@@ -55,8 +55,12 @@
5555

5656
let ext = ext & ((~IW) * M)
5757
let int = int | (IW * M)
58-
59-
include "basic.cat"
58+
let rfe = rf & ext
59+
let coe = co & ext
60+
let fre = fr & ext
61+
let rfi = rf & int
62+
let coi = co & int
63+
let fri = fr & int
6064

6165
(** Atomicity **)
6266
empty rmw & (fre;coe)
@@ -66,8 +70,8 @@ acyclic co | rf | fr | po-loc
6670

6771
let Marked = RLX | ACQ | REL | SC
6872
let Plain = ~Marked
69-
let Acq = ACQ | (SC & R)
70-
let Rel = REL | (SC & W)
73+
let Acq = (ACQ | SC) & (R | F)
74+
let Rel = (REL | SC) & (W | F)
7175

7276
(** Ordering **)
7377
(* In our model, dependencies only order stores:

dartagnan/src/main/java/com/dat3m/dartagnan/parsers/cat/VisitorCat.java

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.dat3m.dartagnan.parsers.cat;
22

3+
import com.dat3m.dartagnan.GlobalSettings;
34
import com.dat3m.dartagnan.exception.AbortErrorListener;
45
import com.dat3m.dartagnan.exception.MalformedMemoryModelException;
56
import com.dat3m.dartagnan.exception.ParsingException;
@@ -62,6 +63,17 @@ public String toString() {
6263
VisitorCat(Path includePath) {
6364
this.includePath = includePath;
6465
this.wmm = new Wmm();
66+
includeStdlib();
67+
}
68+
69+
private void includeStdlib() {
70+
try {
71+
// The standard library is a cat file stdlib.cat which all models include by default
72+
final CatParser parser = getParser(CharStreams.fromPath(Path.of(GlobalSettings.getCatDirectory() + "/stdlib.cat")));
73+
parser.mcm().accept(this);
74+
} catch (IOException e) {
75+
throw new ParsingException("Error parsing stdlib.cat file", e);
76+
}
6577
}
6678

6779
@Override

0 commit comments

Comments
 (0)