File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
runtime/wasmMain/src/kotlinx/benchmark Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,24 @@ private external fun d8ReadFile(path: String): String
8
8
@JsFun(" () => globalThis.arguments.join(' ')" )
9
9
private external fun d8Arguments (): String
10
10
11
+ private const val maxStringLength = 65_536 / 4
12
+
11
13
internal object D8EngineSupport : JsEngineSupport() {
12
14
override fun writeFile (path : String , text : String ) {
13
15
// WORKAROUND: D8 cannot write into files, this format will be parsed on gradle plugin side
14
16
if (text.isEmpty()) {
15
17
print (" <FILE:$path ><ENDFILE>" )
16
18
} else {
17
19
print (" <FILE:$path >" )
18
- print (text)
20
+ // TODO("Workaround for kotlin/wasm issue in 1.7.20 and below. This should be removed for kotlin 1.8.0 or above")
21
+ var srcStartIndex = 0
22
+ var srcEndIndex = srcStartIndex + maxStringLength
23
+ while (srcEndIndex < text.length) {
24
+ print (text.substring(srcStartIndex, srcEndIndex))
25
+ srcStartIndex = srcEndIndex
26
+ srcEndIndex + = maxStringLength
27
+ }
28
+ print (text.substring(srcStartIndex))
19
29
print (" <ENDFILE>" )
20
30
}
21
31
}
You can’t perform that action at this time.
0 commit comments