hpi-swa / trufflesqueak

A Squeak/Smalltalk VM and Polyglot Programming Environment for the GraalVM.
MIT License
286 stars 14 forks source link

Implement InterpreterProxy #175

Closed MariusDoe closed 9 months ago

MariusDoe commented 11 months ago

InterpreterProxy for TruffleSqueak

This is the first step towards a working InterpreterProxy for trufflesqueak.

This PR is part of the project InterpreterProxy for TruffleSqueak in the Reverse Engineering lecture (WT 2023/24) at HPI.

Try it

Watch the demo

https://github.com/hpi-swa/trufflesqueak/assets/41512063/e7892b30-a73a-42de-9064-568790efe932

Note: Manually copying plugins from OsVM is no longer needed since a6be20b

  1. get Opensmalltalk-VM
  2. copy a supported plugin like SqueakSSL.so from ..Squeak/bin/ to ..trufflesqueak/languages/smalltalk/lib/
  3. Try the plugins
    SqueakSSLTest run: #testFaceBookAPI.
    UUIDPrimitivesTest run: #testCreation.

Additions

Description Files
Add native-side InterpreterProxy and headers InterpreterProxy.c, include/, CMakeLists.txt
Add node to handle ffi calls to external plugins PrimExternalCallNode.java
InterpreterProxy method and state implementation InterpreterProxy.java
Utility for marshalling closures and interfacing with NFI NFIUtils.java
Wrappers for native array types NativeObjectStorage.java, ByteStorage.java,
IntStorage.java, LongStorage.java,
ShortStorage.java, PostPrimitiveCleanup.java

Modifications

Description Files
Add sources of interpreter proxy to build chain mx_trufflesqueak.py, suite.py
Adjust checkstyle to allow for suppressed warnings for
field that cannot be made local
.checkstyle_checks.xml
Add helper for uncached execute of new object node SqueakObjectNewNode.java
Hook named primitive lookup to create new external call node PrimitiveNodeFactory.java
Create helper function to get garbage collection count for alle beans MiscUtils.java
Add helpers for allocation of primitive array types UnsafeUtils.java

Coverage of Interpreter Proxy methods (As of: 09.02.2024)

methods and plugins covered

codecov[bot] commented 11 months ago

Codecov Report

Attention: 284 lines in your changes are missing coverage. Please review.

Comparison is base (3545a26) 56.86% compared to head (692a26c) 56.61%. Report is 24 commits behind head on dev.

Files Patch % Lines
...fflesqueak/nodes/plugins/ffi/InterpreterProxy.java 47.79% 137 Missing and 5 partials :warning:
...src/de/hpi/swa/trufflesqueak/util/UnsafeUtils.java 17.54% 27 Missing and 20 partials :warning:
...ak/src/de/hpi/swa/trufflesqueak/util/NFIUtils.java 67.85% 13 Missing and 5 partials :warning:
...squeak/nodes/plugins/ffi/PrimExternalCallNode.java 73.21% 12 Missing and 3 partials :warning:
...rufflesqueak/nodes/ExecuteTopLevelContextNode.java 58.33% 5 Missing and 5 partials :warning:
...odes/plugins/ffi/wrappers/NativeObjectStorage.java 41.17% 8 Missing and 2 partials :warning:
...esqueak/nodes/plugins/ffi/wrappers/IntStorage.java 0.00% 7 Missing :warning:
...squeak/nodes/plugins/ffi/wrappers/LongStorage.java 0.00% 7 Missing :warning:
...queak/nodes/plugins/ffi/wrappers/ShortStorage.java 0.00% 7 Missing :warning:
...wa/trufflesqueak/nodes/process/TransferToNode.java 76.92% 3 Missing and 3 partials :warning:
... and 7 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #175 +/- ## ============================================ - Coverage 56.86% 56.61% -0.26% - Complexity 3648 3705 +57 ============================================ Files 214 222 +8 Lines 22349 22840 +491 Branches 3083 3122 +39 ============================================ + Hits 12708 12930 +222 - Misses 8269 8521 +252 - Partials 1372 1389 +17 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.