8000 Merge pull request #5152 from sjrd/wasm-string-constants · scala-js/scala-js@bb4d753 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb4d753

Browse files
authored
Merge pull request #5152 from sjrd/wasm-string-constants
Wasm: Use builtin string constants from JS string builtins.
2 parents 7d15aad + 64edcce commit bb4d753

File tree

12 files changed

+237
-346
lines changed

12 files changed

+237
-346
lines changed

linker/shared/src/main/scala/org/scalajs/linker/backend/wasmemitter/ClassEmitter.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
212212
coreSpec.semantics.runtimeClassNameMapper,
213213
className.nameString
214214
)
215-
val nameDataValue: List[wa.Instr] =
216-
ctx.stringPool.getConstantStringDataInstr(nameStr)
215+
val nameValue = ctx.stringPool.getConstantStringInstr(nameStr)
217216

218217
val kind = className match {
219218
case ObjectClass => KindObject
@@ -299,8 +298,10 @@ class ClassEmitter(coreSpec: CoreSpec) {
299298
elemsInstrs :+ wa.ArrayNewFixed(genTypeID.reflectiveProxies, reflectiveProxies.size)
300299
}
301300

302-
nameDataValue :::
301+
(
303302
List(
303+
// name
304+
nameValue,
304305
// kind
305306
wa.I32Const(kind),
306307
// specialInstanceTypes
@@ -312,8 +313,6 @@ class ClassEmitter(coreSpec: CoreSpec) {
312313
List(
313314
// componentType - always `null` since this method is not used for array types
314315
wa.RefNull(watpe.HeapType(genTypeID.typeData)),
315-
// name - initially `null`; filled in by the `typeDataName` helper
316-
wa.RefNull(watpe.HeapType.NoExtern),
317316
// the classOf instance - initially `null`; filled in by the `createClassOf` helper
318317
wa.RefNull(watpe.HeapType(genTypeID.ClassStruct)),
319318
// arrayOf, the typeData of an array of this type - initially `null`; filled in by the `arrayTypeData` helper
@@ -327,6 +326,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
327326
// Generated instructions create an array of reflective proxy structs, where each struct
328327
// contains the ID of the reflective proxy and a reference to the actual method implementation.
329328
reflectiveProxiesInstrs
329+
)
330330
}
331331

332332
private def genTypeDataGlobal(className: ClassName, typeDataTypeID: wanme.TypeID,
@@ -1366,7 +1366,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
13661366

13671367
ctx.moduleBuilder.addImport(
13681368
wamod.Import(
1369-
"__scalaJSExportSetters",
1369+
ExportSettersModule,
13701370
exportedName,
13711371
wamod.ImportDesc.Func(
13721372
functionID,

0 commit comments

Comments
 (0)
0