| 1 |
Fromscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/patches/`05_riscv64.diff`#From.: Ryan Kavanagh <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Datescip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/patches/`05_riscv64.diff`#Date.: Tue, 20 May 2025 12:15:59 -0400 |
| 3 |
Subjectscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/patches/`05_riscv64.diff`#Subject.: Add RISCV64 support |
| 4 |
|
| 5 |
Forwarded: no |
| 6 |
Reviewed-by: Ryan Kavanagh <[email protected]> |
| 7 |
Last-Update: 2025-05-20 |
| 8 |
--- |
| 9 |
basis-library/mlton/platform.sig | 2 +- |
| 10 |
basis-library/mlton/platform.sml | 3 + |
| 11 |
bin/platform | 3 + |
| 12 |
doc/guide/src/MLtonPlatform.adoc | 2 +- |
| 13 |
...share.rep64.ok => mlton.share.riscv64-linux.ok} | 0 |
| 14 |
regression/size2.riscv64-linux.ok | 24 +++++ |
| 15 |
regression/size3.riscv64-linux.ok | 114 +++++++++++++++++++++ |
| 16 |
runtime/cenv.h | 2 + |
| 17 |
runtime/platform/riscv64.h | 1 + |
| 18 |
9 files changed, 149 insertions(+), 2 deletions(-) |
| 19 |
copy regression/{mlton.share.rep64.ok => mlton.share.riscv64-linux.ok} (100%) |
| 20 |
create mode 100644 regression/size2.riscv64-linux.ok |
| 21 |
create mode 100644 regression/size3.riscv64-linux.ok |
| 22 |
create mode 100644 runtime/platform/riscv64.h |
| 23 |
|
| 24 |
diff --git a/basis-library/mlton/platform.sigscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`basis-library/mlton/platform.sig`: b/basis-library/mlton/platform.sigscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`basis-library/mlton/platform.sig`: |
| 25 |
index 44d0967..653b350 100644 |
| 26 |
--- a/basis-library/mlton/platform.sig |
| 27 |
+++ b/basis-library/mlton/platform.sig |
| 28 |
@@ -10,7 +10,7 @@ signature MLTON_PLATFORM = |
| 29 |
structure Arch: |
| 30 |
sig |
| 31 |
datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | LoongArch64 | m68k | |
| 32 |
|
| 33 |
+ MIPS | MIPS64 | PowerPC | PowerPC64 | RISCV | RISCV64 | S390 | Sparc | Wasm32 | X86 |
| 34 |
|
| 35 |
val fromString: string -> t option |
| 36 |
val host: t |
| 37 |
diff --git a/basis-library/mlton/platform.smlscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`basis-library/mlton/platform.sml`: b/basis-library/mlton/platform.smlscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`basis-library/mlton/platform.sml`: |
| 38 |
index 650fb91..c14baa3 100644 |
| 39 |
--- a/basis-library/mlton/platform.sml |
| 40 |
+++ b/basis-library/mlton/platform.sml |
| 41 |
@@ -43,6 +43,7 @@ structure MLtonPlatform: MLTON_PLATFORM = |
| 42 |
| PowerPC |
| 43 |
| PowerPC64 |
| 44 |
| RISCV |
| 45 |
+ | RISCV64 |
| 46 |
| S390 |
| 47 |
| Sparc |
| 48 |
| Wasm32 |
| 49 |
@@ -62,6 +63,7 @@ structure MLtonPlatform: MLTON_PLATFORM = |
| 50 |
(PowerPC, "PowerPC"):: |
| 51 |
(PowerPC64, "PowerPC64"):: |
| 52 |
(RISCV, "RISCV"):: |
| 53 |
+ (RISCV64, "RISCV64"):: |
| 54 |
(S390, "S390"):: |
| 55 |
(Sparc, "Sparc"):: |
| 56 |
(Wasm32, "Wasm32"):: |
| 57 |
@@ -86,6 +88,7 @@ structure MLtonPlatform: MLTON_PLATFORM = |
| 58 |
| "powerpc" => PowerPC |
| 59 |
| "powerpc64" => PowerPC64 |
| 60 |
| "riscv" => RISCV |
| 61 |
+ | "riscv64" => RISCV64 |
| 62 |
| "s390" => S390 |
| 63 |
| "sparc" => Sparc |
| 64 |
| "wasm32" => Wasm32 |
| 65 |
diff --git a/bin/platformscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`bin/platform`: b/bin/platformscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`bin/platform`: |
| 66 |
index eb8a9af..f3a2be1 100755 |
| 67 |
--- a/bin/platform |
| 68 |
+++ b/bin/platform |
| 69 |
@@ -137,6 +137,9 @@ ppc*) |
| 70 |
Power*) |
| 71 |
HOST_ARCH=powerpc |
| 72 |
;; |
| 73 |
+riscv64) |
| 74 |
+ HOST_ARCH=riscv64 |
| 75 |
+;; |
| 76 |
riscv*) |
| 77 |
HOST_ARCH=riscv |
| 78 |
;; |
| 79 |
diff --git a/doc/guide/src/MLtonPlatform.adocscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`doc/guide/src/MLtonPlatform.adoc`: b/doc/guide/src/MLtonPlatform.adocscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`doc/guide/src/MLtonPlatform.adoc`: |
| 80 |
index 8220fd7..f16c312 100644 |
| 81 |
--- a/doc/guide/src/MLtonPlatform.adoc |
| 82 |
+++ b/doc/guide/src/MLtonPlatform.adoc |
| 83 |
@@ -7,7 +7,7 @@ signature MLTON_PLATFORM = |
| 84 |
structure Arch: |
| 85 |
sig |
| 86 |
datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | m68k |
| 87 |
|
| 88 |
+ | MIPS | MIPS64 | PowerPC | PowerPC64 | RISCV64 | S390 | Sparc | X86 |
| 89 |
|
| 90 |
val fromString: string -> t option |
| 91 |
val host: t |
| 92 |
diff --git a/regression/mlton.share.rep64.ok b/regression/mlton.share.riscv64-linux.ok |
| 93 |
similarity index 100% |
| 94 |
copy from regression/mlton.share.rep64.ok |
| 95 |
copy to regression/mlton.share.riscv64-linux.ok |
| 96 |
diff --git a/regression/size2.riscv64-linux.ok b/regression/size2.riscv64-linux.okscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`regression/size2.riscv64-linux.ok`: |
| 97 |
new file mode 100644 |
| 98 |
index 0000000..5d5f773 |
| 99 |
--- /dev/nullscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`/dev/null`: |
| 100 |
+++ b/regression/size2.riscv64-linux.ok |
| 101 |
@@ -0,0 +1,24 @@ |
| 102 |
+The size of a char is = 0 bytes. |
| 103 |
+The size of an int list of length 4 is = 96 bytes. |
| 104 |
+The size of a string of length 10 is = 40 bytes. |
| 105 |
+The size of an int array of length 10 is = 64 bytes. |
| 106 |
+The size of a double array of length 10 is = 104 bytes. |
| 107 |
+The size of a (word32 * double) array of length 10 is = 184 bytes. |
| 108 |
+The size of a (word32 * word32 * double) array of length 10 is = 184 bytes. |
| 109 |
+The size of a (word64 * double) array of length 10 is = 184 bytes. |
| 110 |
+The size of a (word16 * double) array of length 10 is = 184 bytes. |
| 111 |
+The size of a word64 array of length 10 is = 104 bytes. |
| 112 |
+The size of a (word32 * word64) array of length 10 is = 184 bytes. |
| 113 |
+The size of a (word32 * word32 * word64) array of length 10 is = 184 bytes. |
| 114 |
+The size of a (word64 * word64) array of length 10 is = 184 bytes. |
| 115 |
+The size of a (word16 * word64) array of length 10 is = 184 bytes. |
| 116 |
+The size of an array of length 10 of 2-ples of ints is = 104 bytes. |
| 117 |
+The size of an array of length 10 of 2-ples of (shared) ints is = 104 bytes. |
| 118 |
+The size of an array of length 10 of arrays of length 20 of ints is = 1144 bytes. |
| 119 |
+The size of an array of length 10 of (shared) arrays of length 20 of ints is = 208 bytes. |
| 120 |
+The size of an array of length 10 of tuples of word16 * (arrays of length 20 of ints) is = 1224 bytes. |
| 121 |
+The size of an array of length 10 of tuples of word32 * (arrays of length 20 of ints) is = 1224 bytes. |
| 122 |
+The size of an array of length 10 of tuples of word64 * (arrays of length 20 of ints) is = 1224 bytes. |
| 123 |
+The size of an array of length 10 of tuples of real32 * (arrays of length 20 of ints) is = 1224 bytes. |
| 124 |
+The size of an array of length 10 of tuples of real64 * (arrays of length 20 of ints) is = 1224 bytes. |
| 125 |
+The size of a useless function is = 0 bytes. |
| 126 |
diff --git a/regression/size3.riscv64-linux.ok b/regression/size3.riscv64-linux.okscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`regression/size3.riscv64-linux.ok`: |
| 127 |
new file mode 100644 |
| 128 |
index 0000000..48720a9 |
| 129 |
--- /dev/null |
| 130 |
+++ b/regression/size3.riscv64-linux.ok |
| 131 |
@@ -0,0 +1,114 @@ |
| 132 |
+The size of unit is = 0 bytes. |
| 133 |
+The size of unit * unit is = 0 bytes. |
| 134 |
+The size of bool is = 0 bytes. |
| 135 |
+The size of bool * bool is = 16 bytes. |
| 136 |
+The size of day is = 0 bytes. |
| 137 |
+The size of day * day is = 0 bytes. |
| 138 |
+The size of a char is = 0 bytes. |
| 139 |
+The size of a char * char is = 0 bytes. |
| 140 |
+The size of a word8 is = 0 bytes. |
| 141 |
+The size of a word8 * word8 is = 0 bytes. |
| 142 |
+The size of a word16 is = 0 bytes. |
| 143 |
+The size of a word16 * word16 is = 0 bytes. |
| 144 |
+The size of a word32 is = 0 bytes. |
| 145 |
+The size of a word32 * word32 is = 16 bytes. |
| 146 |
+The size of a word64 is = 0 bytes. |
| 147 |
+The size of a word64 * word64 is = 24 bytes. |
| 148 |
+The size of a word64 * word64 * word64 is = 32 bytes. |
| 149 |
+The size of a word64 * word64 * word64 * word64 is = 40 bytes. |
| 150 |
+The size of a unit list of length 4 is = 64 bytes. |
| 151 |
+The size of a bool list of length 4 is = 96 bytes. |
| 152 |
+The size of a day list of length 4 is = 96 bytes. |
| 153 |
+The size of an int list of length 4 is = 96 bytes. |
| 154 |
+The size of a string of length 10 is = 40 bytes. |
| 155 |
+The size of a word64 array of length 0 is = 24 bytes. |
| 156 |
+The size of a word64 array of length 1 is = 32 bytes. |
| 157 |
+The size of a word64 array of length 2 is = 40 bytes. |
| 158 |
+The size of a word64 array of length 3 is = 48 bytes. |
| 159 |
+The size of a word64 array of length 4 is = 56 bytes. |
| 160 |
+The size of a word64 array of length 5 is = 64 bytes. |
| 161 |
+The size of a word64 array of length 6 is = 72 bytes. |
| 162 |
+The size of a word64 array of length 7 is = 80 bytes. |
| 163 |
+The size of a word64 array of length 8 is = 88 bytes. |
| 164 |
+The size of a word64 array of length 9 is = 96 bytes. |
| 165 |
+The size of a word64 array of length 10 is = 104 bytes. |
| 166 |
+The size of a word64 array of length 11 is = 112 bytes. |
| 167 |
+The size of a word64 array of length 12 is = 120 bytes. |
| 168 |
+The size of a word32 array of length 0 is = 24 bytes. |
| 169 |
+The size of a word32 array of length 1 is = 32 bytes. |
| 170 |
+The size of a word32 array of length 2 is = 32 bytes. |
| 171 |
+The size of a word32 array of length 3 is = 40 bytes. |
| 172 |
+The size of a word32 array of length 4 is = 40 bytes. |
| 173 |
+The size of a word32 array of length 5 is = 48 bytes. |
| 174 |
+The size of a word32 array of length 6 is = 48 bytes. |
| 175 |
+The size of a word32 array of length 7 is = 56 bytes. |
| 176 |
+The size of a word32 array of length 8 is = 56 bytes. |
| 177 |
+The size of a word32 array of length 9 is = 64 bytes. |
| 178 |
+The size of a word32 array of length 10 is = 64 bytes. |
| 179 |
+The size of a word32 array of length 11 is = 72 bytes. |
| 180 |
+The size of a word32 array of length 12 is = 72 bytes. |
| 181 |
+The size of a word16 array of length 0 is = 24 bytes. |
| 182 |
+The size of a word16 array of length 1 is = 32 bytes. |
| 183 |
+The size of a word16 array of length 2 is = 32 bytes. |
| 184 |
+The size of a word16 array of length 3 is = 32 bytes. |
| 185 |
+The size of a word16 array of length 4 is = 32 bytes. |
| 186 |
+The size of a word16 array of length 5 is = 40 bytes. |
| 187 |
+The size of a word16 array of length 6 is = 40 bytes. |
| 188 |
+The size of a word16 array of length 7 is = 40 bytes. |
| 189 |
+The size of a word16 array of length 8 is = 40 bytes. |
| 190 |
+The size of a word16 array of length 9 is = 48 bytes. |
| 191 |
+The size of a word16 array of length 10 is = 48 bytes. |
| 192 |
+The size of a word16 array of length 11 is = 48 bytes. |
| 193 |
+The size of a word16 array of length 12 is = 48 bytes. |
| 194 |
+The size of a word8 array of length 0 is = 24 bytes. |
| 195 |
+The size of a word8 array of length 1 is = 32 bytes. |
| 196 |
+The size of a word8 array of length 2 is = 32 bytes. |
| 197 |
+The size of a word8 array of length 3 is = 32 bytes. |
| 198 |
+The size of a word8 array of length 4 is = 32 bytes. |
| 199 |
+The size of a word8 array of length 5 is = 32 bytes. |
| 200 |
+The size of a word8 array of length 6 is = 32 bytes. |
| 201 |
+The size of a word8 array of length 7 is = 32 bytes. |
| 202 |
+The size of a word8 array of length 8 is = 32 bytes. |
| 203 |
+The size of a word8 array of length 9 is = 40 bytes. |
| 204 |
+The size of a word8 array of length 10 is = 40 bytes. |
| 205 |
+The size of a word8 array of length 11 is = 40 bytes. |
| 206 |
+The size of a word8 array of length 12 is = 40 bytes. |
| 207 |
+The size of a unit array of length 0 is = 24 bytes. |
| 208 |
+The size of a unit array of length 1 is = 24 bytes. |
| 209 |
+The size of a unit array of length 2 is = 24 bytes. |
| 210 |
+The size of a unit array of length 3 is = 24 bytes. |
| 211 |
+The size of a unit array of length 4 is = 24 bytes. |
| 212 |
+The size of a unit array of length 5 is = 24 bytes. |
| 213 |
+The size of a unit array of length 6 is = 24 bytes. |
| 214 |
+The size of a unit array of length 7 is = 24 bytes. |
| 215 |
+The size of a unit array of length 8 is = 24 bytes. |
| 216 |
+The size of a unit array of length 9 is = 24 bytes. |
| 217 |
+The size of a unit array of length 10 is = 24 bytes. |
| 218 |
+The size of a unit array of length 11 is = 24 bytes. |
| 219 |
+The size of a unit array of length 12 is = 24 bytes. |
| 220 |
+The size of a word64 ref is = 16 bytes. |
| 221 |
+The size of a word32 ref is = 16 bytes. |
| 222 |
+The size of a word16 ref is = 16 bytes. |
| 223 |
+The size of a word8 ref is = 16 bytes. |
| 224 |
+The size of a unit ref is = 8 bytes. |
| 225 |
+The size of a double array of length 10 is = 104 bytes. |
| 226 |
+The size of a (word32 * double) array of length 10 is = 184 bytes. |
| 227 |
+The size of a (word32 * word32 * double) array of length 10 is = 184 bytes. |
| 228 |
+The size of a (word64 * double) array of length 10 is = 184 bytes. |
| 229 |
+The size of a (word16 * double) array of length 10 is = 184 bytes. |
| 230 |
+The size of a word64 array of length 10 is = 104 bytes. |
| 231 |
+The size of a (word32 * word64) array of length 10 is = 184 bytes. |
| 232 |
+The size of a (word32 * word32 * word64) array of length 10 is = 184 bytes. |
| 233 |
+The size of a (word64 * word64) array of length 10 is = 184 bytes. |
| 234 |
+The size of a (word16 * word64) array of length 10 is = 184 bytes. |
| 235 |
+The size of an array of length 10 of 2-ples of ints is = 104 bytes. |
| 236 |
+The size of an array of length 10 of 2-ples of (shared) ints is = 104 bytes. |
| 237 |
+The size of an array of length 10 of arrays of length 20 of ints is = 1144 bytes. |
| 238 |
+The size of an array of length 10 of (shared) arrays of length 20 of ints is = 208 bytes. |
| 239 |
+The size of an array of length 10 of tuples of word16 * (arrays of length 20 of ints) is = 1224 bytes. |
| 240 |
+The size of an array of length 10 of tuples of word32 * (arrays of length 20 of ints) is = 1224 bytes. |
| 241 |
+The size of an array of length 10 of tuples of word64 * (arrays of length 20 of ints) is = 1224 bytes. |
| 242 |
+The size of an array of length 10 of tuples of real32 * (arrays of length 20 of ints) is = 1224 bytes. |
| 243 |
+The size of an array of length 10 of tuples of real64 * (arrays of length 20 of ints) is = 1224 bytes. |
| 244 |
+The size of a useless function is = 0 bytes. |
| 245 |
+The size of an empty string is = 24 bytes. |
| 246 |
diff --git a/runtime/cenv.hscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`runtime/cenv.h`: b/runtime/cenv.hscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`runtime/cenv.h`: |
| 247 |
index c805f00..327580b 100644 |
| 248 |
--- a/runtime/cenv.h |
| 249 |
+++ b/runtime/cenv.h |
| 250 |
@@ -111,6 +111,8 @@ COMPILE_TIME_ASSERT(sizeof_double__is_eight, sizeof(double) == 8); |
| 251 |
#include "platform/powerpc64.h" |
| 252 |
#elif (defined (__ppc__)) || (defined (__powerpc__)) |
| 253 |
#include "platform/powerpc.h" |
| 254 |
+#elif (defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64) |
| 255 |
+#include "platform/riscv64.h" |
| 256 |
#elif (defined (__riscv)) |
| 257 |
#include "platform/riscv.h" |
| 258 |
#elif (defined (__s390__)) |
| 259 |
diff --git a/runtime/platform/riscv64.h b/runtime/platform/riscv64.hscip-debian debian mlton 20241230+git20251029+dfsg-5 mlton/upstream/`runtime/platform/riscv64.h`: |
| 260 |
new file mode 100644 |
| 261 |
index 0000000..7466a7e |
| 262 |
--- /dev/null |
| 263 |
+++ b/runtime/platform/riscv64.h |
| 264 |
@@ -0,0 +1 @@ |
| 265 |
+#define MLton_Platform_Arch_host "riscv64" |