Comments (4)
By simplelanguage I mean, of course, https://github.com/graalvm/simplelanguage
from sulong.
The Truffle way of calling into other languages from an existing Language is using
TruffleLanguage.Env#parse(Source). It will return a CallTarget that represents that function. The language is identified using the mime-type of the Source object.
This can be done using the SLContext, which stores TruffleLanguage.Env instance anywhere you want inside SimpleLanguage. If you want the enable the Truffle inliner to optimize across this boundary you need to wrap it into a DirectCallNode using DirectCallNode#create(CallTarget), embed it into the AST and call it.
I will let the Sulong people comment on potential specifics to their language.
from sulong.
Interop with Sulong is complicated by the fact that it most people do not want to eval snippets of LLVM IR (which is what Sulong expects). When we use Sulong to run C extensions from JRuby, we eval the IR compiled from the C and then look up the C extension initialisation function, which has a known name, and execute that.
You may want to do something quite different, so it may be best to give us some pseudo code of the SL and C (or some other language?) that you want to run and how you imagine you'd like to write the interop code. Then we can help you shape that into something that works.
from sulong.
Oh I forgot. Another way of doing is by exporting a symbol in sulong and import it using TruffleLanguage.Env#importSymbol. If the symbol represents a function in Sulong and implements TruffleObject, we can call it using interop. SimpleLanguage supports to call foreign functions just as any other function. See SLDispatchNode#doForeign for details, how thats achieved.
from sulong.
Related Issues (20)
- Cannot call native functions with X86_FP80 type
- Regression: Spawning/Joining threads via NFI does not work correctly HOT 3
- Permanent optimization/deoptimization of functions causes huge program slowdown HOT 5
- Cannot convert com.oracle.truffle.llvm.runtime.LLVMTruffleObject to LLVMAddress HOT 2
- Truffle issues with JAVA_HOME including spaces HOT 2
- sulong not exiting from va_start call HOT 13
- Incorrect allocation of struct literals and returned structs HOT 1
- Dragonegg, SSE and GCC builtins HOT 1
- Missing @llvm.x86.sse2.pmovmskb.128 builtin HOT 2
- Missing uitofp to float cast HOT 1
- Missing @llvm.x86.sse2.psrli.d and @llvm.x86.sse2.pslli.d builtins
- Missing support for <2 x float> extractvalue and insertvalue
- Catching a C++ exception hangs the process HOT 5
- Java array access through polyglot engine C is extremely slow HOT 1
- How to pass native arrays of primitive types into other polyglot languages HOT 6
- Dockerfile HOT 1
- no matching function for call to 'polyglot_as_typed' - when using classes HOT 2
- Build failing on arm64 HOT 2
- Polyglot docs missing some detail HOT 4
- Cannot load embedded bitcode from .so on Linux: Unexpected Record Type Id: 0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sulong.