Skip to content

Commit 56e3db5

Browse files
committed
Sketch support for getting third party libraries, but disable affinity for now
There’s an issue with Java modules, I don’t want to deal with… Signed-off-by: Stefan Marr <[email protected]>
1 parent acb7fed commit 56e3db5

File tree

4 files changed

+61
-11
lines changed

4 files changed

+61
-11
lines changed

mx.somns/mx_somns.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,19 @@ def tests_update_data(args, **kwargs):
253253
"""update expected data for tests"""
254254
mx.run(["tests/tools/nodestats/test.sh", "update"])
255255
mx.run(["tests/tools/coverage/test.sh", "update"])
256+
257+
@mx.command(suite.name, "create-third-party-module-file")
258+
def create_third_party_module_file(args, **kwargs):
259+
"""create the third party module file"""
260+
paths = []
261+
for lib in mx.libraries():
262+
if lib.name.startswith("SOMNS_DEP") and "DEV" not in lib.name:
263+
paths.append(lib.path)
264+
elif lib.name == "AFFINITY":
265+
paths.append(lib.path)
266+
elif lib.name.startswith("SLF4J"):
267+
paths.append(lib.path)
268+
269+
# create file in suite.dir with the paths as text
270+
with open(suite.dir + "/.modules", "w") as file:
271+
file.write(":".join(paths) + "\n")

mx.somns/suite.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,33 @@
5858
"version": "3.23.2",
5959
},
6060
},
61+
"SLF4J_API": {
62+
"moduleName": "org.slf4j.api",
63+
"digest": "sha512:f9b033fc019a44f98b16048da7e2b59edd4a6a527ba60e358f65ab88e0afae03a9340f1b3e8a543d49fa542290f499c5594259affa1ff3e6e7bf3b428d4c610b",
64+
"maven": {
65+
"groupId": "org.slf4j",
66+
"artifactId": "slf4j-api",
67+
"version": "1.7.36",
68+
},
69+
},
70+
"SLF4J_NOP": {
71+
"moduleName": "org.slf4j.nop",
72+
"digest": "sha512:3ee0417e7a3b1bbd490b15ee8329681b397a4042a5bfec032719fab696c3f0ad401e9ed4ac16f550ccd1ee8c179ad8ec438142b7a7cf8522b793685bd218a9a2",
73+
"maven": {
74+
"groupId": "org.slf4j",
75+
"artifactId": "slf4j-nop",
76+
"version": "1.7.36",
77+
},
78+
},
79+
"SLF4J_SIMPLE": {
80+
"moduleName": "org.slf4j.simple",
81+
"digest": "sha512:cdcebe8fa58527a1bc7da0c18e90a9547ce8ac99cccfe5657860c2a25478c030ea758251da3e32a71eab9cbb91360692b5c6c5887a1f1597d1fda07151b27e5f",
82+
"maven": {
83+
"groupId": "org.slf4j",
84+
"artifactId": "slf4j-simple",
85+
"version": "1.7.36",
86+
},
87+
},
6188
"LABS_JDK": {
6289
"id": "labsjdk-ce-latest",
6390
# I am just using the suite.py to store the info
@@ -74,6 +101,9 @@
74101
"tools:TRUFFLE_PROFILER",
75102
"SOMNS_DEPS_0.3.8",
76103
"AFFINITY",
104+
"SLF4J_API",
105+
"SLF4J_NOP",
106+
"SLF4J_SIMPLE"
77107
],
78108
"requires": [
79109
"java.logging",

som

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ def get_compiled_graalvm_java_bin(use_libgraal):
214214
libgraal_jdk_home = lines[-1].strip()
215215
return libgraal_jdk_home + '/bin/java'
216216

217+
def get_third_party_jars():
218+
if not os.path.exists(BASE_DIR + '/.modules'):
219+
mx = find_mx()
220+
check_output([mx, 'create-third-party-module-file'], cwd=BASE_DIR)
221+
with open(BASE_DIR + '/.modules') as f:
222+
return f.read().strip()
217223

218224
if args.setup == 'mx':
219225
mx = find_mx(False)
@@ -341,9 +347,7 @@ else:
341347
MODULE_PATH_ENTRIES = [
342348
BASE_DIR + '/mxbuild/dists/somns.jar',
343349
BASE_DIR + '/libs/somns-deps.jar',
344-
BASE_DIR + '/libs/affinity.jar',
345-
BASE_DIR + '/libs/slf4j-api.jar',
346-
BASE_DIR + '/libs/slf4j-simple.jar',
350+
get_third_party_jars(),
347351
BASE_DIR + '/libs/jna-platform.jar',
348352
BASE_DIR + '/libs/jna.jar',
349353
TRUFFLE_DIR + '/sdk/mxbuild/dists/graal-sdk.jar',

src/somns/src/tools/concurrency/TracingActivityThread.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.concurrent.ForkJoinWorkerThread;
66
import java.util.concurrent.atomic.AtomicInteger;
77

8-
import net.openhft.affinity.AffinityLock;
8+
//import net.openhft.affinity.AffinityLock;
99
import somns.VM;
1010
import somns.interpreter.actors.Actor.ActorProcessingThread;
1111
import somns.vm.Activity;
@@ -26,7 +26,7 @@ public abstract class TracingActivityThread extends ForkJoinWorkerThread {
2626
public static final AtomicInteger threadIdGen =
2727
(VmSettings.UNIFORM_TRACING || VmSettings.KOMPOS_TRACING) ? new AtomicInteger(1) : null;
2828

29-
private Object /* AffinityLock */ affinity;
29+
// private Object /* AffinityLock */ affinity;
3030

3131
protected final long threadId;
3232
protected long nextEntityId;
@@ -185,9 +185,9 @@ protected void onStart() {
185185
TracingBackend.registerThread(this);
186186
}
187187

188-
if (VmSettings.USE_PINNING) {
189-
affinity = AffinityLock.acquireLock();
190-
}
188+
// if (VmSettings.USE_PINNING) {
189+
// affinity = AffinityLock.acquireLock();
190+
// }
191191

192192
vm.enterContext();
193193
}
@@ -203,9 +203,9 @@ protected void onTermination(final Throwable exception) {
203203
SnapshotBackend.registerSnapshotBuffer(snapshotBuffer);
204204
}
205205

206-
if (VmSettings.USE_PINNING) {
207-
((AffinityLock) affinity).release();
208-
}
206+
// if (VmSettings.USE_PINNING) {
207+
// ((AffinityLock) affinity).release();
208+
// }
209209

210210
vm.leaveContext();
211211
super.onTermination(exception);

0 commit comments

Comments
 (0)