@@ -213,31 +213,36 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
213
213
val outF = if (needsOutFolder) getOutFolder(claszSymbol, pcb.thisName) else null ;
214
214
val plainC = pcb.cnode
215
215
216
- if (claszSymbol.isClass) // @DarkDimius is this test needed here?
217
- for (binary <- ctx.compilationUnit.pickled.get(claszSymbol.asClass)) {
216
+ if (claszSymbol.isClass) { // @DarkDimius is this test needed here?
217
+ def storeTastyTagBytes ( getBytes : String => Array [ Byte ]) : Unit = {
218
218
val store = if (mirrorC ne null ) mirrorC else plainC
219
- val tasty =
220
- if (! ctx.settings.YemitTastyInClass .value) {
221
- val uuid = new TastyHeaderUnpickler (binary).readHeader()
222
- val lo = uuid.getMostSignificantBits
223
- val hi = uuid.getLeastSignificantBits
224
-
219
+ val bytes = getBytes(store.name)
220
+ val dataAttr = new CustomAttr (nme.TASTYATTR .mangledString, bytes)
221
+ store.visitAttribute(dataAttr)
222
+ }
223
+ if (ctx.settings.YemitTastyInClass .value) {
224
+ for (binary <- ctx.compilationUnit.pickled.get(claszSymbol.asClass)) {
225
+ storeTastyTagBytes { name =>
226
+ // Create an empty file to signal that a tasty section exist in the corresponding .class
227
+ // This is much cheaper and simpler to check than doing classfile parsing
228
+ getFileForClassfile(outF, name, " .hasTasty" )
229
+ binary
230
+ }
231
+ }
232
+ } else {
233
+ for (uuid <- ctx.compilationUnit.tastyUUID.get(claszSymbol.asClass)) {
234
+ assert(! ctx.settings.YemitTastyInClass .value)
235
+ storeTastyTagBytes { name =>
225
236
// TASTY attribute is created but only the UUID bytes are stored in it.
226
237
// A TASTY attribute has length 16 if and only if the .tasty file exists.
227
238
val buffer = new TastyBuffer (16 )
228
- buffer.writeUncompressedLong(lo )
229
- buffer.writeUncompressedLong(hi )
239
+ buffer.writeUncompressedLong(uuid.getLeastSignificantBits )
240
+ buffer.writeUncompressedLong(uuid.getMostSignificantBits )
230
241
buffer.bytes
231
- } else {
232
- // Create an empty file to signal that a tasty section exist in the corresponding .class
233
- // This is much cheaper and simpler to check than doing classfile parsing
234
- getFileForClassfile(outF, store.name, " .hasTasty" )
235
- binary
236
242
}
237
- val dataAttr = new CustomAttr (nme.TASTYATTR .mangledString, tasty)
238
- store.visitAttribute(dataAttr)
243
+ }
239
244
}
240
-
245
+ }
241
246
242
247
// ----------- create files
243
248
0 commit comments