| 1 | //===- BitstreamRemarkParser.cpp ------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file provides utility methods used by clients that want to use the |
| 10 | // parser for remark diagnostics in LLVM. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "BitstreamRemarkParser.h" |
| 15 | #include "llvm/Support/MemoryBuffer.h" |
| 16 | #include "llvm/Support/Path.h" |
| 17 | #include <optional> |
| 18 | |
| 19 | using namespace llvm; |
| 20 | using namespace llvm::remarks; |
| 21 | |
| 22 | namespace { |
| 23 | |
| 24 | template <typename... Ts> Error error(char const *Fmt, const Ts &...Vals) { |
| 25 | std::string Buffer; |
| 26 | raw_string_ostream OS(Buffer); |
| 27 | OS << formatv(Fmt, Vals...); |
| 28 | return make_error<StringError>( |
| 29 | Args: std::move(Buffer), |
| 30 | Args: std::make_error_code(e: std::errc::illegal_byte_sequence)); |
| 31 | } |
| 32 | |
| 33 | } // namespace |
| 34 | |
| 35 | Error BitstreamBlockParserHelperBase::(unsigned AbbrevID) { |
| 36 | return error(Fmt: "Unknown record entry ({})." , Vals: AbbrevID); |
| 37 | } |
| 38 | |
| 39 | Error BitstreamBlockParserHelperBase::(StringRef RecordName) { |
| 40 | return error(Fmt: "Unexpected record entry ({})." , Vals: RecordName); |
| 41 | } |
| 42 | |
| 43 | Error BitstreamBlockParserHelperBase::(StringRef RecordName) { |
| 44 | return error(Fmt: "Malformed record entry ({})." , Vals: RecordName); |
| 45 | } |
| 46 | |
| 47 | Error BitstreamBlockParserHelperBase::(unsigned Code) { |
| 48 | return error(Fmt: "Unexpected subblock ({})." , Vals: Code); |
| 49 | } |
| 50 | |
| 51 | static Expected<unsigned> expectSubBlock(BitstreamCursor &Stream) { |
| 52 | Expected<BitstreamEntry> Next = Stream.advance(); |
| 53 | if (!Next) |
| 54 | return Next.takeError(); |
| 55 | switch (Next->Kind) { |
| 56 | case BitstreamEntry::SubBlock: |
| 57 | return Next->ID; |
| 58 | case BitstreamEntry::Record: |
| 59 | case BitstreamEntry::EndBlock: |
| 60 | return error(Fmt: "Expected subblock, but got unexpected record." ); |
| 61 | case BitstreamEntry::Error: |
| 62 | return error(Fmt: "Expected subblock, but got unexpected end of bitstream." ); |
| 63 | } |
| 64 | llvm_unreachable("Unexpected BitstreamEntry" ); |
| 65 | } |
| 66 | |
| 67 | Error BitstreamBlockParserHelperBase::() { |
| 68 | auto MaybeBlockID = expectSubBlock(Stream); |
| 69 | if (!MaybeBlockID) |
| 70 | return MaybeBlockID.takeError(); |
| 71 | if (*MaybeBlockID != BlockID) |
| 72 | return error(Fmt: "Expected {} block, but got unexpected block ({})." , Vals: BlockName, |
| 73 | Vals: *MaybeBlockID); |
| 74 | return Error::success(); |
| 75 | } |
| 76 | |
| 77 | Error BitstreamBlockParserHelperBase::() { |
| 78 | return Stream.EnterSubBlock(BlockID); |
| 79 | } |
| 80 | |
| 81 | Error BitstreamMetaParserHelper::(unsigned Code) { |
| 82 | // Note: 2 is used here because it's the max number of fields we have per |
| 83 | // record. |
| 84 | SmallVector<uint64_t, 2> Record; |
| 85 | StringRef Blob; |
| 86 | Expected<unsigned> RecordID = Stream.readRecord(AbbrevID: Code, Vals&: Record, Blob: &Blob); |
| 87 | if (!RecordID) |
| 88 | return RecordID.takeError(); |
| 89 | |
| 90 | switch (*RecordID) { |
| 91 | case RECORD_META_CONTAINER_INFO: { |
| 92 | if (Record.size() != 2) |
| 93 | return malformedRecord(RecordName: MetaContainerInfoName); |
| 94 | Container = {.Version: Record[0], .Type: Record[1]}; |
| 95 | // Error immediately if container version is outdated, so the user sees an |
| 96 | // explanation instead of a parser error. |
| 97 | if (Container->Version != CurrentContainerVersion) { |
| 98 | return ::error( |
| 99 | Fmt: "Unsupported remark container version (expected: {}, read: {}). " |
| 100 | "Please upgrade/downgrade your toolchain to read this container." , |
| 101 | Vals: CurrentContainerVersion, Vals: Container->Version); |
| 102 | } |
| 103 | break; |
| 104 | } |
| 105 | case RECORD_META_REMARK_VERSION: { |
| 106 | if (Record.size() != 1) |
| 107 | return malformedRecord(RecordName: MetaRemarkVersionName); |
| 108 | RemarkVersion = Record[0]; |
| 109 | // Error immediately if remark version is outdated, so the user sees an |
| 110 | // explanation instead of a parser error. |
| 111 | if (*RemarkVersion != CurrentRemarkVersion) { |
| 112 | return ::error( |
| 113 | Fmt: "Unsupported remark version in container (expected: {}, read: {}). " |
| 114 | "Please upgrade/downgrade your toolchain to read this container." , |
| 115 | Vals: CurrentRemarkVersion, Vals: *RemarkVersion); |
| 116 | } |
| 117 | break; |
| 118 | } |
| 119 | case RECORD_META_STRTAB: { |
| 120 | if (Record.size() != 0) |
| 121 | return malformedRecord(RecordName: MetaStrTabName); |
| 122 | StrTabBuf = Blob; |
| 123 | break; |
| 124 | } |
| 125 | case RECORD_META_EXTERNAL_FILE: { |
| 126 | if (Record.size() != 0) |
| 127 | return malformedRecord(RecordName: MetaExternalFileName); |
| 128 | ExternalFilePath = Blob; |
| 129 | break; |
| 130 | } |
| 131 | default: |
| 132 | return unknownRecord(AbbrevID: *RecordID); |
| 133 | } |
| 134 | return Error::success(); |
| 135 | } |
| 136 | |
| 137 | Error BitstreamRemarkParserHelper::(unsigned Code) { |
| 138 | Record.clear(); |
| 139 | Expected<unsigned> MaybeRecordID = |
| 140 | Stream.readRecord(AbbrevID: Code, Vals&: Record, Blob: &RecordBlob); |
| 141 | if (!MaybeRecordID) |
| 142 | return MaybeRecordID.takeError(); |
| 143 | RecordID = *MaybeRecordID; |
| 144 | return handleRecord(); |
| 145 | } |
| 146 | |
| 147 | Error BitstreamRemarkParserHelper::handleRecord() { |
| 148 | switch (RecordID) { |
| 149 | case RECORD_REMARK_HEADER: { |
| 150 | if (Record.size() != 4) |
| 151 | return malformedRecord(RecordName: RemarkHeaderName); |
| 152 | Type = Record[0]; |
| 153 | RemarkNameIdx = Record[1]; |
| 154 | PassNameIdx = Record[2]; |
| 155 | FunctionNameIdx = Record[3]; |
| 156 | break; |
| 157 | } |
| 158 | case RECORD_REMARK_DEBUG_LOC: { |
| 159 | if (Record.size() != 3) |
| 160 | return malformedRecord(RecordName: RemarkDebugLocName); |
| 161 | Loc = {.SourceFileNameIdx: Record[0], .SourceLine: Record[1], .SourceColumn: Record[2]}; |
| 162 | break; |
| 163 | } |
| 164 | case RECORD_REMARK_HOTNESS: { |
| 165 | if (Record.size() != 1) |
| 166 | return malformedRecord(RecordName: RemarkHotnessName); |
| 167 | Hotness = Record[0]; |
| 168 | break; |
| 169 | } |
| 170 | case RECORD_REMARK_ARG_WITH_DEBUGLOC: { |
| 171 | if (Record.size() != 5) |
| 172 | return malformedRecord(RecordName: RemarkArgWithDebugLocName); |
| 173 | auto &Arg = Args.emplace_back(Args&: Record[0], Args&: Record[1]); |
| 174 | Arg.Loc = {.SourceFileNameIdx: Record[2], .SourceLine: Record[3], .SourceColumn: Record[4]}; |
| 175 | break; |
| 176 | } |
| 177 | case RECORD_REMARK_ARG_WITHOUT_DEBUGLOC: { |
| 178 | if (Record.size() != 2) |
| 179 | return malformedRecord(RecordName: RemarkArgWithoutDebugLocName); |
| 180 | Args.emplace_back(Args&: Record[0], Args&: Record[1]); |
| 181 | break; |
| 182 | } |
| 183 | default: |
| 184 | return unknownRecord(AbbrevID: RecordID); |
| 185 | } |
| 186 | return Error::success(); |
| 187 | } |
| 188 | |
| 189 | Error BitstreamRemarkParserHelper::() { |
| 190 | Type.reset(); |
| 191 | RemarkNameIdx.reset(); |
| 192 | PassNameIdx.reset(); |
| 193 | FunctionNameIdx.reset(); |
| 194 | Hotness.reset(); |
| 195 | Loc.reset(); |
| 196 | Args.clear(); |
| 197 | |
| 198 | return parseBlock(); |
| 199 | } |
| 200 | |
| 201 | Error BitstreamParserHelper::() { |
| 202 | std::array<char, 4> Result; |
| 203 | for (unsigned I = 0; I < 4; ++I) |
| 204 | if (Expected<unsigned> R = Stream.Read(NumBits: 8)) |
| 205 | Result[I] = *R; |
| 206 | else |
| 207 | return R.takeError(); |
| 208 | |
| 209 | StringRef MagicNumber{Result.data(), Result.size()}; |
| 210 | if (MagicNumber != remarks::ContainerMagic) |
| 211 | return error(Fmt: "Unknown magic number: expecting {}, got {}." , |
| 212 | Vals: remarks::ContainerMagic, Vals: MagicNumber); |
| 213 | return Error::success(); |
| 214 | } |
| 215 | |
| 216 | Error BitstreamParserHelper::() { |
| 217 | Expected<BitstreamEntry> Next = Stream.advance(); |
| 218 | if (!Next) |
| 219 | return Next.takeError(); |
| 220 | if (Next->Kind != BitstreamEntry::SubBlock || |
| 221 | Next->ID != llvm::bitc::BLOCKINFO_BLOCK_ID) |
| 222 | return error( |
| 223 | Fmt: "Error while parsing BLOCKINFO_BLOCK: expecting [ENTER_SUBBLOCK, " |
| 224 | "BLOCKINFO_BLOCK, ...]." ); |
| 225 | |
| 226 | Expected<std::optional<BitstreamBlockInfo>> MaybeBlockInfo = |
| 227 | Stream.ReadBlockInfoBlock(); |
| 228 | if (!MaybeBlockInfo) |
| 229 | return MaybeBlockInfo.takeError(); |
| 230 | |
| 231 | if (!*MaybeBlockInfo) |
| 232 | return error(Fmt: "Missing BLOCKINFO_BLOCK." ); |
| 233 | |
| 234 | BlockInfo = **MaybeBlockInfo; |
| 235 | |
| 236 | Stream.setBlockInfo(&BlockInfo); |
| 237 | return Error::success(); |
| 238 | } |
| 239 | |
| 240 | Error BitstreamParserHelper::() { |
| 241 | if (Error E = expectMagic()) |
| 242 | return E; |
| 243 | if (Error E = parseBlockInfoBlock()) |
| 244 | return E; |
| 245 | |
| 246 | // Parse early meta block. |
| 247 | if (Error E = MetaHelper.expectBlock()) |
| 248 | return E; |
| 249 | if (Error E = MetaHelper.parseBlock()) |
| 250 | return E; |
| 251 | |
| 252 | // Skip all Remarks blocks. |
| 253 | while (!Stream.AtEndOfStream()) { |
| 254 | auto MaybeBlockID = expectSubBlock(Stream); |
| 255 | if (!MaybeBlockID) |
| 256 | return MaybeBlockID.takeError(); |
| 257 | if (*MaybeBlockID == META_BLOCK_ID) |
| 258 | break; |
| 259 | if (*MaybeBlockID != REMARK_BLOCK_ID) |
| 260 | return error(Fmt: "Unexpected block between meta blocks." ); |
| 261 | // Remember first remark block. |
| 262 | if (!RemarkStartBitPos) |
| 263 | RemarkStartBitPos = Stream.GetCurrentBitNo(); |
| 264 | if (Error E = Stream.SkipBlock()) |
| 265 | return E; |
| 266 | } |
| 267 | |
| 268 | // Late meta block is optional if there are no remarks. |
| 269 | if (Stream.AtEndOfStream()) |
| 270 | return Error::success(); |
| 271 | |
| 272 | // Parse late meta block. |
| 273 | if (Error E = MetaHelper.parseBlock()) |
| 274 | return E; |
| 275 | return Error::success(); |
| 276 | } |
| 277 | |
| 278 | Error BitstreamParserHelper::() { |
| 279 | if (RemarkStartBitPos) { |
| 280 | RemarkStartBitPos.reset(); |
| 281 | } else { |
| 282 | auto MaybeBlockID = expectSubBlock(Stream); |
| 283 | if (!MaybeBlockID) |
| 284 | return MaybeBlockID.takeError(); |
| 285 | if (*MaybeBlockID != REMARK_BLOCK_ID) |
| 286 | return make_error<EndOfFileError>(); |
| 287 | } |
| 288 | return RemarksHelper->parseNext(); |
| 289 | } |
| 290 | |
| 291 | Expected<std::unique_ptr<BitstreamRemarkParser>> |
| 292 | remarks::( |
| 293 | StringRef Buf, std::optional<StringRef> ExternalFilePrependPath) { |
| 294 | auto Parser = std::make_unique<BitstreamRemarkParser>(args&: Buf); |
| 295 | |
| 296 | if (ExternalFilePrependPath) |
| 297 | Parser->ExternalFilePrependPath = std::string(*ExternalFilePrependPath); |
| 298 | |
| 299 | return std::move(Parser); |
| 300 | } |
| 301 | |
| 302 | BitstreamRemarkParser::(StringRef Buf) |
| 303 | : RemarkParser(Format::Bitstream), ParserHelper(Buf) {} |
| 304 | |
| 305 | Expected<std::unique_ptr<Remark>> BitstreamRemarkParser::() { |
| 306 | if (!IsMetaReady) { |
| 307 | // Container is completely empty. |
| 308 | if (ParserHelper->Stream.AtEndOfStream()) |
| 309 | return make_error<EndOfFileError>(); |
| 310 | |
| 311 | if (Error E = parseMeta()) |
| 312 | return std::move(E); |
| 313 | IsMetaReady = true; |
| 314 | |
| 315 | // Container has meta, but no remarks blocks. |
| 316 | if (!ParserHelper->RemarkStartBitPos) |
| 317 | return error( |
| 318 | Fmt: "Container is non-empty, but does not contain any remarks blocks." ); |
| 319 | |
| 320 | if (Error E = |
| 321 | ParserHelper->Stream.JumpToBit(NewBitNo: *ParserHelper->RemarkStartBitPos)) |
| 322 | return std::move(E); |
| 323 | ParserHelper->RemarksHelper.emplace(args&: ParserHelper->Stream); |
| 324 | } |
| 325 | |
| 326 | if (Error E = ParserHelper->parseRemark()) |
| 327 | return std::move(E); |
| 328 | return processRemark(); |
| 329 | } |
| 330 | |
| 331 | Error BitstreamRemarkParser::() { |
| 332 | if (Error E = ParserHelper->parseMeta()) |
| 333 | return E; |
| 334 | if (Error E = processCommonMeta()) |
| 335 | return E; |
| 336 | |
| 337 | switch (ContainerType) { |
| 338 | case BitstreamRemarkContainerType::RemarksFileExternal: |
| 339 | return processExternalFilePath(); |
| 340 | case BitstreamRemarkContainerType::RemarksFile: |
| 341 | return processFileContainerMeta(); |
| 342 | } |
| 343 | llvm_unreachable("Unknown BitstreamRemarkContainerType enum" ); |
| 344 | } |
| 345 | |
| 346 | Error BitstreamRemarkParser::() { |
| 347 | auto &Helper = ParserHelper->MetaHelper; |
| 348 | if (!Helper.Container) |
| 349 | return Helper.error(Fmt: "Missing container info." ); |
| 350 | auto &Container = *Helper.Container; |
| 351 | ContainerVersion = Container.Version; |
| 352 | // Always >= BitstreamRemarkContainerType::First since it's unsigned. |
| 353 | if (Container.Type > static_cast<uint8_t>(BitstreamRemarkContainerType::Last)) |
| 354 | return Helper.error(Fmt: "Invalid container type." ); |
| 355 | ContainerType = static_cast<BitstreamRemarkContainerType>(Container.Type); |
| 356 | return Error::success(); |
| 357 | } |
| 358 | |
| 359 | Error BitstreamRemarkParser::() { |
| 360 | if (Error E = processRemarkVersion()) |
| 361 | return E; |
| 362 | if (Error E = processStrTab()) |
| 363 | return E; |
| 364 | return Error::success(); |
| 365 | } |
| 366 | |
| 367 | Error BitstreamRemarkParser::() { |
| 368 | auto &Helper = ParserHelper->MetaHelper; |
| 369 | if (!Helper.StrTabBuf) |
| 370 | return Helper.error(Fmt: "Missing string table." ); |
| 371 | // Parse and assign the string table. |
| 372 | StrTab.emplace(args&: *Helper.StrTabBuf); |
| 373 | return Error::success(); |
| 374 | } |
| 375 | |
| 376 | Error BitstreamRemarkParser::() { |
| 377 | auto &Helper = ParserHelper->MetaHelper; |
| 378 | if (!Helper.RemarkVersion) |
| 379 | return Helper.error(Fmt: "Missing remark version." ); |
| 380 | RemarkVersion = *Helper.RemarkVersion; |
| 381 | return Error::success(); |
| 382 | } |
| 383 | |
| 384 | Error BitstreamRemarkParser::() { |
| 385 | auto &Helper = ParserHelper->MetaHelper; |
| 386 | if (!Helper.ExternalFilePath) |
| 387 | return Helper.error(Fmt: "Missing external file path." ); |
| 388 | |
| 389 | SmallString<80> FullPath(ExternalFilePrependPath); |
| 390 | sys::path::append(path&: FullPath, a: *Helper.ExternalFilePath); |
| 391 | |
| 392 | // External file: open the external file, parse it, check if its metadata |
| 393 | // matches the one from the separate metadata, then replace the current |
| 394 | // parser with the one parsing the remarks. |
| 395 | ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = |
| 396 | MemoryBuffer::getFile(Filename: FullPath); |
| 397 | if (std::error_code EC = BufferOrErr.getError()) |
| 398 | return createFileError(F: FullPath, EC); |
| 399 | |
| 400 | TmpRemarkBuffer = std::move(*BufferOrErr); |
| 401 | |
| 402 | // Don't try to parse the file if it's empty. |
| 403 | if (TmpRemarkBuffer->getBufferSize() == 0) |
| 404 | return make_error<EndOfFileError>(); |
| 405 | |
| 406 | // Create a separate parser used for parsing the separate file. |
| 407 | ParserHelper.emplace(args: TmpRemarkBuffer->getBuffer()); |
| 408 | if (Error E = parseMeta()) |
| 409 | return E; |
| 410 | |
| 411 | if (ContainerType != BitstreamRemarkContainerType::RemarksFile) |
| 412 | return ParserHelper->MetaHelper.error( |
| 413 | Fmt: "Wrong container type in external file." ); |
| 414 | |
| 415 | return Error::success(); |
| 416 | } |
| 417 | |
| 418 | Expected<std::unique_ptr<Remark>> BitstreamRemarkParser::() { |
| 419 | auto &Helper = *ParserHelper->RemarksHelper; |
| 420 | std::unique_ptr<Remark> Result = std::make_unique<Remark>(); |
| 421 | Remark &R = *Result; |
| 422 | |
| 423 | if (!StrTab) |
| 424 | return Helper.error(Fmt: "Missing string table." ); |
| 425 | |
| 426 | if (!Helper.Type) |
| 427 | return Helper.error(Fmt: "Missing remark type." ); |
| 428 | |
| 429 | // Type::Unknown marks a remark without a type. |
| 430 | if (*Helper.Type == static_cast<uint8_t>(Type::Unknown) || |
| 431 | *Helper.Type > static_cast<uint8_t>(Type::Last)) |
| 432 | return Helper.error(Fmt: "Unknown remark type." ); |
| 433 | |
| 434 | R.RemarkType = static_cast<Type>(*Helper.Type); |
| 435 | |
| 436 | if (!Helper.RemarkNameIdx) |
| 437 | return Helper.error(Fmt: "Missing remark name." ); |
| 438 | |
| 439 | if (Expected<StringRef> = (*StrTab)[*Helper.RemarkNameIdx]) |
| 440 | R.RemarkName = *RemarkName; |
| 441 | else |
| 442 | return RemarkName.takeError(); |
| 443 | |
| 444 | if (!Helper.PassNameIdx) |
| 445 | return Helper.error(Fmt: "Missing remark pass." ); |
| 446 | |
| 447 | if (Expected<StringRef> PassName = (*StrTab)[*Helper.PassNameIdx]) |
| 448 | R.PassName = *PassName; |
| 449 | else |
| 450 | return PassName.takeError(); |
| 451 | |
| 452 | if (!Helper.FunctionNameIdx) |
| 453 | return Helper.error(Fmt: "Missing remark function name." ); |
| 454 | |
| 455 | if (Expected<StringRef> FunctionName = (*StrTab)[*Helper.FunctionNameIdx]) |
| 456 | R.FunctionName = *FunctionName; |
| 457 | else |
| 458 | return FunctionName.takeError(); |
| 459 | |
| 460 | if (Helper.Loc) { |
| 461 | Expected<StringRef> SourceFileName = |
| 462 | (*StrTab)[Helper.Loc->SourceFileNameIdx]; |
| 463 | if (!SourceFileName) |
| 464 | return SourceFileName.takeError(); |
| 465 | R.Loc.emplace(); |
| 466 | R.Loc->SourceFilePath = *SourceFileName; |
| 467 | R.Loc->SourceLine = Helper.Loc->SourceLine; |
| 468 | R.Loc->SourceColumn = Helper.Loc->SourceColumn; |
| 469 | } |
| 470 | |
| 471 | if (Helper.Hotness) |
| 472 | R.Hotness = *Helper.Hotness; |
| 473 | |
| 474 | for (const BitstreamRemarkParserHelper::Argument &Arg : Helper.Args) { |
| 475 | if (!Arg.KeyIdx) |
| 476 | return Helper.error(Fmt: "Missing key in remark argument." ); |
| 477 | if (!Arg.ValueIdx) |
| 478 | return Helper.error(Fmt: "Missing value in remark argument." ); |
| 479 | |
| 480 | // We have at least a key and a value, create an entry. |
| 481 | auto &RArg = R.Args.emplace_back(); |
| 482 | |
| 483 | if (Expected<StringRef> Key = (*StrTab)[*Arg.KeyIdx]) |
| 484 | RArg.Key = *Key; |
| 485 | else |
| 486 | return Key.takeError(); |
| 487 | |
| 488 | if (Expected<StringRef> Value = (*StrTab)[*Arg.ValueIdx]) |
| 489 | RArg.Val = *Value; |
| 490 | else |
| 491 | return Value.takeError(); |
| 492 | |
| 493 | if (Arg.Loc) { |
| 494 | if (Expected<StringRef> SourceFileName = |
| 495 | (*StrTab)[Arg.Loc->SourceFileNameIdx]) { |
| 496 | RArg.Loc.emplace(); |
| 497 | RArg.Loc->SourceFilePath = *SourceFileName; |
| 498 | RArg.Loc->SourceLine = Arg.Loc->SourceLine; |
| 499 | RArg.Loc->SourceColumn = Arg.Loc->SourceColumn; |
| 500 | } else |
| 501 | return SourceFileName.takeError(); |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | return std::move(Result); |
| 506 | } |
| 507 | |