-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Runtime Internals #1034
Conversation
- chore: build js `facade.js` and `js.modules.tar.gz` - chore: makefile cleanup/improvements - chore: align and fixup cflags Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
- feat(graalvm): ability to mark symbols as internal or public - feat(graalvm): mangle internal names consistently - feat(graalvm): ability to filter internal/public symbols on resolve - chore: updates to `runtime` to defer intrinsic access - chore: mark common allowlisted public symbols - chore: cleanup/rewrite all internal symbols not to carry prefix Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
- feat(graalvm): parse and load built-in modules at ctx finalization - fix(graalvm): protect module patches from race condition - fix(runtime): apply change for vfs listener dispatch - chore: missing kotlin function proxy entry Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
- feat: ability to withdraw access to runtime internals - feat: rewrite runtime internals to `primordials` - test: amend bindings to support runtime internals Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
7b4d900
to
a456c63
Compare
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
@@ -159,7 +159,7 @@ java { | |||
dependencies { | |||
// Kover: Coverage Reporting | |||
kover(projects.packages.base) | |||
kover(projects.packages.cli) | |||
// kover(projects.packages.cli) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am dropping this project until runtime
replaces it
val internals = HashMap<String, Any>() | ||
|
||
intrinsicBindings.forEach { entry -> | ||
// @TODO: don't unconditionally mount all members | ||
val isInternal = entry.key.startsWith("__Elide") | ||
if (!EXPERIMENTAL_SECURE_INTERNALS || !isInternal) { | ||
putMember(entry.key, entry.value) | ||
} | ||
if (isInternal) { | ||
internals[entry.key.removePrefix("__Elide_").removeSuffix("__")] = entry.value | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hacky rn i know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine for now, support for this will be clean in v5, already implemented and tested
packages/graalvm/src/main/kotlin/elide/runtime/core/internals/graalvm/GraalVMEngine.kt
Outdated
Show resolved
Hide resolved
option( | ||
"engine.CompilerThreads", | ||
min(max(Runtime.getRuntime().availableProcessors() / 4, 8), 2).toString(), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxes at 8
, mins at 2
, 12
produces 3
, 16
produces 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be written as (Runtime.getRuntime().availableProcessors() / 4).coerceIn(2, 8).toString()
for readability
"java.util.concurrent.ForkJoinPool.common.parallelism" to "4", | ||
"java.util.concurrent.ForkJoinPool.common.maximumSpares" to "128", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes the default ForkJoinPool
settings for concurrency
"elide.tool.engine.JsEngineTest", | ||
"elide.tool.engine.JsEngineTest${'$'}Definition", | ||
"elide.tool.engine.PythonEngineTest", | ||
"elide.tool.engine.PythonEngineTest${'$'}Definition", | ||
"elide.tool.engine.RubyEngineTest", | ||
"elide.tool.engine.RubyEngineTest${'$'}Definition", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was causing language init even for langs that were not requested at cli
classpath = files( | ||
tasks.optimizedNativeJar, | ||
configurations.nativeImageClasspath, | ||
configurations.runtimeClasspath, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes missing dependencies at native image compile time
use { | ||
enter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subtle: use {
here will close the engine after all use. we need this for features like PGO and engine caching, which need to write at the end of the VM's lifecycle, and so demand that the VM is closed cleanly.
if (ENABLE_TYPESCRIPT && (typescript || (alias != null && tsAliases.contains(alias)))) add(TYPESCRIPT) | ||
if (ENABLE_PYTHON && (python || (alias != null && pyAliases.contains(alias)))) add(PYTHON) | ||
if (ENABLE_RUBY && (ruby || (alias != null && rbAliases.contains(alias)))) add(RUBY) | ||
if (ENABLE_JVM && (jvm || kotlin || (alias != null && jvmAliases.contains(alias)))) add(JVM) | ||
if (ENABLE_JVM && (kotlin || (alias != null && ktAliases.contains(alias)))) add(KOTLIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Languages are now "activated" (and then initialized) iff:
(1) The language is supported
(2) The language is active by default (JS
, WASM
), or is requested by the user (all others)
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1034 +/- ##
==========================================
- Coverage 55.10% 54.39% -0.71%
==========================================
Files 323 322 -1
Lines 10263 10263
Branches 1801 1689 -112
==========================================
- Hits 5655 5583 -72
- Misses 4042 4111 +69
- Partials 566 569 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 24 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
private val filesystem: AtomicReference<GuestVFS> = AtomicReference() | ||
|
||
private val executor: ExecutorService by lazy { | ||
MoreExecutors.newDirectExecutorService() | ||
override fun onVfsCreated(fileSystem: GuestVFS) { | ||
filesystem.set(fileSystem) | ||
} | ||
|
||
private val std: FilesystemAPI by lazy { | ||
NodeFilesystem.createStd(executor, filesystem) | ||
override fun get(): GuestVFS { | ||
return filesystem.get() ?: error("VFS not yet initialized") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot, good call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙇
@@ -107,7 +107,23 @@ import elide.testing.annotations.TestCase | |||
""" | |||
} | |||
|
|||
@Test fun `isUtf8() compliance`() = conforms { | |||
@Ignore @Test fun `isAscii() compliance (invalid)`() = conforms { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this was broken, it was probably related to the missing Buffer
symbol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought so too, but alas, it's still broken for some reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one did fix, so did valid
(for isAscii
)
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
Signed-off-by: Sam Gammon <sam@elide.ventures>
@@ -1,3 +1,3 @@ | |||
(function(){var u=this||self,a=globalThis;function i(o,r){var e=o.split("."),t=u;e[0]in t||typeof t.b=="undefined"||t.b("var "+e[0]);for(var n;e.length&&(n=e.shift());)e.length||r===void 0?t[n]&&t[n]!==Object.prototype[n]?t=t[n]:t=t[n]={}:t[n]=r;a[o]=r}var h=class extends Error{constructor(o){super(o);this.a=!0,this.message=o||"`ValueError` was thrown"}static[Symbol.hasInstance](o){return o&&o.a===!0||!1}};i("ValueError",h);class g{typeError(r,e){{var t=TypeError;let n;if(typeof r=="string"?n=r:n=r.message,r=new t(n),e?.c==0)e=r;else throw r}return e}valueError(r,e){let t;if(typeof r=="string"?t=r:t=r.message,r=new h(t),e?.c===!1)return r;throw r}}i("__errBridge",new g),i("btoa",function(o){return a.Base64.encode(o)}),i("atob",function(o){return a.Base64.decode(o)});function s(){return Error("Method not supported")}class b{trace(...r){l("debug",r)}log(...r){l("debug",r)}debug(...r){l("debug",r)}info(...r){l("info",r)}warn(...r){l("warn",r)}error(...r){l("error",r)}assert(){throw Error("Method not implemented.")}clear(){}count(){throw s()}countReset(){throw s()}dir(){throw s()}dirxml(){throw s()}group(){throw s()}groupCollapsed(){throw s()}groupEnd(){throw s()}table(){throw s()}time(){throw s()}timeEnd(){throw s()}timeLog(){throw s()}}function l(o,r){let e=a.Console;switch(o){case"trace":e.log(r);break;case"debug":e.log(r);break;case"info":e.info(r);break;case"warn":e.warn(r);break;case"error":e.error(r)}}i("console",new class extends b{});let w=globalThis.__Elide_version__,p=globalThis.__Elide_node_process__;globalThis.window=void 0,globalThis.gc=null;let c={};globalThis.global=c,globalThis.self=c;let d={process:p,version:w,context:{build:!1,runtime:!0}};globalThis.Elide=d,globalThis.process=d.d}).call({}); | |||
(function(){var b=this||self;function t(l,r){l=l.split(".");var s=b;l[0]in s||typeof s.b=="undefined"||s.b("var "+l[0]);for(var o;l.length&&(o=l.shift());)l.length||r===void 0?s[o]&&s[o]!==Object.prototype[o]?s=s[o]:s=s[o]={}:s[o]=r}var i=globalThis;let c=primordials.c,u=primordials.d;class d extends u{constructor(r){super(r||"`ValueError` was thrown");this.a=!0}static[Symbol.hasInstance](r){return r&&r.a===!0||!1}}class g extends c{constructor(r){super(r||"`ValueError` was thrown");this.a=!0}static[Symbol.hasInstance](r){return r&&r.a===!0||!1}}var a=d;t("ValueError",a),i.ValueError=a;var e=g;t("TypeError",e),i.TypeError=e;let p=globalThis[primordials.f],T=globalThis[primordials.e];globalThis.window=void 0,globalThis.gc=null;let n={};globalThis.global=n,globalThis.self=n;let h=globalThis.Elide||{};Object.assign(h,{process:T,version:p,context:{build:!1,runtime:!0}}),globalThis.Elide=h}).call({}); |
Check notice
Code scanning / CodeQL
Semicolon insertion Note
Summary
Adds support for a concept of "internal" symbols, which are only exposed to internal sources (things within
__runtime__/*
and facade code). In general, fixes a bunch of other bugs, and adds smaller features on the way to1.0.0-alpha10
.primordials
object)auximage