Skip to content

Conversation

restingbull
Copy link
Collaborator

  • Remove coroutine worker in favor of stdlib java for speed (and hopefully reliability)
  • Create a new K2JVMCompiler on each invocation to avoid keeping thread locals
  • Set zip.handler.uses.crc.instead.of.timestamp as a hail mary to prevent corruption
  • Remove android_ndk from examples, as no example uses it... and it's broken for later versions of the android ndk.
  • Standardize on Bazel 5.

Copy link
Collaborator

@cgruber cgruber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clean up. Just some non-blocking nits and questions.


load(
"@build_bazel_rules_android//android:rules.bzl",
"android_ndk_repository",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yass qween

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ndk rules are a mess. Don't work past 27 afaict.

fun exec(errStream: java.io.PrintStream, vararg args: kotlin.String): ExitCode {
class BazelK2JVMCompiler {
fun exec(errStream: java.io.PrintStream, vararg args: String): ExitCode {
System.setProperty("zip.handler.uses.crc.instead.of.timestamp", "true")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is painful (that it's set as a global property in an exec() method I mean, nothing to be done about that if we want to ensure it, I suspect)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also doesn't work. Will remove.

while (true) {
WorkResponse.parseDelimitedFrom(stdOut.input)
?.let(responses::add)
?: break
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I like this sneaky little pattern.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very jetbrains kotlin. Been reading too much code from there.

println("sequence $this")
}
}
}.associateBy { wr ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wr? I know you didn't name it here, but can you drive-by rename with something more clear?

fun waitForStdOut() {
while (stdOut.input.available() != 0) {
Thread.onSpinWait()
Thread.sleep(1) // don't starve other processes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't doing a Thread.sleep(1) more or less do as much as onSpinWait() or more? As in, if you have sleep(1) do you still need onSpinWait()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I did this as the tests kept hanging.

* @param captureIO to avoid writing stdout and stderr while executing.
* @param cpuTimeBasedGcScheduler to trigger gc cleanup.
*/
class JavaPersistentWorker(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the rename here? Is this naming relevant to "java vs. js or llvm/native"? Or java in some other sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I had named the other Kotlin for coroutines. Will fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants