| ... | @@ -269,477 +269,467 @@ static IrInstGen *ir_analyze_test_non_null(IrAnalyze *ira, IrInst *source_inst, | ... | @@ -269,477 +269,467 @@ static IrInstGen *ir_analyze_test_non_null(IrAnalyze *ira, IrInst *source_inst, |
| 269 | static IrInstGen *ir_error_dependency_loop(IrAnalyze *ira, IrInst *source_instr); | 269 | static IrInstGen *ir_error_dependency_loop(IrAnalyze *ira, IrInst *source_instr); |
| 270 | | 270 | |
| 271 | static void destroy_instruction_src(IrInstSrc *inst) { | 271 | static void destroy_instruction_src(IrInstSrc *inst) { |
| 272 | #ifdef ZIG_ENABLE_MEM_PROFILE | | |
| 273 | const char *name = ir_inst_src_type_str(inst->id); | | |
| 274 | #else | | |
| 275 | const char *name = nullptr; | | |
| 276 | #endif | | |
| 277 | switch (inst->id) { | 272 | switch (inst->id) { |
| 278 | case IrInstSrcIdInvalid: | 273 | case IrInstSrcIdInvalid: |
| 279 | zig_unreachable(); | 274 | zig_unreachable(); |
| 280 | case IrInstSrcIdReturn: | 275 | case IrInstSrcIdReturn: |
| 281 | return destroy(reinterpret_cast<IrInstSrcReturn *>(inst), name); | 276 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcReturn *>(inst)); |
| 282 | case IrInstSrcIdConst: | 277 | case IrInstSrcIdConst: |
| 283 | return destroy(reinterpret_cast<IrInstSrcConst *>(inst), name); | 278 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcConst *>(inst)); |
| 284 | case IrInstSrcIdBinOp: | 279 | case IrInstSrcIdBinOp: |
| 285 | return destroy(reinterpret_cast<IrInstSrcBinOp *>(inst), name); | 280 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBinOp *>(inst)); |
| 286 | case IrInstSrcIdMergeErrSets: | 281 | case IrInstSrcIdMergeErrSets: |
| 287 | return destroy(reinterpret_cast<IrInstSrcMergeErrSets *>(inst), name); | 282 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMergeErrSets *>(inst)); |
| 288 | case IrInstSrcIdDeclVar: | 283 | case IrInstSrcIdDeclVar: |
| 289 | return destroy(reinterpret_cast<IrInstSrcDeclVar *>(inst), name); | 284 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcDeclVar *>(inst)); |
| 290 | case IrInstSrcIdCall: | 285 | case IrInstSrcIdCall: |
| 291 | return destroy(reinterpret_cast<IrInstSrcCall *>(inst), name); | 286 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCall *>(inst)); |
| 292 | case IrInstSrcIdCallExtra: | 287 | case IrInstSrcIdCallExtra: |
| 293 | return destroy(reinterpret_cast<IrInstSrcCallExtra *>(inst), name); | 288 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCallExtra *>(inst)); |
| 294 | case IrInstSrcIdUnOp: | 289 | case IrInstSrcIdUnOp: |
| 295 | return destroy(reinterpret_cast<IrInstSrcUnOp *>(inst), name); | 290 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcUnOp *>(inst)); |
| 296 | case IrInstSrcIdCondBr: | 291 | case IrInstSrcIdCondBr: |
| 297 | return destroy(reinterpret_cast<IrInstSrcCondBr *>(inst), name); | 292 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCondBr *>(inst)); |
| 298 | case IrInstSrcIdBr: | 293 | case IrInstSrcIdBr: |
| 299 | return destroy(reinterpret_cast<IrInstSrcBr *>(inst), name); | 294 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBr *>(inst)); |
| 300 | case IrInstSrcIdPhi: | 295 | case IrInstSrcIdPhi: |
| 301 | return destroy(reinterpret_cast<IrInstSrcPhi *>(inst), name); | 296 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcPhi *>(inst)); |
| 302 | case IrInstSrcIdContainerInitList: | 297 | case IrInstSrcIdContainerInitList: |
| 303 | return destroy(reinterpret_cast<IrInstSrcContainerInitList *>(inst), name); | 298 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcContainerInitList *>(inst)); |
| 304 | case IrInstSrcIdContainerInitFields: | 299 | case IrInstSrcIdContainerInitFields: |
| 305 | return destroy(reinterpret_cast<IrInstSrcContainerInitFields *>(inst), name); | 300 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcContainerInitFields *>(inst)); |
| 306 | case IrInstSrcIdUnreachable: | 301 | case IrInstSrcIdUnreachable: |
| 307 | return destroy(reinterpret_cast<IrInstSrcUnreachable *>(inst), name); | 302 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcUnreachable *>(inst)); |
| 308 | case IrInstSrcIdElemPtr: | 303 | case IrInstSrcIdElemPtr: |
| 309 | return destroy(reinterpret_cast<IrInstSrcElemPtr *>(inst), name); | 304 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcElemPtr *>(inst)); |
| 310 | case IrInstSrcIdVarPtr: | 305 | case IrInstSrcIdVarPtr: |
| 311 | return destroy(reinterpret_cast<IrInstSrcVarPtr *>(inst), name); | 306 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcVarPtr *>(inst)); |
| 312 | case IrInstSrcIdLoadPtr: | 307 | case IrInstSrcIdLoadPtr: |
| 313 | return destroy(reinterpret_cast<IrInstSrcLoadPtr *>(inst), name); | 308 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcLoadPtr *>(inst)); |
| 314 | case IrInstSrcIdStorePtr: | 309 | case IrInstSrcIdStorePtr: |
| 315 | return destroy(reinterpret_cast<IrInstSrcStorePtr *>(inst), name); | 310 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcStorePtr *>(inst)); |
| 316 | case IrInstSrcIdTypeOf: | 311 | case IrInstSrcIdTypeOf: |
| 317 | return destroy(reinterpret_cast<IrInstSrcTypeOf *>(inst), name); | 312 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTypeOf *>(inst)); |
| 318 | case IrInstSrcIdFieldPtr: | 313 | case IrInstSrcIdFieldPtr: |
| 319 | return destroy(reinterpret_cast<IrInstSrcFieldPtr *>(inst), name); | 314 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFieldPtr *>(inst)); |
| 320 | case IrInstSrcIdSetCold: | 315 | case IrInstSrcIdSetCold: |
| 321 | return destroy(reinterpret_cast<IrInstSrcSetCold *>(inst), name); | 316 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetCold *>(inst)); |
| 322 | case IrInstSrcIdSetRuntimeSafety: | 317 | case IrInstSrcIdSetRuntimeSafety: |
| 323 | return destroy(reinterpret_cast<IrInstSrcSetRuntimeSafety *>(inst), name); | 318 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetRuntimeSafety *>(inst)); |
| 324 | case IrInstSrcIdSetFloatMode: | 319 | case IrInstSrcIdSetFloatMode: |
| 325 | return destroy(reinterpret_cast<IrInstSrcSetFloatMode *>(inst), name); | 320 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetFloatMode *>(inst)); |
| 326 | case IrInstSrcIdArrayType: | 321 | case IrInstSrcIdArrayType: |
| 327 | return destroy(reinterpret_cast<IrInstSrcArrayType *>(inst), name); | 322 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcArrayType *>(inst)); |
| 328 | case IrInstSrcIdSliceType: | 323 | case IrInstSrcIdSliceType: |
| 329 | return destroy(reinterpret_cast<IrInstSrcSliceType *>(inst), name); | 324 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSliceType *>(inst)); |
| 330 | case IrInstSrcIdAnyFrameType: | 325 | case IrInstSrcIdAnyFrameType: |
| 331 | return destroy(reinterpret_cast<IrInstSrcAnyFrameType *>(inst), name); | 326 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAnyFrameType *>(inst)); |
| 332 | case IrInstSrcIdAsm: | 327 | case IrInstSrcIdAsm: |
| 333 | return destroy(reinterpret_cast<IrInstSrcAsm *>(inst), name); | 328 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAsm *>(inst)); |
| 334 | case IrInstSrcIdSizeOf: | 329 | case IrInstSrcIdSizeOf: |
| 335 | return destroy(reinterpret_cast<IrInstSrcSizeOf *>(inst), name); | 330 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSizeOf *>(inst)); |
| 336 | case IrInstSrcIdTestNonNull: | 331 | case IrInstSrcIdTestNonNull: |
| 337 | return destroy(reinterpret_cast<IrInstSrcTestNonNull *>(inst), name); | 332 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTestNonNull *>(inst)); |
| 338 | case IrInstSrcIdOptionalUnwrapPtr: | 333 | case IrInstSrcIdOptionalUnwrapPtr: |
| 339 | return destroy(reinterpret_cast<IrInstSrcOptionalUnwrapPtr *>(inst), name); | 334 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcOptionalUnwrapPtr *>(inst)); |
| 340 | case IrInstSrcIdPopCount: | 335 | case IrInstSrcIdPopCount: |
| 341 | return destroy(reinterpret_cast<IrInstSrcPopCount *>(inst), name); | 336 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcPopCount *>(inst)); |
| 342 | case IrInstSrcIdClz: | 337 | case IrInstSrcIdClz: |
| 343 | return destroy(reinterpret_cast<IrInstSrcClz *>(inst), name); | 338 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcClz *>(inst)); |
| 344 | case IrInstSrcIdCtz: | 339 | case IrInstSrcIdCtz: |
| 345 | return destroy(reinterpret_cast<IrInstSrcCtz *>(inst), name); | 340 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCtz *>(inst)); |
| 346 | case IrInstSrcIdBswap: | 341 | case IrInstSrcIdBswap: |
| 347 | return destroy(reinterpret_cast<IrInstSrcBswap *>(inst), name); | 342 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBswap *>(inst)); |
| 348 | case IrInstSrcIdBitReverse: | 343 | case IrInstSrcIdBitReverse: |
| 349 | return destroy(reinterpret_cast<IrInstSrcBitReverse *>(inst), name); | 344 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBitReverse *>(inst)); |
| 350 | case IrInstSrcIdSwitchBr: | 345 | case IrInstSrcIdSwitchBr: |
| 351 | return destroy(reinterpret_cast<IrInstSrcSwitchBr *>(inst), name); | 346 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSwitchBr *>(inst)); |
| 352 | case IrInstSrcIdSwitchVar: | 347 | case IrInstSrcIdSwitchVar: |
| 353 | return destroy(reinterpret_cast<IrInstSrcSwitchVar *>(inst), name); | 348 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSwitchVar *>(inst)); |
| 354 | case IrInstSrcIdSwitchElseVar: | 349 | case IrInstSrcIdSwitchElseVar: |
| 355 | return destroy(reinterpret_cast<IrInstSrcSwitchElseVar *>(inst), name); | 350 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSwitchElseVar *>(inst)); |
| 356 | case IrInstSrcIdSwitchTarget: | 351 | case IrInstSrcIdSwitchTarget: |
| 357 | return destroy(reinterpret_cast<IrInstSrcSwitchTarget *>(inst), name); | 352 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSwitchTarget *>(inst)); |
| 358 | case IrInstSrcIdImport: | 353 | case IrInstSrcIdImport: |
| 359 | return destroy(reinterpret_cast<IrInstSrcImport *>(inst), name); | 354 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcImport *>(inst)); |
| 360 | case IrInstSrcIdRef: | 355 | case IrInstSrcIdRef: |
| 361 | return destroy(reinterpret_cast<IrInstSrcRef *>(inst), name); | 356 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcRef *>(inst)); |
| 362 | case IrInstSrcIdCompileErr: | 357 | case IrInstSrcIdCompileErr: |
| 363 | return destroy(reinterpret_cast<IrInstSrcCompileErr *>(inst), name); | 358 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCompileErr *>(inst)); |
| 364 | case IrInstSrcIdCompileLog: | 359 | case IrInstSrcIdCompileLog: |
| 365 | return destroy(reinterpret_cast<IrInstSrcCompileLog *>(inst), name); | 360 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCompileLog *>(inst)); |
| 366 | case IrInstSrcIdErrName: | 361 | case IrInstSrcIdErrName: |
| 367 | return destroy(reinterpret_cast<IrInstSrcErrName *>(inst), name); | 362 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcErrName *>(inst)); |
| 368 | case IrInstSrcIdCImport: | 363 | case IrInstSrcIdCImport: |
| 369 | return destroy(reinterpret_cast<IrInstSrcCImport *>(inst), name); | 364 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCImport *>(inst)); |
| 370 | case IrInstSrcIdCInclude: | 365 | case IrInstSrcIdCInclude: |
| 371 | return destroy(reinterpret_cast<IrInstSrcCInclude *>(inst), name); | 366 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCInclude *>(inst)); |
| 372 | case IrInstSrcIdCDefine: | 367 | case IrInstSrcIdCDefine: |
| 373 | return destroy(reinterpret_cast<IrInstSrcCDefine *>(inst), name); | 368 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCDefine *>(inst)); |
| 374 | case IrInstSrcIdCUndef: | 369 | case IrInstSrcIdCUndef: |
| 375 | return destroy(reinterpret_cast<IrInstSrcCUndef *>(inst), name); | 370 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCUndef *>(inst)); |
| 376 | case IrInstSrcIdEmbedFile: | 371 | case IrInstSrcIdEmbedFile: |
| 377 | return destroy(reinterpret_cast<IrInstSrcEmbedFile *>(inst), name); | 372 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcEmbedFile *>(inst)); |
| 378 | case IrInstSrcIdCmpxchg: | 373 | case IrInstSrcIdCmpxchg: |
| 379 | return destroy(reinterpret_cast<IrInstSrcCmpxchg *>(inst), name); | 374 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCmpxchg *>(inst)); |
| 380 | case IrInstSrcIdFence: | 375 | case IrInstSrcIdFence: |
| 381 | return destroy(reinterpret_cast<IrInstSrcFence *>(inst), name); | 376 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFence *>(inst)); |
| 382 | case IrInstSrcIdTruncate: | 377 | case IrInstSrcIdTruncate: |
| 383 | return destroy(reinterpret_cast<IrInstSrcTruncate *>(inst), name); | 378 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTruncate *>(inst)); |
| 384 | case IrInstSrcIdIntCast: | 379 | case IrInstSrcIdIntCast: |
| 385 | return destroy(reinterpret_cast<IrInstSrcIntCast *>(inst), name); | 380 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcIntCast *>(inst)); |
| 386 | case IrInstSrcIdFloatCast: | 381 | case IrInstSrcIdFloatCast: |
| 387 | return destroy(reinterpret_cast<IrInstSrcFloatCast *>(inst), name); | 382 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFloatCast *>(inst)); |
| 388 | case IrInstSrcIdErrSetCast: | 383 | case IrInstSrcIdErrSetCast: |
| 389 | return destroy(reinterpret_cast<IrInstSrcErrSetCast *>(inst), name); | 384 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcErrSetCast *>(inst)); |
| 390 | case IrInstSrcIdFromBytes: | 385 | case IrInstSrcIdFromBytes: |
| 391 | return destroy(reinterpret_cast<IrInstSrcFromBytes *>(inst), name); | 386 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFromBytes *>(inst)); |
| 392 | case IrInstSrcIdToBytes: | 387 | case IrInstSrcIdToBytes: |
| 393 | return destroy(reinterpret_cast<IrInstSrcToBytes *>(inst), name); | 388 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcToBytes *>(inst)); |
| 394 | case IrInstSrcIdIntToFloat: | 389 | case IrInstSrcIdIntToFloat: |
| 395 | return destroy(reinterpret_cast<IrInstSrcIntToFloat *>(inst), name); | 390 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcIntToFloat *>(inst)); |
| 396 | case IrInstSrcIdFloatToInt: | 391 | case IrInstSrcIdFloatToInt: |
| 397 | return destroy(reinterpret_cast<IrInstSrcFloatToInt *>(inst), name); | 392 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFloatToInt *>(inst)); |
| 398 | case IrInstSrcIdBoolToInt: | 393 | case IrInstSrcIdBoolToInt: |
| 399 | return destroy(reinterpret_cast<IrInstSrcBoolToInt *>(inst), name); | 394 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBoolToInt *>(inst)); |
| 400 | case IrInstSrcIdIntType: | 395 | case IrInstSrcIdIntType: |
| 401 | return destroy(reinterpret_cast<IrInstSrcIntType *>(inst), name); | 396 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcIntType *>(inst)); |
| 402 | case IrInstSrcIdVectorType: | 397 | case IrInstSrcIdVectorType: |
| 403 | return destroy(reinterpret_cast<IrInstSrcVectorType *>(inst), name); | 398 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcVectorType *>(inst)); |
| 404 | case IrInstSrcIdShuffleVector: | 399 | case IrInstSrcIdShuffleVector: |
| 405 | return destroy(reinterpret_cast<IrInstSrcShuffleVector *>(inst), name); | 400 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcShuffleVector *>(inst)); |
| 406 | case IrInstSrcIdSplat: | 401 | case IrInstSrcIdSplat: |
| 407 | return destroy(reinterpret_cast<IrInstSrcSplat *>(inst), name); | 402 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSplat *>(inst)); |
| 408 | case IrInstSrcIdBoolNot: | 403 | case IrInstSrcIdBoolNot: |
| 409 | return destroy(reinterpret_cast<IrInstSrcBoolNot *>(inst), name); | 404 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBoolNot *>(inst)); |
| 410 | case IrInstSrcIdMemset: | 405 | case IrInstSrcIdMemset: |
| 411 | return destroy(reinterpret_cast<IrInstSrcMemset *>(inst), name); | 406 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemset *>(inst)); |
| 412 | case IrInstSrcIdMemcpy: | 407 | case IrInstSrcIdMemcpy: |
| 413 | return destroy(reinterpret_cast<IrInstSrcMemcpy *>(inst), name); | 408 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemcpy *>(inst)); |
| 414 | case IrInstSrcIdSlice: | 409 | case IrInstSrcIdSlice: |
| 415 | return destroy(reinterpret_cast<IrInstSrcSlice *>(inst), name); | 410 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSlice *>(inst)); |
| 416 | case IrInstSrcIdMemberCount: | 411 | case IrInstSrcIdMemberCount: |
| 417 | return destroy(reinterpret_cast<IrInstSrcMemberCount *>(inst), name); | 412 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemberCount *>(inst)); |
| 418 | case IrInstSrcIdMemberType: | 413 | case IrInstSrcIdMemberType: |
| 419 | return destroy(reinterpret_cast<IrInstSrcMemberType *>(inst), name); | 414 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemberType *>(inst)); |
| 420 | case IrInstSrcIdMemberName: | 415 | case IrInstSrcIdMemberName: |
| 421 | return destroy(reinterpret_cast<IrInstSrcMemberName *>(inst), name); | 416 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemberName *>(inst)); |
| 422 | case IrInstSrcIdBreakpoint: | 417 | case IrInstSrcIdBreakpoint: |
| 423 | return destroy(reinterpret_cast<IrInstSrcBreakpoint *>(inst), name); | 418 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBreakpoint *>(inst)); |
| 424 | case IrInstSrcIdReturnAddress: | 419 | case IrInstSrcIdReturnAddress: |
| 425 | return destroy(reinterpret_cast<IrInstSrcReturnAddress *>(inst), name); | 420 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcReturnAddress *>(inst)); |
| 426 | case IrInstSrcIdFrameAddress: | 421 | case IrInstSrcIdFrameAddress: |
| 427 | return destroy(reinterpret_cast<IrInstSrcFrameAddress *>(inst), name); | 422 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFrameAddress *>(inst)); |
| 428 | case IrInstSrcIdFrameHandle: | 423 | case IrInstSrcIdFrameHandle: |
| 429 | return destroy(reinterpret_cast<IrInstSrcFrameHandle *>(inst), name); | 424 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFrameHandle *>(inst)); |
| 430 | case IrInstSrcIdFrameType: | 425 | case IrInstSrcIdFrameType: |
| 431 | return destroy(reinterpret_cast<IrInstSrcFrameType *>(inst), name); | 426 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFrameType *>(inst)); |
| 432 | case IrInstSrcIdFrameSize: | 427 | case IrInstSrcIdFrameSize: |
| 433 | return destroy(reinterpret_cast<IrInstSrcFrameSize *>(inst), name); | 428 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFrameSize *>(inst)); |
| 434 | case IrInstSrcIdAlignOf: | 429 | case IrInstSrcIdAlignOf: |
| 435 | return destroy(reinterpret_cast<IrInstSrcAlignOf *>(inst), name); | 430 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAlignOf *>(inst)); |
| 436 | case IrInstSrcIdOverflowOp: | 431 | case IrInstSrcIdOverflowOp: |
| 437 | return destroy(reinterpret_cast<IrInstSrcOverflowOp *>(inst), name); | 432 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcOverflowOp *>(inst)); |
| 438 | case IrInstSrcIdTestErr: | 433 | case IrInstSrcIdTestErr: |
| 439 | return destroy(reinterpret_cast<IrInstSrcTestErr *>(inst), name); | 434 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTestErr *>(inst)); |
| 440 | case IrInstSrcIdUnwrapErrCode: | 435 | case IrInstSrcIdUnwrapErrCode: |
| 441 | return destroy(reinterpret_cast<IrInstSrcUnwrapErrCode *>(inst), name); | 436 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcUnwrapErrCode *>(inst)); |
| 442 | case IrInstSrcIdUnwrapErrPayload: | 437 | case IrInstSrcIdUnwrapErrPayload: |
| 443 | return destroy(reinterpret_cast<IrInstSrcUnwrapErrPayload *>(inst), name); | 438 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcUnwrapErrPayload *>(inst)); |
| 444 | case IrInstSrcIdFnProto: | 439 | case IrInstSrcIdFnProto: |
| 445 | return destroy(reinterpret_cast<IrInstSrcFnProto *>(inst), name); | 440 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFnProto *>(inst)); |
| 446 | case IrInstSrcIdTestComptime: | 441 | case IrInstSrcIdTestComptime: |
| 447 | return destroy(reinterpret_cast<IrInstSrcTestComptime *>(inst), name); | 442 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTestComptime *>(inst)); |
| 448 | case IrInstSrcIdPtrCast: | 443 | case IrInstSrcIdPtrCast: |
| 449 | return destroy(reinterpret_cast<IrInstSrcPtrCast *>(inst), name); | 444 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcPtrCast *>(inst)); |
| 450 | case IrInstSrcIdBitCast: | 445 | case IrInstSrcIdBitCast: |
| 451 | return destroy(reinterpret_cast<IrInstSrcBitCast *>(inst), name); | 446 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBitCast *>(inst)); |
| 452 | case IrInstSrcIdPtrToInt: | 447 | case IrInstSrcIdPtrToInt: |
| 453 | return destroy(reinterpret_cast<IrInstSrcPtrToInt *>(inst), name); | 448 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcPtrToInt *>(inst)); |
| 454 | case IrInstSrcIdIntToPtr: | 449 | case IrInstSrcIdIntToPtr: |
| 455 | return destroy(reinterpret_cast<IrInstSrcIntToPtr *>(inst), name); | 450 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcIntToPtr *>(inst)); |
| 456 | case IrInstSrcIdIntToEnum: | 451 | case IrInstSrcIdIntToEnum: |
| 457 | return destroy(reinterpret_cast<IrInstSrcIntToEnum *>(inst), name); | 452 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcIntToEnum *>(inst)); |
| 458 | case IrInstSrcIdIntToErr: | 453 | case IrInstSrcIdIntToErr: |
| 459 | return destroy(reinterpret_cast<IrInstSrcIntToErr *>(inst), name); | 454 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcIntToErr *>(inst)); |
| 460 | case IrInstSrcIdErrToInt: | 455 | case IrInstSrcIdErrToInt: |
| 461 | return destroy(reinterpret_cast<IrInstSrcErrToInt *>(inst), name); | 456 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcErrToInt *>(inst)); |
| 462 | case IrInstSrcIdCheckSwitchProngs: | 457 | case IrInstSrcIdCheckSwitchProngs: |
| 463 | return destroy(reinterpret_cast<IrInstSrcCheckSwitchProngs *>(inst), name); | 458 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCheckSwitchProngs *>(inst)); |
| 464 | case IrInstSrcIdCheckStatementIsVoid: | 459 | case IrInstSrcIdCheckStatementIsVoid: |
| 465 | return destroy(reinterpret_cast<IrInstSrcCheckStatementIsVoid *>(inst), name); | 460 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCheckStatementIsVoid *>(inst)); |
| 466 | case IrInstSrcIdTypeName: | 461 | case IrInstSrcIdTypeName: |
| 467 | return destroy(reinterpret_cast<IrInstSrcTypeName *>(inst), name); | 462 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTypeName *>(inst)); |
| 468 | case IrInstSrcIdTagName: | 463 | case IrInstSrcIdTagName: |
| 469 | return destroy(reinterpret_cast<IrInstSrcTagName *>(inst), name); | 464 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTagName *>(inst)); |
| 470 | case IrInstSrcIdPtrType: | 465 | case IrInstSrcIdPtrType: |
| 471 | return destroy(reinterpret_cast<IrInstSrcPtrType *>(inst), name); | 466 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcPtrType *>(inst)); |
| 472 | case IrInstSrcIdDeclRef: | 467 | case IrInstSrcIdDeclRef: |
| 473 | return destroy(reinterpret_cast<IrInstSrcDeclRef *>(inst), name); | 468 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcDeclRef *>(inst)); |
| 474 | case IrInstSrcIdPanic: | 469 | case IrInstSrcIdPanic: |
| 475 | return destroy(reinterpret_cast<IrInstSrcPanic *>(inst), name); | 470 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcPanic *>(inst)); |
| 476 | case IrInstSrcIdFieldParentPtr: | 471 | case IrInstSrcIdFieldParentPtr: |
| 477 | return destroy(reinterpret_cast<IrInstSrcFieldParentPtr *>(inst), name); | 472 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFieldParentPtr *>(inst)); |
| 478 | case IrInstSrcIdByteOffsetOf: | 473 | case IrInstSrcIdByteOffsetOf: |
| 479 | return destroy(reinterpret_cast<IrInstSrcByteOffsetOf *>(inst), name); | 474 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcByteOffsetOf *>(inst)); |
| 480 | case IrInstSrcIdBitOffsetOf: | 475 | case IrInstSrcIdBitOffsetOf: |
| 481 | return destroy(reinterpret_cast<IrInstSrcBitOffsetOf *>(inst), name); | 476 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBitOffsetOf *>(inst)); |
| 482 | case IrInstSrcIdTypeInfo: | 477 | case IrInstSrcIdTypeInfo: |
| 483 | return destroy(reinterpret_cast<IrInstSrcTypeInfo *>(inst), name); | 478 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTypeInfo *>(inst)); |
| 484 | case IrInstSrcIdType: | 479 | case IrInstSrcIdType: |
| 485 | return destroy(reinterpret_cast<IrInstSrcType *>(inst), name); | 480 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcType *>(inst)); |
| 486 | case IrInstSrcIdHasField: | 481 | case IrInstSrcIdHasField: |
| 487 | return destroy(reinterpret_cast<IrInstSrcHasField *>(inst), name); | 482 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcHasField *>(inst)); |
| 488 | case IrInstSrcIdTypeId: | 483 | case IrInstSrcIdTypeId: |
| 489 | return destroy(reinterpret_cast<IrInstSrcTypeId *>(inst), name); | 484 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTypeId *>(inst)); |
| 490 | case IrInstSrcIdSetEvalBranchQuota: | 485 | case IrInstSrcIdSetEvalBranchQuota: |
| 491 | return destroy(reinterpret_cast<IrInstSrcSetEvalBranchQuota *>(inst), name); | 486 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetEvalBranchQuota *>(inst)); |
| 492 | case IrInstSrcIdAlignCast: | 487 | case IrInstSrcIdAlignCast: |
| 493 | return destroy(reinterpret_cast<IrInstSrcAlignCast *>(inst), name); | 488 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAlignCast *>(inst)); |
| 494 | case IrInstSrcIdImplicitCast: | 489 | case IrInstSrcIdImplicitCast: |
| 495 | return destroy(reinterpret_cast<IrInstSrcImplicitCast *>(inst), name); | 490 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcImplicitCast *>(inst)); |
| 496 | case IrInstSrcIdResolveResult: | 491 | case IrInstSrcIdResolveResult: |
| 497 | return destroy(reinterpret_cast<IrInstSrcResolveResult *>(inst), name); | 492 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcResolveResult *>(inst)); |
| 498 | case IrInstSrcIdResetResult: | 493 | case IrInstSrcIdResetResult: |
| 499 | return destroy(reinterpret_cast<IrInstSrcResetResult *>(inst), name); | 494 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcResetResult *>(inst)); |
| 500 | case IrInstSrcIdOpaqueType: | 495 | case IrInstSrcIdOpaqueType: |
| 501 | return destroy(reinterpret_cast<IrInstSrcOpaqueType *>(inst), name); | 496 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcOpaqueType *>(inst)); |
| 502 | case IrInstSrcIdSetAlignStack: | 497 | case IrInstSrcIdSetAlignStack: |
| 503 | return destroy(reinterpret_cast<IrInstSrcSetAlignStack *>(inst), name); | 498 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetAlignStack *>(inst)); |
| 504 | case IrInstSrcIdArgType: | 499 | case IrInstSrcIdArgType: |
| 505 | return destroy(reinterpret_cast<IrInstSrcArgType *>(inst), name); | 500 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcArgType *>(inst)); |
| 506 | case IrInstSrcIdTagType: | 501 | case IrInstSrcIdTagType: |
| 507 | return destroy(reinterpret_cast<IrInstSrcTagType *>(inst), name); | 502 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTagType *>(inst)); |
| 508 | case IrInstSrcIdExport: | 503 | case IrInstSrcIdExport: |
| 509 | return destroy(reinterpret_cast<IrInstSrcExport *>(inst), name); | 504 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcExport *>(inst)); |
| 510 | case IrInstSrcIdErrorReturnTrace: | 505 | case IrInstSrcIdErrorReturnTrace: |
| 511 | return destroy(reinterpret_cast<IrInstSrcErrorReturnTrace *>(inst), name); | 506 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcErrorReturnTrace *>(inst)); |
| 512 | case IrInstSrcIdErrorUnion: | 507 | case IrInstSrcIdErrorUnion: |
| 513 | return destroy(reinterpret_cast<IrInstSrcErrorUnion *>(inst), name); | 508 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcErrorUnion *>(inst)); |
| 514 | case IrInstSrcIdAtomicRmw: | 509 | case IrInstSrcIdAtomicRmw: |
| 515 | return destroy(reinterpret_cast<IrInstSrcAtomicRmw *>(inst), name); | 510 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAtomicRmw *>(inst)); |
| 516 | case IrInstSrcIdSaveErrRetAddr: | 511 | case IrInstSrcIdSaveErrRetAddr: |
| 517 | return destroy(reinterpret_cast<IrInstSrcSaveErrRetAddr *>(inst), name); | 512 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSaveErrRetAddr *>(inst)); |
| 518 | case IrInstSrcIdAddImplicitReturnType: | 513 | case IrInstSrcIdAddImplicitReturnType: |
| 519 | return destroy(reinterpret_cast<IrInstSrcAddImplicitReturnType *>(inst), name); | 514 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAddImplicitReturnType *>(inst)); |
| 520 | case IrInstSrcIdFloatOp: | 515 | case IrInstSrcIdFloatOp: |
| 521 | return destroy(reinterpret_cast<IrInstSrcFloatOp *>(inst), name); | 516 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFloatOp *>(inst)); |
| 522 | case IrInstSrcIdMulAdd: | 517 | case IrInstSrcIdMulAdd: |
| 523 | return destroy(reinterpret_cast<IrInstSrcMulAdd *>(inst), name); | 518 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMulAdd *>(inst)); |
| 524 | case IrInstSrcIdAtomicLoad: | 519 | case IrInstSrcIdAtomicLoad: |
| 525 | return destroy(reinterpret_cast<IrInstSrcAtomicLoad *>(inst), name); | 520 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAtomicLoad *>(inst)); |
| 526 | case IrInstSrcIdAtomicStore: | 521 | case IrInstSrcIdAtomicStore: |
| 527 | return destroy(reinterpret_cast<IrInstSrcAtomicStore *>(inst), name); | 522 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAtomicStore *>(inst)); |
| 528 | case IrInstSrcIdEnumToInt: | 523 | case IrInstSrcIdEnumToInt: |
| 529 | return destroy(reinterpret_cast<IrInstSrcEnumToInt *>(inst), name); | 524 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcEnumToInt *>(inst)); |
| 530 | case IrInstSrcIdCheckRuntimeScope: | 525 | case IrInstSrcIdCheckRuntimeScope: |
| 531 | return destroy(reinterpret_cast<IrInstSrcCheckRuntimeScope *>(inst), name); | 526 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCheckRuntimeScope *>(inst)); |
| 532 | case IrInstSrcIdHasDecl: | 527 | case IrInstSrcIdHasDecl: |
| 533 | return destroy(reinterpret_cast<IrInstSrcHasDecl *>(inst), name); | 528 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcHasDecl *>(inst)); |
| 534 | case IrInstSrcIdUndeclaredIdent: | 529 | case IrInstSrcIdUndeclaredIdent: |
| 535 | return destroy(reinterpret_cast<IrInstSrcUndeclaredIdent *>(inst), name); | 530 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcUndeclaredIdent *>(inst)); |
| 536 | case IrInstSrcIdAlloca: | 531 | case IrInstSrcIdAlloca: |
| 537 | return destroy(reinterpret_cast<IrInstSrcAlloca *>(inst), name); | 532 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAlloca *>(inst)); |
| 538 | case IrInstSrcIdEndExpr: | 533 | case IrInstSrcIdEndExpr: |
| 539 | return destroy(reinterpret_cast<IrInstSrcEndExpr *>(inst), name); | 534 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcEndExpr *>(inst)); |
| 540 | case IrInstSrcIdUnionInitNamedField: | 535 | case IrInstSrcIdUnionInitNamedField: |
| 541 | return destroy(reinterpret_cast<IrInstSrcUnionInitNamedField *>(inst), name); | 536 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcUnionInitNamedField *>(inst)); |
| 542 | case IrInstSrcIdSuspendBegin: | 537 | case IrInstSrcIdSuspendBegin: |
| 543 | return destroy(reinterpret_cast<IrInstSrcSuspendBegin *>(inst), name); | 538 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSuspendBegin *>(inst)); |
| 544 | case IrInstSrcIdSuspendFinish: | 539 | case IrInstSrcIdSuspendFinish: |
| 545 | return destroy(reinterpret_cast<IrInstSrcSuspendFinish *>(inst), name); | 540 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSuspendFinish *>(inst)); |
| 546 | case IrInstSrcIdResume: | 541 | case IrInstSrcIdResume: |
| 547 | return destroy(reinterpret_cast<IrInstSrcResume *>(inst), name); | 542 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcResume *>(inst)); |
| 548 | case IrInstSrcIdAwait: | 543 | case IrInstSrcIdAwait: |
| 549 | return destroy(reinterpret_cast<IrInstSrcAwait *>(inst), name); | 544 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcAwait *>(inst)); |
| 550 | case IrInstSrcIdSpillBegin: | 545 | case IrInstSrcIdSpillBegin: |
| 551 | return destroy(reinterpret_cast<IrInstSrcSpillBegin *>(inst), name); | 546 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSpillBegin *>(inst)); |
| 552 | case IrInstSrcIdSpillEnd: | 547 | case IrInstSrcIdSpillEnd: |
| 553 | return destroy(reinterpret_cast<IrInstSrcSpillEnd *>(inst), name); | 548 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSpillEnd *>(inst)); |
| 554 | case IrInstSrcIdCallArgs: | 549 | case IrInstSrcIdCallArgs: |
| 555 | return destroy(reinterpret_cast<IrInstSrcCallArgs *>(inst), name); | 550 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcCallArgs *>(inst)); |
| 556 | } | 551 | } |
| 557 | zig_unreachable(); | 552 | zig_unreachable(); |
| 558 | } | 553 | } |
| 559 | | 554 | |
| 560 | void destroy_instruction_gen(IrInstGen *inst) { | 555 | void destroy_instruction_gen(IrInstGen *inst) { |
| 561 | #ifdef ZIG_ENABLE_MEM_PROFILE | | |
| 562 | const char *name = ir_inst_gen_type_str(inst->id); | | |
| 563 | #else | | |
| 564 | const char *name = nullptr; | | |
| 565 | #endif | | |
| 566 | switch (inst->id) { | 556 | switch (inst->id) { |
| 567 | case IrInstGenIdInvalid: | 557 | case IrInstGenIdInvalid: |
| 568 | zig_unreachable(); | 558 | zig_unreachable(); |
| 569 | case IrInstGenIdReturn: | 559 | case IrInstGenIdReturn: |
| 570 | return destroy(reinterpret_cast<IrInstGenReturn *>(inst), name); | 560 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenReturn *>(inst)); |
| 571 | case IrInstGenIdConst: | 561 | case IrInstGenIdConst: |
| 572 | return destroy(reinterpret_cast<IrInstGenConst *>(inst), name); | 562 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenConst *>(inst)); |
| 573 | case IrInstGenIdBinOp: | 563 | case IrInstGenIdBinOp: |
| 574 | return destroy(reinterpret_cast<IrInstGenBinOp *>(inst), name); | 564 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBinOp *>(inst)); |
| 575 | case IrInstGenIdCast: | 565 | case IrInstGenIdCast: |
| 576 | return destroy(reinterpret_cast<IrInstGenCast *>(inst), name); | 566 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenCast *>(inst)); |
| 577 | case IrInstGenIdCall: | 567 | case IrInstGenIdCall: |
| 578 | return destroy(reinterpret_cast<IrInstGenCall *>(inst), name); | 568 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenCall *>(inst)); |
| 579 | case IrInstGenIdCondBr: | 569 | case IrInstGenIdCondBr: |
| 580 | return destroy(reinterpret_cast<IrInstGenCondBr *>(inst), name); | 570 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenCondBr *>(inst)); |
| 581 | case IrInstGenIdBr: | 571 | case IrInstGenIdBr: |
| 582 | return destroy(reinterpret_cast<IrInstGenBr *>(inst), name); | 572 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBr *>(inst)); |
| 583 | case IrInstGenIdPhi: | 573 | case IrInstGenIdPhi: |
| 584 | return destroy(reinterpret_cast<IrInstGenPhi *>(inst), name); | 574 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenPhi *>(inst)); |
| 585 | case IrInstGenIdUnreachable: | 575 | case IrInstGenIdUnreachable: |
| 586 | return destroy(reinterpret_cast<IrInstGenUnreachable *>(inst), name); | 576 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenUnreachable *>(inst)); |
| 587 | case IrInstGenIdElemPtr: | 577 | case IrInstGenIdElemPtr: |
| 588 | return destroy(reinterpret_cast<IrInstGenElemPtr *>(inst), name); | 578 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenElemPtr *>(inst)); |
| 589 | case IrInstGenIdVarPtr: | 579 | case IrInstGenIdVarPtr: |
| 590 | return destroy(reinterpret_cast<IrInstGenVarPtr *>(inst), name); | 580 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenVarPtr *>(inst)); |
| 591 | case IrInstGenIdReturnPtr: | 581 | case IrInstGenIdReturnPtr: |
| 592 | return destroy(reinterpret_cast<IrInstGenReturnPtr *>(inst), name); | 582 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenReturnPtr *>(inst)); |
| 593 | case IrInstGenIdLoadPtr: | 583 | case IrInstGenIdLoadPtr: |
| 594 | return destroy(reinterpret_cast<IrInstGenLoadPtr *>(inst), name); | 584 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenLoadPtr *>(inst)); |
| 595 | case IrInstGenIdStorePtr: | 585 | case IrInstGenIdStorePtr: |
| 596 | return destroy(reinterpret_cast<IrInstGenStorePtr *>(inst), name); | 586 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenStorePtr *>(inst)); |
| 597 | case IrInstGenIdVectorStoreElem: | 587 | case IrInstGenIdVectorStoreElem: |
| 598 | return destroy(reinterpret_cast<IrInstGenVectorStoreElem *>(inst), name); | 588 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenVectorStoreElem *>(inst)); |
| 599 | case IrInstGenIdStructFieldPtr: | 589 | case IrInstGenIdStructFieldPtr: |
| 600 | return destroy(reinterpret_cast<IrInstGenStructFieldPtr *>(inst), name); | 590 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenStructFieldPtr *>(inst)); |
| 601 | case IrInstGenIdUnionFieldPtr: | 591 | case IrInstGenIdUnionFieldPtr: |
| 602 | return destroy(reinterpret_cast<IrInstGenUnionFieldPtr *>(inst), name); | 592 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenUnionFieldPtr *>(inst)); |
| 603 | case IrInstGenIdAsm: | 593 | case IrInstGenIdAsm: |
| 604 | return destroy(reinterpret_cast<IrInstGenAsm *>(inst), name); | 594 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAsm *>(inst)); |
| 605 | case IrInstGenIdTestNonNull: | 595 | case IrInstGenIdTestNonNull: |
| 606 | return destroy(reinterpret_cast<IrInstGenTestNonNull *>(inst), name); | 596 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenTestNonNull *>(inst)); |
| 607 | case IrInstGenIdOptionalUnwrapPtr: | 597 | case IrInstGenIdOptionalUnwrapPtr: |
| 608 | return destroy(reinterpret_cast<IrInstGenOptionalUnwrapPtr *>(inst), name); | 598 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenOptionalUnwrapPtr *>(inst)); |
| 609 | case IrInstGenIdPopCount: | 599 | case IrInstGenIdPopCount: |
| 610 | return destroy(reinterpret_cast<IrInstGenPopCount *>(inst), name); | 600 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenPopCount *>(inst)); |
| 611 | case IrInstGenIdClz: | 601 | case IrInstGenIdClz: |
| 612 | return destroy(reinterpret_cast<IrInstGenClz *>(inst), name); | 602 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenClz *>(inst)); |
| 613 | case IrInstGenIdCtz: | 603 | case IrInstGenIdCtz: |
| 614 | return destroy(reinterpret_cast<IrInstGenCtz *>(inst), name); | 604 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenCtz *>(inst)); |
| 615 | case IrInstGenIdBswap: | 605 | case IrInstGenIdBswap: |
| 616 | return destroy(reinterpret_cast<IrInstGenBswap *>(inst), name); | 606 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBswap *>(inst)); |
| 617 | case IrInstGenIdBitReverse: | 607 | case IrInstGenIdBitReverse: |
| 618 | return destroy(reinterpret_cast<IrInstGenBitReverse *>(inst), name); | 608 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBitReverse *>(inst)); |
| 619 | case IrInstGenIdSwitchBr: | 609 | case IrInstGenIdSwitchBr: |
| 620 | return destroy(reinterpret_cast<IrInstGenSwitchBr *>(inst), name); | 610 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSwitchBr *>(inst)); |
| 621 | case IrInstGenIdUnionTag: | 611 | case IrInstGenIdUnionTag: |
| 622 | return destroy(reinterpret_cast<IrInstGenUnionTag *>(inst), name); | 612 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenUnionTag *>(inst)); |
| 623 | case IrInstGenIdRef: | 613 | case IrInstGenIdRef: |
| 624 | return destroy(reinterpret_cast<IrInstGenRef *>(inst), name); | 614 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenRef *>(inst)); |
| 625 | case IrInstGenIdErrName: | 615 | case IrInstGenIdErrName: |
| 626 | return destroy(reinterpret_cast<IrInstGenErrName *>(inst), name); | 616 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenErrName *>(inst)); |
| 627 | case IrInstGenIdCmpxchg: | 617 | case IrInstGenIdCmpxchg: |
| 628 | return destroy(reinterpret_cast<IrInstGenCmpxchg *>(inst), name); | 618 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenCmpxchg *>(inst)); |
| 629 | case IrInstGenIdFence: | 619 | case IrInstGenIdFence: |
| 630 | return destroy(reinterpret_cast<IrInstGenFence *>(inst), name); | 620 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenFence *>(inst)); |
| 631 | case IrInstGenIdTruncate: | 621 | case IrInstGenIdTruncate: |
| 632 | return destroy(reinterpret_cast<IrInstGenTruncate *>(inst), name); | 622 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenTruncate *>(inst)); |
| 633 | case IrInstGenIdShuffleVector: | 623 | case IrInstGenIdShuffleVector: |
| 634 | return destroy(reinterpret_cast<IrInstGenShuffleVector *>(inst), name); | 624 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenShuffleVector *>(inst)); |
| 635 | case IrInstGenIdSplat: | 625 | case IrInstGenIdSplat: |
| 636 | return destroy(reinterpret_cast<IrInstGenSplat *>(inst), name); | 626 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSplat *>(inst)); |
| 637 | case IrInstGenIdBoolNot: | 627 | case IrInstGenIdBoolNot: |
| 638 | return destroy(reinterpret_cast<IrInstGenBoolNot *>(inst), name); | 628 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBoolNot *>(inst)); |
| 639 | case IrInstGenIdMemset: | 629 | case IrInstGenIdMemset: |
| 640 | return destroy(reinterpret_cast<IrInstGenMemset *>(inst), name); | 630 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenMemset *>(inst)); |
| 641 | case IrInstGenIdMemcpy: | 631 | case IrInstGenIdMemcpy: |
| 642 | return destroy(reinterpret_cast<IrInstGenMemcpy *>(inst), name); | 632 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenMemcpy *>(inst)); |
| 643 | case IrInstGenIdSlice: | 633 | case IrInstGenIdSlice: |
| 644 | return destroy(reinterpret_cast<IrInstGenSlice *>(inst), name); | 634 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSlice *>(inst)); |
| 645 | case IrInstGenIdBreakpoint: | 635 | case IrInstGenIdBreakpoint: |
| 646 | return destroy(reinterpret_cast<IrInstGenBreakpoint *>(inst), name); | 636 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBreakpoint *>(inst)); |
| 647 | case IrInstGenIdReturnAddress: | 637 | case IrInstGenIdReturnAddress: |
| 648 | return destroy(reinterpret_cast<IrInstGenReturnAddress *>(inst), name); | 638 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenReturnAddress *>(inst)); |
| 649 | case IrInstGenIdFrameAddress: | 639 | case IrInstGenIdFrameAddress: |
| 650 | return destroy(reinterpret_cast<IrInstGenFrameAddress *>(inst), name); | 640 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenFrameAddress *>(inst)); |
| 651 | case IrInstGenIdFrameHandle: | 641 | case IrInstGenIdFrameHandle: |
| 652 | return destroy(reinterpret_cast<IrInstGenFrameHandle *>(inst), name); | 642 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenFrameHandle *>(inst)); |
| 653 | case IrInstGenIdFrameSize: | 643 | case IrInstGenIdFrameSize: |
| 654 | return destroy(reinterpret_cast<IrInstGenFrameSize *>(inst), name); | 644 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenFrameSize *>(inst)); |
| 655 | case IrInstGenIdOverflowOp: | 645 | case IrInstGenIdOverflowOp: |
| 656 | return destroy(reinterpret_cast<IrInstGenOverflowOp *>(inst), name); | 646 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenOverflowOp *>(inst)); |
| 657 | case IrInstGenIdTestErr: | 647 | case IrInstGenIdTestErr: |
| 658 | return destroy(reinterpret_cast<IrInstGenTestErr *>(inst), name); | 648 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenTestErr *>(inst)); |
| 659 | case IrInstGenIdUnwrapErrCode: | 649 | case IrInstGenIdUnwrapErrCode: |
| 660 | return destroy(reinterpret_cast<IrInstGenUnwrapErrCode *>(inst), name); | 650 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenUnwrapErrCode *>(inst)); |
| 661 | case IrInstGenIdUnwrapErrPayload: | 651 | case IrInstGenIdUnwrapErrPayload: |
| 662 | return destroy(reinterpret_cast<IrInstGenUnwrapErrPayload *>(inst), name); | 652 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenUnwrapErrPayload *>(inst)); |
| 663 | case IrInstGenIdOptionalWrap: | 653 | case IrInstGenIdOptionalWrap: |
| 664 | return destroy(reinterpret_cast<IrInstGenOptionalWrap *>(inst), name); | 654 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenOptionalWrap *>(inst)); |
| 665 | case IrInstGenIdErrWrapCode: | 655 | case IrInstGenIdErrWrapCode: |
| 666 | return destroy(reinterpret_cast<IrInstGenErrWrapCode *>(inst), name); | 656 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenErrWrapCode *>(inst)); |
| 667 | case IrInstGenIdErrWrapPayload: | 657 | case IrInstGenIdErrWrapPayload: |
| 668 | return destroy(reinterpret_cast<IrInstGenErrWrapPayload *>(inst), name); | 658 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenErrWrapPayload *>(inst)); |
| 669 | case IrInstGenIdPtrCast: | 659 | case IrInstGenIdPtrCast: |
| 670 | return destroy(reinterpret_cast<IrInstGenPtrCast *>(inst), name); | 660 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenPtrCast *>(inst)); |
| 671 | case IrInstGenIdBitCast: | 661 | case IrInstGenIdBitCast: |
| 672 | return destroy(reinterpret_cast<IrInstGenBitCast *>(inst), name); | 662 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBitCast *>(inst)); |
| 673 | case IrInstGenIdWidenOrShorten: | 663 | case IrInstGenIdWidenOrShorten: |
| 674 | return destroy(reinterpret_cast<IrInstGenWidenOrShorten *>(inst), name); | 664 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenWidenOrShorten *>(inst)); |
| 675 | case IrInstGenIdPtrToInt: | 665 | case IrInstGenIdPtrToInt: |
| 676 | return destroy(reinterpret_cast<IrInstGenPtrToInt *>(inst), name); | 666 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenPtrToInt *>(inst)); |
| 677 | case IrInstGenIdIntToPtr: | 667 | case IrInstGenIdIntToPtr: |
| 678 | return destroy(reinterpret_cast<IrInstGenIntToPtr *>(inst), name); | 668 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenIntToPtr *>(inst)); |
| 679 | case IrInstGenIdIntToEnum: | 669 | case IrInstGenIdIntToEnum: |
| 680 | return destroy(reinterpret_cast<IrInstGenIntToEnum *>(inst), name); | 670 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenIntToEnum *>(inst)); |
| 681 | case IrInstGenIdIntToErr: | 671 | case IrInstGenIdIntToErr: |
| 682 | return destroy(reinterpret_cast<IrInstGenIntToErr *>(inst), name); | 672 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenIntToErr *>(inst)); |
| 683 | case IrInstGenIdErrToInt: | 673 | case IrInstGenIdErrToInt: |
| 684 | return destroy(reinterpret_cast<IrInstGenErrToInt *>(inst), name); | 674 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenErrToInt *>(inst)); |
| 685 | case IrInstGenIdTagName: | 675 | case IrInstGenIdTagName: |
| 686 | return destroy(reinterpret_cast<IrInstGenTagName *>(inst), name); | 676 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenTagName *>(inst)); |
| 687 | case IrInstGenIdPanic: | 677 | case IrInstGenIdPanic: |
| 688 | return destroy(reinterpret_cast<IrInstGenPanic *>(inst), name); | 678 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenPanic *>(inst)); |
| 689 | case IrInstGenIdFieldParentPtr: | 679 | case IrInstGenIdFieldParentPtr: |
| 690 | return destroy(reinterpret_cast<IrInstGenFieldParentPtr *>(inst), name); | 680 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenFieldParentPtr *>(inst)); |
| 691 | case IrInstGenIdAlignCast: | 681 | case IrInstGenIdAlignCast: |
| 692 | return destroy(reinterpret_cast<IrInstGenAlignCast *>(inst), name); | 682 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAlignCast *>(inst)); |
| 693 | case IrInstGenIdErrorReturnTrace: | 683 | case IrInstGenIdErrorReturnTrace: |
| 694 | return destroy(reinterpret_cast<IrInstGenErrorReturnTrace *>(inst), name); | 684 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenErrorReturnTrace *>(inst)); |
| 695 | case IrInstGenIdAtomicRmw: | 685 | case IrInstGenIdAtomicRmw: |
| 696 | return destroy(reinterpret_cast<IrInstGenAtomicRmw *>(inst), name); | 686 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAtomicRmw *>(inst)); |
| 697 | case IrInstGenIdSaveErrRetAddr: | 687 | case IrInstGenIdSaveErrRetAddr: |
| 698 | return destroy(reinterpret_cast<IrInstGenSaveErrRetAddr *>(inst), name); | 688 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSaveErrRetAddr *>(inst)); |
| 699 | case IrInstGenIdFloatOp: | 689 | case IrInstGenIdFloatOp: |
| 700 | return destroy(reinterpret_cast<IrInstGenFloatOp *>(inst), name); | 690 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenFloatOp *>(inst)); |
| 701 | case IrInstGenIdMulAdd: | 691 | case IrInstGenIdMulAdd: |
| 702 | return destroy(reinterpret_cast<IrInstGenMulAdd *>(inst), name); | 692 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenMulAdd *>(inst)); |
| 703 | case IrInstGenIdAtomicLoad: | 693 | case IrInstGenIdAtomicLoad: |
| 704 | return destroy(reinterpret_cast<IrInstGenAtomicLoad *>(inst), name); | 694 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAtomicLoad *>(inst)); |
| 705 | case IrInstGenIdAtomicStore: | 695 | case IrInstGenIdAtomicStore: |
| 706 | return destroy(reinterpret_cast<IrInstGenAtomicStore *>(inst), name); | 696 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAtomicStore *>(inst)); |
| 707 | case IrInstGenIdDeclVar: | 697 | case IrInstGenIdDeclVar: |
| 708 | return destroy(reinterpret_cast<IrInstGenDeclVar *>(inst), name); | 698 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenDeclVar *>(inst)); |
| 709 | case IrInstGenIdArrayToVector: | 699 | case IrInstGenIdArrayToVector: |
| 710 | return destroy(reinterpret_cast<IrInstGenArrayToVector *>(inst), name); | 700 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenArrayToVector *>(inst)); |
| 711 | case IrInstGenIdVectorToArray: | 701 | case IrInstGenIdVectorToArray: |
| 712 | return destroy(reinterpret_cast<IrInstGenVectorToArray *>(inst), name); | 702 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenVectorToArray *>(inst)); |
| 713 | case IrInstGenIdPtrOfArrayToSlice: | 703 | case IrInstGenIdPtrOfArrayToSlice: |
| 714 | return destroy(reinterpret_cast<IrInstGenPtrOfArrayToSlice *>(inst), name); | 704 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenPtrOfArrayToSlice *>(inst)); |
| 715 | case IrInstGenIdAssertZero: | 705 | case IrInstGenIdAssertZero: |
| 716 | return destroy(reinterpret_cast<IrInstGenAssertZero *>(inst), name); | 706 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAssertZero *>(inst)); |
| 717 | case IrInstGenIdAssertNonNull: | 707 | case IrInstGenIdAssertNonNull: |
| 718 | return destroy(reinterpret_cast<IrInstGenAssertNonNull *>(inst), name); | 708 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAssertNonNull *>(inst)); |
| 719 | case IrInstGenIdResizeSlice: | 709 | case IrInstGenIdResizeSlice: |
| 720 | return destroy(reinterpret_cast<IrInstGenResizeSlice *>(inst), name); | 710 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenResizeSlice *>(inst)); |
| 721 | case IrInstGenIdAlloca: | 711 | case IrInstGenIdAlloca: |
| 722 | return destroy(reinterpret_cast<IrInstGenAlloca *>(inst), name); | 712 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAlloca *>(inst)); |
| 723 | case IrInstGenIdSuspendBegin: | 713 | case IrInstGenIdSuspendBegin: |
| 724 | return destroy(reinterpret_cast<IrInstGenSuspendBegin *>(inst), name); | 714 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSuspendBegin *>(inst)); |
| 725 | case IrInstGenIdSuspendFinish: | 715 | case IrInstGenIdSuspendFinish: |
| 726 | return destroy(reinterpret_cast<IrInstGenSuspendFinish *>(inst), name); | 716 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSuspendFinish *>(inst)); |
| 727 | case IrInstGenIdResume: | 717 | case IrInstGenIdResume: |
| 728 | return destroy(reinterpret_cast<IrInstGenResume *>(inst), name); | 718 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenResume *>(inst)); |
| 729 | case IrInstGenIdAwait: | 719 | case IrInstGenIdAwait: |
| 730 | return destroy(reinterpret_cast<IrInstGenAwait *>(inst), name); | 720 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAwait *>(inst)); |
| 731 | case IrInstGenIdSpillBegin: | 721 | case IrInstGenIdSpillBegin: |
| 732 | return destroy(reinterpret_cast<IrInstGenSpillBegin *>(inst), name); | 722 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSpillBegin *>(inst)); |
| 733 | case IrInstGenIdSpillEnd: | 723 | case IrInstGenIdSpillEnd: |
| 734 | return destroy(reinterpret_cast<IrInstGenSpillEnd *>(inst), name); | 724 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenSpillEnd *>(inst)); |
| 735 | case IrInstGenIdVectorExtractElem: | 725 | case IrInstGenIdVectorExtractElem: |
| 736 | return destroy(reinterpret_cast<IrInstGenVectorExtractElem *>(inst), name); | 726 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenVectorExtractElem *>(inst)); |
| 737 | case IrInstGenIdBinaryNot: | 727 | case IrInstGenIdBinaryNot: |
| 738 | return destroy(reinterpret_cast<IrInstGenBinaryNot *>(inst), name); | 728 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenBinaryNot *>(inst)); |
| 739 | case IrInstGenIdNegation: | 729 | case IrInstGenIdNegation: |
| 740 | return destroy(reinterpret_cast<IrInstGenNegation *>(inst), name); | 730 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenNegation *>(inst)); |
| 741 | case IrInstGenIdNegationWrapping: | 731 | case IrInstGenIdNegationWrapping: |
| 742 | return destroy(reinterpret_cast<IrInstGenNegationWrapping *>(inst), name); | 732 | return heap::c_allocator.destroy(reinterpret_cast<IrInstGenNegationWrapping *>(inst)); |
| 743 | } | 733 | } |
| 744 | zig_unreachable(); | 734 | zig_unreachable(); |
| 745 | } | 735 | } |
| ... | @@ -760,15 +750,14 @@ static void ira_deref(IrAnalyze *ira) { | ... | @@ -760,15 +750,14 @@ static void ira_deref(IrAnalyze *ira) { |
| 760 | IrInstSrc *pass1_inst = pass1_bb->instruction_list.items[inst_i]; | 750 | IrInstSrc *pass1_inst = pass1_bb->instruction_list.items[inst_i]; |
| 761 | destroy_instruction_src(pass1_inst); | 751 | destroy_instruction_src(pass1_inst); |
| 762 | } | 752 | } |
| 763 | destroy(pass1_bb, "IrBasicBlockSrc"); | 753 | heap::c_allocator.destroy(pass1_bb); |
| 764 | } | 754 | } |
| 765 | ira->old_irb.exec->basic_block_list.deinit(); | 755 | ira->old_irb.exec->basic_block_list.deinit(); |
| 766 | ira->old_irb.exec->tld_list.deinit(); | 756 | ira->old_irb.exec->tld_list.deinit(); |
| 767 | // cannot destroy here because of var->owner_exec | 757 | heap::c_allocator.destroy(ira->old_irb.exec); |
| 768 | //destroy(ira->old_irb.exec, "IrExecutableSrc"); | | |
| 769 | ira->src_implicit_return_type_list.deinit(); | 758 | ira->src_implicit_return_type_list.deinit(); |
| 770 | ira->resume_stack.deinit(); | 759 | ira->resume_stack.deinit(); |
| 771 | destroy(ira, "IrAnalyze"); | 760 | heap::c_allocator.destroy(ira); |
| 772 | } | 761 | } |
| 773 | | 762 | |
| 774 | static ZigValue *const_ptr_pointee_unchecked_no_isf(CodeGen *g, ZigValue *const_val) { | 763 | static ZigValue *const_ptr_pointee_unchecked_no_isf(CodeGen *g, ZigValue *const_val) { |
| ... | @@ -1017,8 +1006,8 @@ static void ir_ref_var(ZigVar *var) { | ... | @@ -1017,8 +1006,8 @@ static void ir_ref_var(ZigVar *var) { |
| 1017 | static void create_result_ptr(CodeGen *codegen, ZigType *expected_type, | 1006 | static void create_result_ptr(CodeGen *codegen, ZigType *expected_type, |
| 1018 | ZigValue **out_result, ZigValue **out_result_ptr) | 1007 | ZigValue **out_result, ZigValue **out_result_ptr) |
| 1019 | { | 1008 | { |
| 1020 | ZigValue *result = create_const_vals(1); | 1009 | ZigValue *result = codegen->pass1_arena->create<ZigValue>(); |
| 1021 | ZigValue *result_ptr = create_const_vals(1); | 1010 | ZigValue *result_ptr = codegen->pass1_arena->create<ZigValue>(); |
| 1022 | result->special = ConstValSpecialUndef; | 1011 | result->special = ConstValSpecialUndef; |
| 1023 | result->type = expected_type; | 1012 | result->type = expected_type; |
| 1024 | result_ptr->special = ConstValSpecialStatic; | 1013 | result_ptr->special = ConstValSpecialStatic; |
| ... | @@ -1050,14 +1039,11 @@ ZigType *ir_analyze_type_expr(IrAnalyze *ira, Scope *scope, AstNode *node) { | ... | @@ -1050,14 +1039,11 @@ ZigType *ir_analyze_type_expr(IrAnalyze *ira, Scope *scope, AstNode *node) { |
| 1050 | assert(result->special != ConstValSpecialRuntime); | 1039 | assert(result->special != ConstValSpecialRuntime); |
| 1051 | ZigType *res_type = result->data.x_type; | 1040 | ZigType *res_type = result->data.x_type; |
| 1052 | | 1041 | |
| 1053 | destroy(result_ptr, "ZigValue"); | | |
| 1054 | destroy(result, "ZigValue"); | | |
| 1055 | | | |
| 1056 | return res_type; | 1042 | return res_type; |
| 1057 | } | 1043 | } |
| 1058 | | 1044 | |
| 1059 | static IrBasicBlockSrc *ir_create_basic_block(IrBuilderSrc *irb, Scope *scope, const char *name_hint) { | 1045 | static IrBasicBlockSrc *ir_create_basic_block(IrBuilderSrc *irb, Scope *scope, const char *name_hint) { |
| 1060 | IrBasicBlockSrc *result = allocate<IrBasicBlockSrc>(1, "IrBasicBlockSrc"); | 1046 | IrBasicBlockSrc *result = heap::c_allocator.create<IrBasicBlockSrc>(); |
| 1061 | result->scope = scope; | 1047 | result->scope = scope; |
| 1062 | result->name_hint = name_hint; | 1048 | result->name_hint = name_hint; |
| 1063 | result->debug_id = exec_next_debug_id(irb->exec); | 1049 | result->debug_id = exec_next_debug_id(irb->exec); |
| ... | @@ -1066,7 +1052,7 @@ static IrBasicBlockSrc *ir_create_basic_block(IrBuilderSrc *irb, Scope *scope, c | ... | @@ -1066,7 +1052,7 @@ static IrBasicBlockSrc *ir_create_basic_block(IrBuilderSrc *irb, Scope *scope, c |
| 1066 | } | 1052 | } |
| 1067 | | 1053 | |
| 1068 | static IrBasicBlockGen *ir_create_basic_block_gen(IrAnalyze *ira, Scope *scope, const char *name_hint) { | 1054 | static IrBasicBlockGen *ir_create_basic_block_gen(IrAnalyze *ira, Scope *scope, const char *name_hint) { |
| 1069 | IrBasicBlockGen *result = allocate<IrBasicBlockGen>(1, "IrBasicBlockGen"); | 1055 | IrBasicBlockGen *result = heap::c_allocator.create<IrBasicBlockGen>(); |
| 1070 | result->scope = scope; | 1056 | result->scope = scope; |
| 1071 | result->name_hint = name_hint; | 1057 | result->name_hint = name_hint; |
| 1072 | result->debug_id = exec_next_debug_id_gen(ira->new_irb.exec); | 1058 | result->debug_id = exec_next_debug_id_gen(ira->new_irb.exec); |
| ... | @@ -1983,12 +1969,7 @@ static constexpr IrInstGenId ir_inst_id(IrInstGenConst *) { | ... | @@ -1983,12 +1969,7 @@ static constexpr IrInstGenId ir_inst_id(IrInstGenConst *) { |
| 1983 | | 1969 | |
| 1984 | template<typename T> | 1970 | template<typename T> |
| 1985 | static T *ir_create_instruction(IrBuilderSrc *irb, Scope *scope, AstNode *source_node) { | 1971 | static T *ir_create_instruction(IrBuilderSrc *irb, Scope *scope, AstNode *source_node) { |
| 1986 | const char *name = nullptr; | 1972 | T *special_instruction = heap::c_allocator.create<T>(); |
| 1987 | #ifdef ZIG_ENABLE_MEM_PROFILE | | |
| 1988 | T *dummy = nullptr; | | |
| 1989 | name = ir_inst_src_type_str(ir_inst_id(dummy)); | | |
| 1990 | #endif | | |
| 1991 | T *special_instruction = allocate<T>(1, name); | | |
| 1992 | special_instruction->base.id = ir_inst_id(special_instruction); | 1973 | special_instruction->base.id = ir_inst_id(special_instruction); |
| 1993 | special_instruction->base.base.scope = scope; | 1974 | special_instruction->base.base.scope = scope; |
| 1994 | special_instruction->base.base.source_node = source_node; | 1975 | special_instruction->base.base.source_node = source_node; |
| ... | @@ -1999,29 +1980,19 @@ static T *ir_create_instruction(IrBuilderSrc *irb, Scope *scope, AstNode *source | ... | @@ -1999,29 +1980,19 @@ static T *ir_create_instruction(IrBuilderSrc *irb, Scope *scope, AstNode *source |
| 1999 | | 1980 | |
| 2000 | template<typename T> | 1981 | template<typename T> |
| 2001 | static T *ir_create_inst_gen(IrBuilderGen *irb, Scope *scope, AstNode *source_node) { | 1982 | static T *ir_create_inst_gen(IrBuilderGen *irb, Scope *scope, AstNode *source_node) { |
| 2002 | const char *name = nullptr; | 1983 | T *special_instruction = heap::c_allocator.create<T>(); |
| 2003 | #ifdef ZIG_ENABLE_MEM_PROFILE | | |
| 2004 | T *dummy = nullptr; | | |
| 2005 | name = ir_inst_gen_type_str(ir_inst_id(dummy)); | | |
| 2006 | #endif | | |
| 2007 | T *special_instruction = allocate<T>(1, name); | | |
| 2008 | special_instruction->base.id = ir_inst_id(special_instruction); | 1984 | special_instruction->base.id = ir_inst_id(special_instruction); |
| 2009 | special_instruction->base.base.scope = scope; | 1985 | special_instruction->base.base.scope = scope; |
| 2010 | special_instruction->base.base.source_node = source_node; | 1986 | special_instruction->base.base.source_node = source_node; |
| 2011 | special_instruction->base.base.debug_id = exec_next_debug_id_gen(irb->exec); | 1987 | special_instruction->base.base.debug_id = exec_next_debug_id_gen(irb->exec); |
| 2012 | special_instruction->base.owner_bb = irb->current_basic_block; | 1988 | special_instruction->base.owner_bb = irb->current_basic_block; |
| 2013 | special_instruction->base.value = allocate<ZigValue>(1, "ZigValue"); | 1989 | special_instruction->base.value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2014 | return special_instruction; | 1990 | return special_instruction; |
| 2015 | } | 1991 | } |
| 2016 | | 1992 | |
| 2017 | template<typename T> | 1993 | template<typename T> |
| 2018 | static T *ir_create_inst_noval(IrBuilderGen *irb, Scope *scope, AstNode *source_node) { | 1994 | static T *ir_create_inst_noval(IrBuilderGen *irb, Scope *scope, AstNode *source_node) { |
| 2019 | const char *name = nullptr; | 1995 | T *special_instruction = heap::c_allocator.create<T>(); |
| 2020 | #ifdef ZIG_ENABLE_MEM_PROFILE | | |
| 2021 | T *dummy = nullptr; | | |
| 2022 | name = ir_inst_gen_type_str(ir_inst_id(dummy)); | | |
| 2023 | #endif | | |
| 2024 | T *special_instruction = allocate<T>(1, name); | | |
| 2025 | special_instruction->base.id = ir_inst_id(special_instruction); | 1996 | special_instruction->base.id = ir_inst_id(special_instruction); |
| 2026 | special_instruction->base.base.scope = scope; | 1997 | special_instruction->base.base.scope = scope; |
| 2027 | special_instruction->base.base.source_node = source_node; | 1998 | special_instruction->base.base.source_node = source_node; |
| ... | @@ -2063,11 +2034,11 @@ static T *ir_build_inst_void(IrBuilderGen *irb, Scope *scope, AstNode *source_no | ... | @@ -2063,11 +2034,11 @@ static T *ir_build_inst_void(IrBuilderGen *irb, Scope *scope, AstNode *source_no |
| 2063 | IrInstGen *ir_create_alloca(CodeGen *g, Scope *scope, AstNode *source_node, ZigFn *fn, | 2034 | IrInstGen *ir_create_alloca(CodeGen *g, Scope *scope, AstNode *source_node, ZigFn *fn, |
| 2064 | ZigType *var_type, const char *name_hint) | 2035 | ZigType *var_type, const char *name_hint) |
| 2065 | { | 2036 | { |
| 2066 | IrInstGenAlloca *alloca_gen = allocate<IrInstGenAlloca>(1); | 2037 | IrInstGenAlloca *alloca_gen = heap::c_allocator.create<IrInstGenAlloca>(); |
| 2067 | alloca_gen->base.id = IrInstGenIdAlloca; | 2038 | alloca_gen->base.id = IrInstGenIdAlloca; |
| 2068 | alloca_gen->base.base.source_node = source_node; | 2039 | alloca_gen->base.base.source_node = source_node; |
| 2069 | alloca_gen->base.base.scope = scope; | 2040 | alloca_gen->base.base.scope = scope; |
| 2070 | alloca_gen->base.value = allocate<ZigValue>(1, "ZigValue"); | 2041 | alloca_gen->base.value = g->pass1_arena->create<ZigValue>(); |
| 2071 | alloca_gen->base.value->type = get_pointer_to_type(g, var_type, false); | 2042 | alloca_gen->base.value->type = get_pointer_to_type(g, var_type, false); |
| 2072 | alloca_gen->base.base.ref_count = 1; | 2043 | alloca_gen->base.base.ref_count = 1; |
| 2073 | alloca_gen->name_hint = name_hint; | 2044 | alloca_gen->name_hint = name_hint; |
| ... | @@ -2157,7 +2128,7 @@ static IrInstSrc *ir_build_const_undefined(IrBuilderSrc *irb, Scope *scope, AstN | ... | @@ -2157,7 +2128,7 @@ static IrInstSrc *ir_build_const_undefined(IrBuilderSrc *irb, Scope *scope, AstN |
| 2157 | | 2128 | |
| 2158 | static IrInstSrc *ir_build_const_uint(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, uint64_t value) { | 2129 | static IrInstSrc *ir_build_const_uint(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, uint64_t value) { |
| 2159 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); | 2130 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2160 | const_instruction->value = create_const_vals(1); | 2131 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2161 | const_instruction->value->type = irb->codegen->builtin_types.entry_num_lit_int; | 2132 | const_instruction->value->type = irb->codegen->builtin_types.entry_num_lit_int; |
| 2162 | const_instruction->value->special = ConstValSpecialStatic; | 2133 | const_instruction->value->special = ConstValSpecialStatic; |
| 2163 | bigint_init_unsigned(&const_instruction->value->data.x_bigint, value); | 2134 | bigint_init_unsigned(&const_instruction->value->data.x_bigint, value); |
| ... | @@ -2166,7 +2137,7 @@ static IrInstSrc *ir_build_const_uint(IrBuilderSrc *irb, Scope *scope, AstNode * | ... | @@ -2166,7 +2137,7 @@ static IrInstSrc *ir_build_const_uint(IrBuilderSrc *irb, Scope *scope, AstNode * |
| 2166 | | 2137 | |
| 2167 | static IrInstSrc *ir_build_const_bigint(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, BigInt *bigint) { | 2138 | static IrInstSrc *ir_build_const_bigint(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, BigInt *bigint) { |
| 2168 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); | 2139 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2169 | const_instruction->value = create_const_vals(1); | 2140 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2170 | const_instruction->value->type = irb->codegen->builtin_types.entry_num_lit_int; | 2141 | const_instruction->value->type = irb->codegen->builtin_types.entry_num_lit_int; |
| 2171 | const_instruction->value->special = ConstValSpecialStatic; | 2142 | const_instruction->value->special = ConstValSpecialStatic; |
| 2172 | bigint_init_bigint(&const_instruction->value->data.x_bigint, bigint); | 2143 | bigint_init_bigint(&const_instruction->value->data.x_bigint, bigint); |
| ... | @@ -2175,7 +2146,7 @@ static IrInstSrc *ir_build_const_bigint(IrBuilderSrc *irb, Scope *scope, AstNode | ... | @@ -2175,7 +2146,7 @@ static IrInstSrc *ir_build_const_bigint(IrBuilderSrc *irb, Scope *scope, AstNode |
| 2175 | | 2146 | |
| 2176 | static IrInstSrc *ir_build_const_bigfloat(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, BigFloat *bigfloat) { | 2147 | static IrInstSrc *ir_build_const_bigfloat(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, BigFloat *bigfloat) { |
| 2177 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); | 2148 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2178 | const_instruction->value = create_const_vals(1); | 2149 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2179 | const_instruction->value->type = irb->codegen->builtin_types.entry_num_lit_float; | 2150 | const_instruction->value->type = irb->codegen->builtin_types.entry_num_lit_float; |
| 2180 | const_instruction->value->special = ConstValSpecialStatic; | 2151 | const_instruction->value->special = ConstValSpecialStatic; |
| 2181 | bigfloat_init_bigfloat(&const_instruction->value->data.x_bigfloat, bigfloat); | 2152 | bigfloat_init_bigfloat(&const_instruction->value->data.x_bigfloat, bigfloat); |
| ... | @@ -2191,7 +2162,7 @@ static IrInstSrc *ir_build_const_null(IrBuilderSrc *irb, Scope *scope, AstNode * | ... | @@ -2191,7 +2162,7 @@ static IrInstSrc *ir_build_const_null(IrBuilderSrc *irb, Scope *scope, AstNode * |
| 2191 | | 2162 | |
| 2192 | static IrInstSrc *ir_build_const_usize(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, uint64_t value) { | 2163 | static IrInstSrc *ir_build_const_usize(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, uint64_t value) { |
| 2193 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); | 2164 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2194 | const_instruction->value = create_const_vals(1); | 2165 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2195 | const_instruction->value->type = irb->codegen->builtin_types.entry_usize; | 2166 | const_instruction->value->type = irb->codegen->builtin_types.entry_usize; |
| 2196 | const_instruction->value->special = ConstValSpecialStatic; | 2167 | const_instruction->value->special = ConstValSpecialStatic; |
| 2197 | bigint_init_unsigned(&const_instruction->value->data.x_bigint, value); | 2168 | bigint_init_unsigned(&const_instruction->value->data.x_bigint, value); |
| ... | @@ -2202,7 +2173,7 @@ static IrInstSrc *ir_create_const_type(IrBuilderSrc *irb, Scope *scope, AstNode | ... | @@ -2202,7 +2173,7 @@ static IrInstSrc *ir_create_const_type(IrBuilderSrc *irb, Scope *scope, AstNode |
| 2202 | ZigType *type_entry) | 2173 | ZigType *type_entry) |
| 2203 | { | 2174 | { |
| 2204 | IrInstSrcConst *const_instruction = ir_create_instruction<IrInstSrcConst>(irb, scope, source_node); | 2175 | IrInstSrcConst *const_instruction = ir_create_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2205 | const_instruction->value = create_const_vals(1); | 2176 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2206 | const_instruction->value->type = irb->codegen->builtin_types.entry_type; | 2177 | const_instruction->value->type = irb->codegen->builtin_types.entry_type; |
| 2207 | const_instruction->value->special = ConstValSpecialStatic; | 2178 | const_instruction->value->special = ConstValSpecialStatic; |
| 2208 | const_instruction->value->data.x_type = type_entry; | 2179 | const_instruction->value->data.x_type = type_entry; |
| ... | @@ -2219,7 +2190,7 @@ static IrInstSrc *ir_build_const_type(IrBuilderSrc *irb, Scope *scope, AstNode * | ... | @@ -2219,7 +2190,7 @@ static IrInstSrc *ir_build_const_type(IrBuilderSrc *irb, Scope *scope, AstNode * |
| 2219 | | 2190 | |
| 2220 | static IrInstSrc *ir_build_const_import(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, ZigType *import) { | 2191 | static IrInstSrc *ir_build_const_import(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, ZigType *import) { |
| 2221 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); | 2192 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2222 | const_instruction->value = create_const_vals(1); | 2193 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2223 | const_instruction->value->type = irb->codegen->builtin_types.entry_type; | 2194 | const_instruction->value->type = irb->codegen->builtin_types.entry_type; |
| 2224 | const_instruction->value->special = ConstValSpecialStatic; | 2195 | const_instruction->value->special = ConstValSpecialStatic; |
| 2225 | const_instruction->value->data.x_type = import; | 2196 | const_instruction->value->data.x_type = import; |
| ... | @@ -2228,7 +2199,7 @@ static IrInstSrc *ir_build_const_import(IrBuilderSrc *irb, Scope *scope, AstNode | ... | @@ -2228,7 +2199,7 @@ static IrInstSrc *ir_build_const_import(IrBuilderSrc *irb, Scope *scope, AstNode |
| 2228 | | 2199 | |
| 2229 | static IrInstSrc *ir_build_const_bool(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, bool value) { | 2200 | static IrInstSrc *ir_build_const_bool(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, bool value) { |
| 2230 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); | 2201 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2231 | const_instruction->value = create_const_vals(1); | 2202 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2232 | const_instruction->value->type = irb->codegen->builtin_types.entry_bool; | 2203 | const_instruction->value->type = irb->codegen->builtin_types.entry_bool; |
| 2233 | const_instruction->value->special = ConstValSpecialStatic; | 2204 | const_instruction->value->special = ConstValSpecialStatic; |
| 2234 | const_instruction->value->data.x_bool = value; | 2205 | const_instruction->value->data.x_bool = value; |
| ... | @@ -2237,7 +2208,7 @@ static IrInstSrc *ir_build_const_bool(IrBuilderSrc *irb, Scope *scope, AstNode * | ... | @@ -2237,7 +2208,7 @@ static IrInstSrc *ir_build_const_bool(IrBuilderSrc *irb, Scope *scope, AstNode * |
| 2237 | | 2208 | |
| 2238 | static IrInstSrc *ir_build_const_enum_literal(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, Buf *name) { | 2209 | static IrInstSrc *ir_build_const_enum_literal(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, Buf *name) { |
| 2239 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); | 2210 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2240 | const_instruction->value = create_const_vals(1); | 2211 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2241 | const_instruction->value->type = irb->codegen->builtin_types.entry_enum_literal; | 2212 | const_instruction->value->type = irb->codegen->builtin_types.entry_enum_literal; |
| 2242 | const_instruction->value->special = ConstValSpecialStatic; | 2213 | const_instruction->value->special = ConstValSpecialStatic; |
| 2243 | const_instruction->value->data.x_enum_literal = name; | 2214 | const_instruction->value->data.x_enum_literal = name; |
| ... | @@ -2246,7 +2217,7 @@ static IrInstSrc *ir_build_const_enum_literal(IrBuilderSrc *irb, Scope *scope, A | ... | @@ -2246,7 +2217,7 @@ static IrInstSrc *ir_build_const_enum_literal(IrBuilderSrc *irb, Scope *scope, A |
| 2246 | | 2217 | |
| 2247 | static IrInstSrc *ir_create_const_str_lit(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, Buf *str) { | 2218 | static IrInstSrc *ir_create_const_str_lit(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, Buf *str) { |
| 2248 | IrInstSrcConst *const_instruction = ir_create_instruction<IrInstSrcConst>(irb, scope, source_node); | 2219 | IrInstSrcConst *const_instruction = ir_create_instruction<IrInstSrcConst>(irb, scope, source_node); |
| 2249 | const_instruction->value = create_const_vals(1); | 2220 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 2250 | init_const_str_lit(irb->codegen, const_instruction->value, str); | 2221 | init_const_str_lit(irb->codegen, const_instruction->value, str); |
| 2251 | | 2222 | |
| 2252 | return &const_instruction->base; | 2223 | return &const_instruction->base; |
| ... | @@ -5244,7 +5215,7 @@ static IrInstSrc *ir_gen_return(IrBuilderSrc *irb, Scope *scope, AstNode *node, | ... | @@ -5244,7 +5215,7 @@ static IrInstSrc *ir_gen_return(IrBuilderSrc *irb, Scope *scope, AstNode *node, |
| 5244 | switch (node->data.return_expr.kind) { | 5215 | switch (node->data.return_expr.kind) { |
| 5245 | case ReturnKindUnconditional: | 5216 | case ReturnKindUnconditional: |
| 5246 | { | 5217 | { |
| 5247 | ResultLocReturn *result_loc_ret = allocate<ResultLocReturn>(1, "ResultLocReturn"); | 5218 | ResultLocReturn *result_loc_ret = heap::c_allocator.create<ResultLocReturn>(); |
| 5248 | result_loc_ret->base.id = ResultLocIdReturn; | 5219 | result_loc_ret->base.id = ResultLocIdReturn; |
| 5249 | ir_build_reset_result(irb, scope, node, &result_loc_ret->base); | 5220 | ir_build_reset_result(irb, scope, node, &result_loc_ret->base); |
| 5250 | | 5221 | |
| ... | @@ -5332,7 +5303,7 @@ static IrInstSrc *ir_gen_return(IrBuilderSrc *irb, Scope *scope, AstNode *node, | ... | @@ -5332,7 +5303,7 @@ static IrInstSrc *ir_gen_return(IrBuilderSrc *irb, Scope *scope, AstNode *node, |
| 5332 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, node, err_val, nullptr)); | 5303 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, node, err_val, nullptr)); |
| 5333 | IrInstSrcSpillBegin *spill_begin = ir_build_spill_begin_src(irb, scope, node, err_val, | 5304 | IrInstSrcSpillBegin *spill_begin = ir_build_spill_begin_src(irb, scope, node, err_val, |
| 5334 | SpillIdRetErrCode); | 5305 | SpillIdRetErrCode); |
| 5335 | ResultLocReturn *result_loc_ret = allocate<ResultLocReturn>(1, "ResultLocReturn"); | 5306 | ResultLocReturn *result_loc_ret = heap::c_allocator.create<ResultLocReturn>(); |
| 5336 | result_loc_ret->base.id = ResultLocIdReturn; | 5307 | result_loc_ret->base.id = ResultLocIdReturn; |
| 5337 | ir_build_reset_result(irb, scope, node, &result_loc_ret->base); | 5308 | ir_build_reset_result(irb, scope, node, &result_loc_ret->base); |
| 5338 | ir_build_end_expr(irb, scope, node, err_val, &result_loc_ret->base); | 5309 | ir_build_end_expr(irb, scope, node, err_val, &result_loc_ret->base); |
| ... | @@ -5360,12 +5331,12 @@ static ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_s | ... | @@ -5360,12 +5331,12 @@ static ZigVar *create_local_var(CodeGen *codegen, AstNode *node, Scope *parent_s |
| 5360 | Buf *name, bool src_is_const, bool gen_is_const, bool is_shadowable, IrInstSrc *is_comptime, | 5331 | Buf *name, bool src_is_const, bool gen_is_const, bool is_shadowable, IrInstSrc *is_comptime, |
| 5361 | bool skip_name_check) | 5332 | bool skip_name_check) |
| 5362 | { | 5333 | { |
| 5363 | ZigVar *variable_entry = allocate<ZigVar>(1, "ZigVar"); | 5334 | ZigVar *variable_entry = heap::c_allocator.create<ZigVar>(); |
| 5364 | variable_entry->parent_scope = parent_scope; | 5335 | variable_entry->parent_scope = parent_scope; |
| 5365 | variable_entry->shadowable = is_shadowable; | 5336 | variable_entry->shadowable = is_shadowable; |
| 5366 | variable_entry->is_comptime = is_comptime; | 5337 | variable_entry->is_comptime = is_comptime; |
| 5367 | variable_entry->src_arg_index = SIZE_MAX; | 5338 | variable_entry->src_arg_index = SIZE_MAX; |
| 5368 | variable_entry->const_value = create_const_vals(1); | 5339 | variable_entry->const_value = codegen->pass1_arena->create<ZigValue>(); |
| 5369 | | 5340 | |
| 5370 | if (is_comptime != nullptr) { | 5341 | if (is_comptime != nullptr) { |
| 5371 | is_comptime->base.ref_count += 1; | 5342 | is_comptime->base.ref_count += 1; |
| ... | @@ -5425,15 +5396,12 @@ static ZigVar *ir_create_var(IrBuilderSrc *irb, AstNode *node, Scope *scope, Buf | ... | @@ -5425,15 +5396,12 @@ static ZigVar *ir_create_var(IrBuilderSrc *irb, AstNode *node, Scope *scope, Buf |
| 5425 | ZigVar *var = create_local_var(irb->codegen, node, scope, | 5396 | ZigVar *var = create_local_var(irb->codegen, node, scope, |
| 5426 | (is_underscored ? nullptr : name), src_is_const, gen_is_const, | 5397 | (is_underscored ? nullptr : name), src_is_const, gen_is_const, |
| 5427 | (is_underscored ? true : is_shadowable), is_comptime, false); | 5398 | (is_underscored ? true : is_shadowable), is_comptime, false); |
| 5428 | if (is_comptime != nullptr || gen_is_const) { | | |
| 5429 | var->owner_exec = irb->exec; | | |
| 5430 | } | | |
| 5431 | assert(var->child_scope); | 5399 | assert(var->child_scope); |
| 5432 | return var; | 5400 | return var; |
| 5433 | } | 5401 | } |
| 5434 | | 5402 | |
| 5435 | static ResultLocPeer *create_peer_result(ResultLocPeerParent *peer_parent) { | 5403 | static ResultLocPeer *create_peer_result(ResultLocPeerParent *peer_parent) { |
| 5436 | ResultLocPeer *result = allocate<ResultLocPeer>(1, "ResultLocPeer"); | 5404 | ResultLocPeer *result = heap::c_allocator.create<ResultLocPeer>(); |
| 5437 | result->base.id = ResultLocIdPeer; | 5405 | result->base.id = ResultLocIdPeer; |
| 5438 | result->base.source_instruction = peer_parent->base.source_instruction; | 5406 | result->base.source_instruction = peer_parent->base.source_instruction; |
| 5439 | result->parent = peer_parent; | 5407 | result->parent = peer_parent; |
| ... | @@ -5472,7 +5440,7 @@ static IrInstSrc *ir_gen_block(IrBuilderSrc *irb, Scope *parent_scope, AstNode * | ... | @@ -5472,7 +5440,7 @@ static IrInstSrc *ir_gen_block(IrBuilderSrc *irb, Scope *parent_scope, AstNode * |
| 5472 | scope_block->is_comptime = ir_build_const_bool(irb, parent_scope, block_node, | 5440 | scope_block->is_comptime = ir_build_const_bool(irb, parent_scope, block_node, |
| 5473 | ir_should_inline(irb->exec, parent_scope)); | 5441 | ir_should_inline(irb->exec, parent_scope)); |
| 5474 | | 5442 | |
| 5475 | scope_block->peer_parent = allocate<ResultLocPeerParent>(1, "ResultLocPeerParent"); | 5443 | scope_block->peer_parent = heap::c_allocator.create<ResultLocPeerParent>(); |
| 5476 | scope_block->peer_parent->base.id = ResultLocIdPeerParent; | 5444 | scope_block->peer_parent->base.id = ResultLocIdPeerParent; |
| 5477 | scope_block->peer_parent->base.source_instruction = scope_block->is_comptime; | 5445 | scope_block->peer_parent->base.source_instruction = scope_block->is_comptime; |
| 5478 | scope_block->peer_parent->base.allow_write_through_const = result_loc->allow_write_through_const; | 5446 | scope_block->peer_parent->base.allow_write_through_const = result_loc->allow_write_through_const; |
| ... | @@ -5562,7 +5530,7 @@ static IrInstSrc *ir_gen_block(IrBuilderSrc *irb, Scope *parent_scope, AstNode * | ... | @@ -5562,7 +5530,7 @@ static IrInstSrc *ir_gen_block(IrBuilderSrc *irb, Scope *parent_scope, AstNode * |
| 5562 | // only generate unconditional defers | 5530 | // only generate unconditional defers |
| 5563 | | 5531 | |
| 5564 | ir_mark_gen(ir_build_add_implicit_return_type(irb, child_scope, block_node, result, nullptr)); | 5532 | ir_mark_gen(ir_build_add_implicit_return_type(irb, child_scope, block_node, result, nullptr)); |
| 5565 | ResultLocReturn *result_loc_ret = allocate<ResultLocReturn>(1, "ResultLocReturn"); | 5533 | ResultLocReturn *result_loc_ret = heap::c_allocator.create<ResultLocReturn>(); |
| 5566 | result_loc_ret->base.id = ResultLocIdReturn; | 5534 | result_loc_ret->base.id = ResultLocIdReturn; |
| 5567 | ir_build_reset_result(irb, parent_scope, block_node, &result_loc_ret->base); | 5535 | ir_build_reset_result(irb, parent_scope, block_node, &result_loc_ret->base); |
| 5568 | ir_mark_gen(ir_build_end_expr(irb, parent_scope, block_node, result, &result_loc_ret->base)); | 5536 | ir_mark_gen(ir_build_end_expr(irb, parent_scope, block_node, result, &result_loc_ret->base)); |
| ... | @@ -5604,7 +5572,7 @@ static IrInstSrc *ir_gen_assign(IrBuilderSrc *irb, Scope *scope, AstNode *node) | ... | @@ -5604,7 +5572,7 @@ static IrInstSrc *ir_gen_assign(IrBuilderSrc *irb, Scope *scope, AstNode *node) |
| 5604 | if (lvalue == irb->codegen->invalid_inst_src) | 5572 | if (lvalue == irb->codegen->invalid_inst_src) |
| 5605 | return irb->codegen->invalid_inst_src; | 5573 | return irb->codegen->invalid_inst_src; |
| 5606 | | 5574 | |
| 5607 | ResultLocInstruction *result_loc_inst = allocate<ResultLocInstruction>(1, "ResultLocInstruction"); | 5575 | ResultLocInstruction *result_loc_inst = heap::c_allocator.create<ResultLocInstruction>(); |
| 5608 | result_loc_inst->base.id = ResultLocIdInstruction; | 5576 | result_loc_inst->base.id = ResultLocIdInstruction; |
| 5609 | result_loc_inst->base.source_instruction = lvalue; | 5577 | result_loc_inst->base.source_instruction = lvalue; |
| 5610 | ir_ref_instruction(lvalue, irb->current_basic_block); | 5578 | ir_ref_instruction(lvalue, irb->current_basic_block); |
| ... | @@ -5676,10 +5644,10 @@ static IrInstSrc *ir_gen_bool_or(IrBuilderSrc *irb, Scope *scope, AstNode *node) | ... | @@ -5676,10 +5644,10 @@ static IrInstSrc *ir_gen_bool_or(IrBuilderSrc *irb, Scope *scope, AstNode *node) |
| 5676 | | 5644 | |
| 5677 | ir_set_cursor_at_end_and_append_block(irb, true_block); | 5645 | ir_set_cursor_at_end_and_append_block(irb, true_block); |
| 5678 | | 5646 | |
| 5679 | IrInstSrc **incoming_values = allocate<IrInstSrc *>(2, "IrInstSrc *"); | 5647 | IrInstSrc **incoming_values = heap::c_allocator.allocate<IrInstSrc *>(2); |
| 5680 | incoming_values[0] = val1; | 5648 | incoming_values[0] = val1; |
| 5681 | incoming_values[1] = val2; | 5649 | incoming_values[1] = val2; |
| 5682 | IrBasicBlockSrc **incoming_blocks = allocate<IrBasicBlockSrc *>(2, "IrBasicBlockSrc *"); | 5650 | IrBasicBlockSrc **incoming_blocks = heap::c_allocator.allocate<IrBasicBlockSrc *>(2); |
| 5683 | incoming_blocks[0] = post_val1_block; | 5651 | incoming_blocks[0] = post_val1_block; |
| 5684 | incoming_blocks[1] = post_val2_block; | 5652 | incoming_blocks[1] = post_val2_block; |
| 5685 | | 5653 | |
| ... | @@ -5718,10 +5686,10 @@ static IrInstSrc *ir_gen_bool_and(IrBuilderSrc *irb, Scope *scope, AstNode *node | ... | @@ -5718,10 +5686,10 @@ static IrInstSrc *ir_gen_bool_and(IrBuilderSrc *irb, Scope *scope, AstNode *node |
| 5718 | | 5686 | |
| 5719 | ir_set_cursor_at_end_and_append_block(irb, false_block); | 5687 | ir_set_cursor_at_end_and_append_block(irb, false_block); |
| 5720 | | 5688 | |
| 5721 | IrInstSrc **incoming_values = allocate<IrInstSrc *>(2); | 5689 | IrInstSrc **incoming_values = heap::c_allocator.allocate<IrInstSrc *>(2); |
| 5722 | incoming_values[0] = val1; | 5690 | incoming_values[0] = val1; |
| 5723 | incoming_values[1] = val2; | 5691 | incoming_values[1] = val2; |
| 5724 | IrBasicBlockSrc **incoming_blocks = allocate<IrBasicBlockSrc *>(2, "IrBasicBlockSrc *"); | 5692 | IrBasicBlockSrc **incoming_blocks = heap::c_allocator.allocate<IrBasicBlockSrc *>(2); |
| 5725 | incoming_blocks[0] = post_val1_block; | 5693 | incoming_blocks[0] = post_val1_block; |
| 5726 | incoming_blocks[1] = post_val2_block; | 5694 | incoming_blocks[1] = post_val2_block; |
| 5727 | | 5695 | |
| ... | @@ -5731,7 +5699,7 @@ static IrInstSrc *ir_gen_bool_and(IrBuilderSrc *irb, Scope *scope, AstNode *node | ... | @@ -5731,7 +5699,7 @@ static IrInstSrc *ir_gen_bool_and(IrBuilderSrc *irb, Scope *scope, AstNode *node |
| 5731 | static ResultLocPeerParent *ir_build_result_peers(IrBuilderSrc *irb, IrInstSrc *cond_br_inst, | 5699 | static ResultLocPeerParent *ir_build_result_peers(IrBuilderSrc *irb, IrInstSrc *cond_br_inst, |
| 5732 | IrBasicBlockSrc *end_block, ResultLoc *parent, IrInstSrc *is_comptime) | 5700 | IrBasicBlockSrc *end_block, ResultLoc *parent, IrInstSrc *is_comptime) |
| 5733 | { | 5701 | { |
| 5734 | ResultLocPeerParent *peer_parent = allocate<ResultLocPeerParent>(1); | 5702 | ResultLocPeerParent *peer_parent = heap::c_allocator.create<ResultLocPeerParent>(); |
| 5735 | peer_parent->base.id = ResultLocIdPeerParent; | 5703 | peer_parent->base.id = ResultLocIdPeerParent; |
| 5736 | peer_parent->base.source_instruction = cond_br_inst; | 5704 | peer_parent->base.source_instruction = cond_br_inst; |
| 5737 | peer_parent->base.allow_write_through_const = parent->allow_write_through_const; | 5705 | peer_parent->base.allow_write_through_const = parent->allow_write_through_const; |
| ... | @@ -5809,10 +5777,10 @@ static IrInstSrc *ir_gen_orelse(IrBuilderSrc *irb, Scope *parent_scope, AstNode | ... | @@ -5809,10 +5777,10 @@ static IrInstSrc *ir_gen_orelse(IrBuilderSrc *irb, Scope *parent_scope, AstNode |
| 5809 | ir_build_br(irb, parent_scope, node, end_block, is_comptime); | 5777 | ir_build_br(irb, parent_scope, node, end_block, is_comptime); |
| 5810 | | 5778 | |
| 5811 | ir_set_cursor_at_end_and_append_block(irb, end_block); | 5779 | ir_set_cursor_at_end_and_append_block(irb, end_block); |
| 5812 | IrInstSrc **incoming_values = allocate<IrInstSrc *>(2); | 5780 | IrInstSrc **incoming_values = heap::c_allocator.allocate<IrInstSrc *>(2); |
| 5813 | incoming_values[0] = null_result; | 5781 | incoming_values[0] = null_result; |
| 5814 | incoming_values[1] = unwrapped_payload; | 5782 | incoming_values[1] = unwrapped_payload; |
| 5815 | IrBasicBlockSrc **incoming_blocks = allocate<IrBasicBlockSrc *>(2, "IrBasicBlockSrc *"); | 5783 | IrBasicBlockSrc **incoming_blocks = heap::c_allocator.allocate<IrBasicBlockSrc *>(2); |
| 5816 | incoming_blocks[0] = after_null_block; | 5784 | incoming_blocks[0] = after_null_block; |
| 5817 | incoming_blocks[1] = after_ok_block; | 5785 | incoming_blocks[1] = after_ok_block; |
| 5818 | IrInstSrc *phi = ir_build_phi(irb, parent_scope, node, 2, incoming_blocks, incoming_values, peer_parent); | 5786 | IrInstSrc *phi = ir_build_phi(irb, parent_scope, node, 2, incoming_blocks, incoming_values, peer_parent); |
| ... | @@ -5966,7 +5934,7 @@ static void populate_invalid_variable_in_scope(CodeGen *g, Scope *scope, AstNode | ... | @@ -5966,7 +5934,7 @@ static void populate_invalid_variable_in_scope(CodeGen *g, Scope *scope, AstNode |
| 5966 | } | 5934 | } |
| 5967 | scope = scope->parent; | 5935 | scope = scope->parent; |
| 5968 | } | 5936 | } |
| 5969 | TldVar *tld_var = allocate<TldVar>(1); | 5937 | TldVar *tld_var = heap::c_allocator.create<TldVar>(); |
| 5970 | init_tld(&tld_var->base, TldIdVar, var_name, VisibModPub, node, &scope_decls->base); | 5938 | init_tld(&tld_var->base, TldIdVar, var_name, VisibModPub, node, &scope_decls->base); |
| 5971 | tld_var->base.resolution = TldResolutionInvalid; | 5939 | tld_var->base.resolution = TldResolutionInvalid; |
| 5972 | tld_var->var = add_variable(g, node, &scope_decls->base, var_name, false, | 5940 | tld_var->var = add_variable(g, node, &scope_decls->base, var_name, false, |
| ... | @@ -5983,7 +5951,7 @@ static IrInstSrc *ir_gen_symbol(IrBuilderSrc *irb, Scope *scope, AstNode *node, | ... | @@ -5983,7 +5951,7 @@ static IrInstSrc *ir_gen_symbol(IrBuilderSrc *irb, Scope *scope, AstNode *node, |
| 5983 | if (buf_eql_str(variable_name, "_")) { | 5951 | if (buf_eql_str(variable_name, "_")) { |
| 5984 | if (lval == LValPtr) { | 5952 | if (lval == LValPtr) { |
| 5985 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, node); | 5953 | IrInstSrcConst *const_instruction = ir_build_instruction<IrInstSrcConst>(irb, scope, node); |
| 5986 | const_instruction->value = create_const_vals(1); | 5954 | const_instruction->value = irb->codegen->pass1_arena->create<ZigValue>(); |
| 5987 | const_instruction->value->type = get_pointer_to_type(irb->codegen, | 5955 | const_instruction->value->type = get_pointer_to_type(irb->codegen, |
| 5988 | irb->codegen->builtin_types.entry_void, false); | 5956 | irb->codegen->builtin_types.entry_void, false); |
| 5989 | const_instruction->value->special = ConstValSpecialStatic; | 5957 | const_instruction->value->special = ConstValSpecialStatic; |
| ... | @@ -6177,7 +6145,7 @@ static IrInstSrc *ir_gen_async_call(IrBuilderSrc *irb, Scope *scope, AstNode *aw | ... | @@ -6177,7 +6145,7 @@ static IrInstSrc *ir_gen_async_call(IrBuilderSrc *irb, Scope *scope, AstNode *aw |
| 6177 | return fn_ref; | 6145 | return fn_ref; |
| 6178 | | 6146 | |
| 6179 | size_t arg_count = call_node->data.fn_call_expr.params.length - arg_offset; | 6147 | size_t arg_count = call_node->data.fn_call_expr.params.length - arg_offset; |
| 6180 | IrInstSrc **args = allocate<IrInstSrc*>(arg_count); | 6148 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(arg_count); |
| 6181 | for (size_t i = 0; i < arg_count; i += 1) { | 6149 | for (size_t i = 0; i < arg_count; i += 1) { |
| 6182 | AstNode *arg_node = call_node->data.fn_call_expr.params.at(i + arg_offset); | 6150 | AstNode *arg_node = call_node->data.fn_call_expr.params.at(i + arg_offset); |
| 6183 | IrInstSrc *arg = ir_gen_node(irb, arg_node, scope); | 6151 | IrInstSrc *arg = ir_gen_node(irb, arg_node, scope); |
| ... | @@ -6203,7 +6171,7 @@ static IrInstSrc *ir_gen_fn_call_with_args(IrBuilderSrc *irb, Scope *scope, AstN | ... | @@ -6203,7 +6171,7 @@ static IrInstSrc *ir_gen_fn_call_with_args(IrBuilderSrc *irb, Scope *scope, AstN |
| 6203 | | 6171 | |
| 6204 | IrInstSrc *fn_type = ir_build_typeof(irb, scope, source_node, fn_ref); | 6172 | IrInstSrc *fn_type = ir_build_typeof(irb, scope, source_node, fn_ref); |
| 6205 | | 6173 | |
| 6206 | IrInstSrc **args = allocate<IrInstSrc*>(args_len); | 6174 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(args_len); |
| 6207 | for (size_t i = 0; i < args_len; i += 1) { | 6175 | for (size_t i = 0; i < args_len; i += 1) { |
| 6208 | AstNode *arg_node = args_ptr[i]; | 6176 | AstNode *arg_node = args_ptr[i]; |
| 6209 | | 6177 | |
| ... | @@ -6388,7 +6356,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod | ... | @@ -6388,7 +6356,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod |
| 6388 | } | 6356 | } |
| 6389 | case BuiltinFnIdCompileLog: | 6357 | case BuiltinFnIdCompileLog: |
| 6390 | { | 6358 | { |
| 6391 | IrInstSrc **args = allocate<IrInstSrc*>(actual_param_count); | 6359 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(actual_param_count); |
| 6392 | | 6360 | |
| 6393 | for (size_t i = 0; i < actual_param_count; i += 1) { | 6361 | for (size_t i = 0; i < actual_param_count; i += 1) { |
| 6394 | AstNode *arg_node = node->data.fn_call_expr.params.at(i); | 6362 | AstNode *arg_node = node->data.fn_call_expr.params.at(i); |
| ... | @@ -7013,7 +6981,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod | ... | @@ -7013,7 +6981,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod |
| 7013 | if (dest_type == irb->codegen->invalid_inst_src) | 6981 | if (dest_type == irb->codegen->invalid_inst_src) |
| 7014 | return dest_type; | 6982 | return dest_type; |
| 7015 | | 6983 | |
| 7016 | ResultLocBitCast *result_loc_bit_cast = allocate<ResultLocBitCast>(1); | 6984 | ResultLocBitCast *result_loc_bit_cast = heap::c_allocator.create<ResultLocBitCast>(); |
| 7017 | result_loc_bit_cast->base.id = ResultLocIdBitCast; | 6985 | result_loc_bit_cast->base.id = ResultLocIdBitCast; |
| 7018 | result_loc_bit_cast->base.source_instruction = dest_type; | 6986 | result_loc_bit_cast->base.source_instruction = dest_type; |
| 7019 | result_loc_bit_cast->base.allow_write_through_const = result_loc->allow_write_through_const; | 6987 | result_loc_bit_cast->base.allow_write_through_const = result_loc->allow_write_through_const; |
| ... | @@ -7166,7 +7134,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod | ... | @@ -7166,7 +7134,7 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod |
| 7166 | | 7134 | |
| 7167 | size_t arg_count = node->data.fn_call_expr.params.length - 2; | 7135 | size_t arg_count = node->data.fn_call_expr.params.length - 2; |
| 7168 | | 7136 | |
| 7169 | IrInstSrc **args = allocate<IrInstSrc*>(arg_count); | 7137 | IrInstSrc **args = heap::c_allocator.allocate<IrInstSrc*>(arg_count); |
| 7170 | for (size_t i = 0; i < arg_count; i += 1) { | 7138 | for (size_t i = 0; i < arg_count; i += 1) { |
| 7171 | AstNode *arg_node = node->data.fn_call_expr.params.at(i + 2); | 7139 | AstNode *arg_node = node->data.fn_call_expr.params.at(i + 2); |
| 7172 | args[i] = ir_gen_node(irb, arg_node, scope); | 7140 | args[i] = ir_gen_node(irb, arg_node, scope); |
| ... | @@ -7595,10 +7563,10 @@ static IrInstSrc *ir_gen_if_bool_expr(IrBuilderSrc *irb, Scope *scope, AstNode * | ... | @@ -7595,10 +7563,10 @@ static IrInstSrc *ir_gen_if_bool_expr(IrBuilderSrc *irb, Scope *scope, AstNode * |
| 7595 | ir_mark_gen(ir_build_br(irb, scope, node, endif_block, is_comptime)); | 7563 | ir_mark_gen(ir_build_br(irb, scope, node, endif_block, is_comptime)); |
| 7596 | | 7564 | |
| 7597 | ir_set_cursor_at_end_and_append_block(irb, endif_block); | 7565 | ir_set_cursor_at_end_and_append_block(irb, endif_block); |
| 7598 | IrInstSrc **incoming_values = allocate<IrInstSrc *>(2); | 7566 | IrInstSrc **incoming_values = heap::c_allocator.allocate<IrInstSrc *>(2); |
| 7599 | incoming_values[0] = then_expr_result; | 7567 | incoming_values[0] = then_expr_result; |
| 7600 | incoming_values[1] = else_expr_result; | 7568 | incoming_values[1] = else_expr_result; |
| 7601 | IrBasicBlockSrc **incoming_blocks = allocate<IrBasicBlockSrc *>(2, "IrBasicBlockSrc *"); | 7569 | IrBasicBlockSrc **incoming_blocks = heap::c_allocator.allocate<IrBasicBlockSrc *>(2); |
| 7602 | incoming_blocks[0] = after_then_block; | 7570 | incoming_blocks[0] = after_then_block; |
| 7603 | incoming_blocks[1] = after_else_block; | 7571 | incoming_blocks[1] = after_else_block; |
| 7604 | | 7572 | |
| ... | @@ -7799,7 +7767,7 @@ static IrInstSrc *ir_gen_union_init_expr(IrBuilderSrc *irb, Scope *scope, AstNod | ... | @@ -7799,7 +7767,7 @@ static IrInstSrc *ir_gen_union_init_expr(IrBuilderSrc *irb, Scope *scope, AstNod |
| 7799 | IrInstSrc *field_ptr = ir_build_field_ptr_instruction(irb, scope, source_node, container_ptr, | 7767 | IrInstSrc *field_ptr = ir_build_field_ptr_instruction(irb, scope, source_node, container_ptr, |
| 7800 | field_name, true); | 7768 | field_name, true); |
| 7801 | | 7769 | |
| 7802 | ResultLocInstruction *result_loc_inst = allocate<ResultLocInstruction>(1); | 7770 | ResultLocInstruction *result_loc_inst = heap::c_allocator.create<ResultLocInstruction>(); |
| 7803 | result_loc_inst->base.id = ResultLocIdInstruction; | 7771 | result_loc_inst->base.id = ResultLocIdInstruction; |
| 7804 | result_loc_inst->base.source_instruction = field_ptr; | 7772 | result_loc_inst->base.source_instruction = field_ptr; |
| 7805 | ir_ref_instruction(field_ptr, irb->current_basic_block); | 7773 | ir_ref_instruction(field_ptr, irb->current_basic_block); |
| ... | @@ -7875,7 +7843,7 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As | ... | @@ -7875,7 +7843,7 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As |
| 7875 | nullptr); | 7843 | nullptr); |
| 7876 | | 7844 | |
| 7877 | size_t field_count = container_init_expr->entries.length; | 7845 | size_t field_count = container_init_expr->entries.length; |
| 7878 | IrInstSrcContainerInitFieldsField *fields = allocate<IrInstSrcContainerInitFieldsField>(field_count); | 7846 | IrInstSrcContainerInitFieldsField *fields = heap::c_allocator.allocate<IrInstSrcContainerInitFieldsField>(field_count); |
| 7879 | for (size_t i = 0; i < field_count; i += 1) { | 7847 | for (size_t i = 0; i < field_count; i += 1) { |
| 7880 | AstNode *entry_node = container_init_expr->entries.at(i); | 7848 | AstNode *entry_node = container_init_expr->entries.at(i); |
| 7881 | assert(entry_node->type == NodeTypeStructValueField); | 7849 | assert(entry_node->type == NodeTypeStructValueField); |
| ... | @@ -7884,7 +7852,7 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As | ... | @@ -7884,7 +7852,7 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As |
| 7884 | AstNode *expr_node = entry_node->data.struct_val_field.expr; | 7852 | AstNode *expr_node = entry_node->data.struct_val_field.expr; |
| 7885 | | 7853 | |
| 7886 | IrInstSrc *field_ptr = ir_build_field_ptr(irb, scope, entry_node, container_ptr, name, true); | 7854 | IrInstSrc *field_ptr = ir_build_field_ptr(irb, scope, entry_node, container_ptr, name, true); |
| 7887 | ResultLocInstruction *result_loc_inst = allocate<ResultLocInstruction>(1); | 7855 | ResultLocInstruction *result_loc_inst = heap::c_allocator.create<ResultLocInstruction>(); |
| 7888 | result_loc_inst->base.id = ResultLocIdInstruction; | 7856 | result_loc_inst->base.id = ResultLocIdInstruction; |
| 7889 | result_loc_inst->base.source_instruction = field_ptr; | 7857 | result_loc_inst->base.source_instruction = field_ptr; |
| 7890 | result_loc_inst->base.allow_write_through_const = true; | 7858 | result_loc_inst->base.allow_write_through_const = true; |
| ... | @@ -7914,14 +7882,14 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As | ... | @@ -7914,14 +7882,14 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As |
| 7914 | IrInstSrc *container_ptr = ir_build_resolve_result(irb, scope, node, child_result_loc, | 7882 | IrInstSrc *container_ptr = ir_build_resolve_result(irb, scope, node, child_result_loc, |
| 7915 | nullptr); | 7883 | nullptr); |
| 7916 | | 7884 | |
| 7917 | IrInstSrc **result_locs = allocate<IrInstSrc *>(item_count); | 7885 | IrInstSrc **result_locs = heap::c_allocator.allocate<IrInstSrc *>(item_count); |
| 7918 | for (size_t i = 0; i < item_count; i += 1) { | 7886 | for (size_t i = 0; i < item_count; i += 1) { |
| 7919 | AstNode *expr_node = container_init_expr->entries.at(i); | 7887 | AstNode *expr_node = container_init_expr->entries.at(i); |
| 7920 | | 7888 | |
| 7921 | IrInstSrc *elem_index = ir_build_const_usize(irb, scope, expr_node, i); | 7889 | IrInstSrc *elem_index = ir_build_const_usize(irb, scope, expr_node, i); |
| 7922 | IrInstSrc *elem_ptr = ir_build_elem_ptr(irb, scope, expr_node, container_ptr, | 7890 | IrInstSrc *elem_ptr = ir_build_elem_ptr(irb, scope, expr_node, container_ptr, |
| 7923 | elem_index, false, PtrLenSingle, init_array_type_source_node); | 7891 | elem_index, false, PtrLenSingle, init_array_type_source_node); |
| 7924 | ResultLocInstruction *result_loc_inst = allocate<ResultLocInstruction>(1); | 7892 | ResultLocInstruction *result_loc_inst = heap::c_allocator.create<ResultLocInstruction>(); |
| 7925 | result_loc_inst->base.id = ResultLocIdInstruction; | 7893 | result_loc_inst->base.id = ResultLocIdInstruction; |
| 7926 | result_loc_inst->base.source_instruction = elem_ptr; | 7894 | result_loc_inst->base.source_instruction = elem_ptr; |
| 7927 | result_loc_inst->base.allow_write_through_const = true; | 7895 | result_loc_inst->base.allow_write_through_const = true; |
| ... | @@ -7947,7 +7915,7 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As | ... | @@ -7947,7 +7915,7 @@ static IrInstSrc *ir_gen_container_init_expr(IrBuilderSrc *irb, Scope *scope, As |
| 7947 | } | 7915 | } |
| 7948 | | 7916 | |
| 7949 | static ResultLocVar *ir_build_var_result_loc(IrBuilderSrc *irb, IrInstSrc *alloca, ZigVar *var) { | 7917 | static ResultLocVar *ir_build_var_result_loc(IrBuilderSrc *irb, IrInstSrc *alloca, ZigVar *var) { |
| 7950 | ResultLocVar *result_loc_var = allocate<ResultLocVar>(1); | 7918 | ResultLocVar *result_loc_var = heap::c_allocator.create<ResultLocVar>(); |
| 7951 | result_loc_var->base.id = ResultLocIdVar; | 7919 | result_loc_var->base.id = ResultLocIdVar; |
| 7952 | result_loc_var->base.source_instruction = alloca; | 7920 | result_loc_var->base.source_instruction = alloca; |
| 7953 | result_loc_var->base.allow_write_through_const = true; | 7921 | result_loc_var->base.allow_write_through_const = true; |
| ... | @@ -7961,7 +7929,7 @@ static ResultLocVar *ir_build_var_result_loc(IrBuilderSrc *irb, IrInstSrc *alloc | ... | @@ -7961,7 +7929,7 @@ static ResultLocVar *ir_build_var_result_loc(IrBuilderSrc *irb, IrInstSrc *alloc |
| 7961 | static ResultLocCast *ir_build_cast_result_loc(IrBuilderSrc *irb, IrInstSrc *dest_type, | 7929 | static ResultLocCast *ir_build_cast_result_loc(IrBuilderSrc *irb, IrInstSrc *dest_type, |
| 7962 | ResultLoc *parent_result_loc) | 7930 | ResultLoc *parent_result_loc) |
| 7963 | { | 7931 | { |
| 7964 | ResultLocCast *result_loc_cast = allocate<ResultLocCast>(1); | 7932 | ResultLocCast *result_loc_cast = heap::c_allocator.create<ResultLocCast>(); |
| 7965 | result_loc_cast->base.id = ResultLocIdCast; | 7933 | result_loc_cast->base.id = ResultLocIdCast; |
| 7966 | result_loc_cast->base.source_instruction = dest_type; | 7934 | result_loc_cast->base.source_instruction = dest_type; |
| 7967 | result_loc_cast->base.allow_write_through_const = parent_result_loc->allow_write_through_const; | 7935 | result_loc_cast->base.allow_write_through_const = parent_result_loc->allow_write_through_const; |
| ... | @@ -8804,9 +8772,9 @@ static IrInstSrc *ir_gen_asm_expr(IrBuilderSrc *irb, Scope *scope, AstNode *node | ... | @@ -8804,9 +8772,9 @@ static IrInstSrc *ir_gen_asm_expr(IrBuilderSrc *irb, Scope *scope, AstNode *node |
| 8804 | nullptr, 0, is_volatile, true); | 8772 | nullptr, 0, is_volatile, true); |
| 8805 | } | 8773 | } |
| 8806 | | 8774 | |
| 8807 | IrInstSrc **input_list = allocate<IrInstSrc *>(asm_expr->input_list.length); | 8775 | IrInstSrc **input_list = heap::c_allocator.allocate<IrInstSrc *>(asm_expr->input_list.length); |
| 8808 | IrInstSrc **output_types = allocate<IrInstSrc *>(asm_expr->output_list.length); | 8776 | IrInstSrc **output_types = heap::c_allocator.allocate<IrInstSrc *>(asm_expr->output_list.length); |
| 8809 | ZigVar **output_vars = allocate<ZigVar *>(asm_expr->output_list.length); | 8777 | ZigVar **output_vars = heap::c_allocator.allocate<ZigVar *>(asm_expr->output_list.length); |
| 8810 | size_t return_count = 0; | 8778 | size_t return_count = 0; |
| 8811 | if (!is_volatile && asm_expr->output_list.length == 0) { | 8779 | if (!is_volatile && asm_expr->output_list.length == 0) { |
| 8812 | add_node_error(irb->codegen, node, | 8780 | add_node_error(irb->codegen, node, |
| ... | @@ -8940,10 +8908,10 @@ static IrInstSrc *ir_gen_if_optional_expr(IrBuilderSrc *irb, Scope *scope, AstNo | ... | @@ -8940,10 +8908,10 @@ static IrInstSrc *ir_gen_if_optional_expr(IrBuilderSrc *irb, Scope *scope, AstNo |
| 8940 | ir_mark_gen(ir_build_br(irb, scope, node, endif_block, is_comptime)); | 8908 | ir_mark_gen(ir_build_br(irb, scope, node, endif_block, is_comptime)); |
| 8941 | | 8909 | |
| 8942 | ir_set_cursor_at_end_and_append_block(irb, endif_block); | 8910 | ir_set_cursor_at_end_and_append_block(irb, endif_block); |
| 8943 | IrInstSrc **incoming_values = allocate<IrInstSrc *>(2); | 8911 | IrInstSrc **incoming_values = heap::c_allocator.allocate<IrInstSrc *>(2); |
| 8944 | incoming_values[0] = then_expr_result; | 8912 | incoming_values[0] = then_expr_result; |
| 8945 | incoming_values[1] = else_expr_result; | 8913 | incoming_values[1] = else_expr_result; |
| 8946 | IrBasicBlockSrc **incoming_blocks = allocate<IrBasicBlockSrc *>(2, "IrBasicBlockSrc *"); | 8914 | IrBasicBlockSrc **incoming_blocks = heap::c_allocator.allocate<IrBasicBlockSrc *>(2); |
| 8947 | incoming_blocks[0] = after_then_block; | 8915 | incoming_blocks[0] = after_then_block; |
| 8948 | incoming_blocks[1] = after_else_block; | 8916 | incoming_blocks[1] = after_else_block; |
| 8949 | | 8917 | |
| ... | @@ -9037,10 +9005,10 @@ static IrInstSrc *ir_gen_if_err_expr(IrBuilderSrc *irb, Scope *scope, AstNode *n | ... | @@ -9037,10 +9005,10 @@ static IrInstSrc *ir_gen_if_err_expr(IrBuilderSrc *irb, Scope *scope, AstNode *n |
| 9037 | ir_mark_gen(ir_build_br(irb, scope, node, endif_block, is_comptime)); | 9005 | ir_mark_gen(ir_build_br(irb, scope, node, endif_block, is_comptime)); |
| 9038 | | 9006 | |
| 9039 | ir_set_cursor_at_end_and_append_block(irb, endif_block); | 9007 | ir_set_cursor_at_end_and_append_block(irb, endif_block); |
| 9040 | IrInstSrc **incoming_values = allocate<IrInstSrc *>(2); | 9008 | IrInstSrc **incoming_values = heap::c_allocator.allocate<IrInstSrc *>(2); |
| 9041 | incoming_values[0] = then_expr_result; | 9009 | incoming_values[0] = then_expr_result; |
| 9042 | incoming_values[1] = else_expr_result; | 9010 | incoming_values[1] = else_expr_result; |
| 9043 | IrBasicBlockSrc **incoming_blocks = allocate<IrBasicBlockSrc *>(2, "IrBasicBlockSrc *"); | 9011 | IrBasicBlockSrc **incoming_blocks = heap::c_allocator.allocate<IrBasicBlockSrc *>(2); |
| 9044 | incoming_blocks[0] = after_then_block; | 9012 | incoming_blocks[0] = after_then_block; |
| 9045 | incoming_blocks[1] = after_else_block; | 9013 | incoming_blocks[1] = after_else_block; |
| 9046 | | 9014 | |
| ... | @@ -9133,7 +9101,7 @@ static IrInstSrc *ir_gen_switch_expr(IrBuilderSrc *irb, Scope *scope, AstNode *n | ... | @@ -9133,7 +9101,7 @@ static IrInstSrc *ir_gen_switch_expr(IrBuilderSrc *irb, Scope *scope, AstNode *n |
| 9133 | | 9101 | |
| 9134 | IrInstSrcSwitchElseVar *switch_else_var = nullptr; | 9102 | IrInstSrcSwitchElseVar *switch_else_var = nullptr; |
| 9135 | | 9103 | |
| 9136 | ResultLocPeerParent *peer_parent = allocate<ResultLocPeerParent>(1); | 9104 | ResultLocPeerParent *peer_parent = heap::c_allocator.create<ResultLocPeerParent>(); |
| 9137 | peer_parent->base.id = ResultLocIdPeerParent; | 9105 | peer_parent->base.id = ResultLocIdPeerParent; |
| 9138 | peer_parent->base.allow_write_through_const = result_loc->allow_write_through_const; | 9106 | peer_parent->base.allow_write_through_const = result_loc->allow_write_through_const; |
| 9139 | peer_parent->end_bb = end_block; | 9107 | peer_parent->end_bb = end_block; |
| ... | @@ -9295,7 +9263,7 @@ static IrInstSrc *ir_gen_switch_expr(IrBuilderSrc *irb, Scope *scope, AstNode *n | ... | @@ -9295,7 +9263,7 @@ static IrInstSrc *ir_gen_switch_expr(IrBuilderSrc *irb, Scope *scope, AstNode *n |
| 9295 | ResultLocPeer *this_peer_result_loc = create_peer_result(peer_parent); | 9263 | ResultLocPeer *this_peer_result_loc = create_peer_result(peer_parent); |
| 9296 | | 9264 | |
| 9297 | IrBasicBlockSrc *prong_block = ir_create_basic_block(irb, scope, "SwitchProng"); | 9265 | IrBasicBlockSrc *prong_block = ir_create_basic_block(irb, scope, "SwitchProng"); |
| 9298 | IrInstSrc **items = allocate<IrInstSrc *>(prong_item_count); | 9266 | IrInstSrc **items = heap::c_allocator.allocate<IrInstSrc *>(prong_item_count); |
| 9299 | | 9267 | |
| 9300 | for (size_t item_i = 0; item_i < prong_item_count; item_i += 1) { | 9268 | for (size_t item_i = 0; item_i < prong_item_count; item_i += 1) { |
| 9301 | AstNode *item_node = prong_node->data.switch_prong.items.at(item_i); | 9269 | AstNode *item_node = prong_node->data.switch_prong.items.at(item_i); |
| ... | @@ -9677,10 +9645,10 @@ static IrInstSrc *ir_gen_catch(IrBuilderSrc *irb, Scope *parent_scope, AstNode * | ... | @@ -9677,10 +9645,10 @@ static IrInstSrc *ir_gen_catch(IrBuilderSrc *irb, Scope *parent_scope, AstNode * |
| 9677 | ir_build_br(irb, parent_scope, node, end_block, is_comptime); | 9645 | ir_build_br(irb, parent_scope, node, end_block, is_comptime); |
| 9678 | | 9646 | |
| 9679 | ir_set_cursor_at_end_and_append_block(irb, end_block); | 9647 | ir_set_cursor_at_end_and_append_block(irb, end_block); |
| 9680 | IrInstSrc **incoming_values = allocate<IrInstSrc *>(2); | 9648 | IrInstSrc **incoming_values = heap::c_allocator.allocate<IrInstSrc *>(2); |
| 9681 | incoming_values[0] = err_result; | 9649 | incoming_values[0] = err_result; |
| 9682 | incoming_values[1] = unwrapped_payload; | 9650 | incoming_values[1] = unwrapped_payload; |
| 9683 | IrBasicBlockSrc **incoming_blocks = allocate<IrBasicBlockSrc *>(2, "IrBasicBlockSrc *"); | 9651 | IrBasicBlockSrc **incoming_blocks = heap::c_allocator.allocate<IrBasicBlockSrc *>(2); |
| 9684 | incoming_blocks[0] = after_err_block; | 9652 | incoming_blocks[0] = after_err_block; |
| 9685 | incoming_blocks[1] = after_ok_block; | 9653 | incoming_blocks[1] = after_ok_block; |
| 9686 | IrInstSrc *phi = ir_build_phi(irb, parent_scope, node, 2, incoming_blocks, incoming_values, peer_parent); | 9654 | IrInstSrc *phi = ir_build_phi(irb, parent_scope, node, 2, incoming_blocks, incoming_values, peer_parent); |
| ... | @@ -9747,7 +9715,7 @@ static IrInstSrc *ir_gen_container_decl(IrBuilderSrc *irb, Scope *parent_scope, | ... | @@ -9747,7 +9715,7 @@ static IrInstSrc *ir_gen_container_decl(IrBuilderSrc *irb, Scope *parent_scope, |
| 9747 | scan_decls(irb->codegen, child_scope, child_node); | 9715 | scan_decls(irb->codegen, child_scope, child_node); |
| 9748 | } | 9716 | } |
| 9749 | | 9717 | |
| 9750 | TldContainer *tld_container = allocate<TldContainer>(1); | 9718 | TldContainer *tld_container = heap::c_allocator.create<TldContainer>(); |
| 9751 | init_tld(&tld_container->base, TldIdContainer, bare_name, VisibModPub, node, parent_scope); | 9719 | init_tld(&tld_container->base, TldIdContainer, bare_name, VisibModPub, node, parent_scope); |
| 9752 | tld_container->type_entry = container_type; | 9720 | tld_container->type_entry = container_type; |
| 9753 | tld_container->decls_scope = child_scope; | 9721 | tld_container->decls_scope = child_scope; |
| ... | @@ -9790,7 +9758,7 @@ static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigTyp | ... | @@ -9790,7 +9758,7 @@ static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigTyp |
| 9790 | } | 9758 | } |
| 9791 | | 9759 | |
| 9792 | err_set_type->data.error_set.err_count = count; | 9760 | err_set_type->data.error_set.err_count = count; |
| 9793 | err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(count); | 9761 | err_set_type->data.error_set.errors = heap::c_allocator.allocate<ErrorTableEntry *>(count); |
| 9794 | | 9762 | |
| 9795 | bool need_comma = false; | 9763 | bool need_comma = false; |
| 9796 | for (uint32_t i = 0; i < set1->data.error_set.err_count; i += 1) { | 9764 | for (uint32_t i = 0; i < set1->data.error_set.err_count; i += 1) { |
| ... | @@ -9837,7 +9805,7 @@ static ZigType *make_err_set_with_one_item(CodeGen *g, Scope *parent_scope, AstN | ... | @@ -9837,7 +9805,7 @@ static ZigType *make_err_set_with_one_item(CodeGen *g, Scope *parent_scope, AstN |
| 9837 | err_set_type->abi_align = g->builtin_types.entry_global_error_set->abi_align; | 9805 | err_set_type->abi_align = g->builtin_types.entry_global_error_set->abi_align; |
| 9838 | err_set_type->abi_size = g->builtin_types.entry_global_error_set->abi_size; | 9806 | err_set_type->abi_size = g->builtin_types.entry_global_error_set->abi_size; |
| 9839 | err_set_type->data.error_set.err_count = 1; | 9807 | err_set_type->data.error_set.err_count = 1; |
| 9840 | err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(1); | 9808 | err_set_type->data.error_set.errors = heap::c_allocator.create<ErrorTableEntry *>(); |
| 9841 | | 9809 | |
| 9842 | err_set_type->data.error_set.errors[0] = err_entry; | 9810 | err_set_type->data.error_set.errors[0] = err_entry; |
| 9843 | | 9811 | |
| ... | @@ -9868,16 +9836,16 @@ static IrInstSrc *ir_gen_err_set_decl(IrBuilderSrc *irb, Scope *parent_scope, As | ... | @@ -9868,16 +9836,16 @@ static IrInstSrc *ir_gen_err_set_decl(IrBuilderSrc *irb, Scope *parent_scope, As |
| 9868 | err_set_type->size_in_bits = irb->codegen->builtin_types.entry_global_error_set->size_in_bits; | 9836 | err_set_type->size_in_bits = irb->codegen->builtin_types.entry_global_error_set->size_in_bits; |
| 9869 | err_set_type->abi_align = irb->codegen->builtin_types.entry_global_error_set->abi_align; | 9837 | err_set_type->abi_align = irb->codegen->builtin_types.entry_global_error_set->abi_align; |
| 9870 | err_set_type->abi_size = irb->codegen->builtin_types.entry_global_error_set->abi_size; | 9838 | err_set_type->abi_size = irb->codegen->builtin_types.entry_global_error_set->abi_size; |
| 9871 | err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(err_count); | 9839 | err_set_type->data.error_set.errors = heap::c_allocator.allocate<ErrorTableEntry *>(err_count); |
| 9872 | | 9840 | |
| 9873 | size_t errors_count = irb->codegen->errors_by_index.length + err_count; | 9841 | size_t errors_count = irb->codegen->errors_by_index.length + err_count; |
| 9874 | ErrorTableEntry **errors = allocate<ErrorTableEntry *>(errors_count, "ErrorTableEntry *"); | 9842 | ErrorTableEntry **errors = heap::c_allocator.allocate<ErrorTableEntry *>(errors_count); |
| 9875 | | 9843 | |
| 9876 | for (uint32_t i = 0; i < err_count; i += 1) { | 9844 | for (uint32_t i = 0; i < err_count; i += 1) { |
| 9877 | AstNode *field_node = node->data.err_set_decl.decls.at(i); | 9845 | AstNode *field_node = node->data.err_set_decl.decls.at(i); |
| 9878 | AstNode *symbol_node = ast_field_to_symbol_node(field_node); | 9846 | AstNode *symbol_node = ast_field_to_symbol_node(field_node); |
| 9879 | Buf *err_name = symbol_node->data.symbol_expr.symbol; | 9847 | Buf *err_name = symbol_node->data.symbol_expr.symbol; |
| 9880 | ErrorTableEntry *err = allocate<ErrorTableEntry>(1); | 9848 | ErrorTableEntry *err = heap::c_allocator.create<ErrorTableEntry>(); |
| 9881 | err->decl_node = field_node; | 9849 | err->decl_node = field_node; |
| 9882 | buf_init_from_buf(&err->name, err_name); | 9850 | buf_init_from_buf(&err->name, err_name); |
| 9883 | | 9851 | |
| ... | @@ -9902,7 +9870,7 @@ static IrInstSrc *ir_gen_err_set_decl(IrBuilderSrc *irb, Scope *parent_scope, As | ... | @@ -9902,7 +9870,7 @@ static IrInstSrc *ir_gen_err_set_decl(IrBuilderSrc *irb, Scope *parent_scope, As |
| 9902 | } | 9870 | } |
| 9903 | errors[err->value] = err; | 9871 | errors[err->value] = err; |
| 9904 | } | 9872 | } |
| 9905 | deallocate(errors, errors_count, "ErrorTableEntry *"); | 9873 | heap::c_allocator.deallocate(errors, errors_count); |
| 9906 | return ir_build_const_type(irb, parent_scope, node, err_set_type); | 9874 | return ir_build_const_type(irb, parent_scope, node, err_set_type); |
| 9907 | } | 9875 | } |
| 9908 | | 9876 | |
| ... | @@ -9910,7 +9878,7 @@ static IrInstSrc *ir_gen_fn_proto(IrBuilderSrc *irb, Scope *parent_scope, AstNod | ... | @@ -9910,7 +9878,7 @@ static IrInstSrc *ir_gen_fn_proto(IrBuilderSrc *irb, Scope *parent_scope, AstNod |
| 9910 | assert(node->type == NodeTypeFnProto); | 9878 | assert(node->type == NodeTypeFnProto); |
| 9911 | | 9879 | |
| 9912 | size_t param_count = node->data.fn_proto.params.length; | 9880 | size_t param_count = node->data.fn_proto.params.length; |
| 9913 | IrInstSrc **param_types = allocate<IrInstSrc*>(param_count); | 9881 | IrInstSrc **param_types = heap::c_allocator.allocate<IrInstSrc*>(param_count); |
| 9914 | | 9882 | |
| 9915 | bool is_var_args = false; | 9883 | bool is_var_args = false; |
| 9916 | for (size_t i = 0; i < param_count; i += 1) { | 9884 | for (size_t i = 0; i < param_count; i += 1) { |
| ... | @@ -10191,7 +10159,7 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope | ... | @@ -10191,7 +10159,7 @@ static IrInstSrc *ir_gen_node_raw(IrBuilderSrc *irb, AstNode *node, Scope *scope |
| 10191 | } | 10159 | } |
| 10192 | | 10160 | |
| 10193 | static ResultLoc *no_result_loc(void) { | 10161 | static ResultLoc *no_result_loc(void) { |
| 10194 | ResultLocNone *result_loc_none = allocate<ResultLocNone>(1); | 10162 | ResultLocNone *result_loc_none = heap::c_allocator.create<ResultLocNone>(); |
| 10195 | result_loc_none->base.id = ResultLocIdNone; | 10163 | result_loc_none->base.id = ResultLocIdNone; |
| 10196 | return &result_loc_none->base; | 10164 | return &result_loc_none->base; |
| 10197 | } | 10165 | } |
| ... | @@ -10280,7 +10248,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutableSrc *ir_e | ... | @@ -10280,7 +10248,7 @@ bool ir_gen(CodeGen *codegen, AstNode *node, Scope *scope, IrExecutableSrc *ir_e |
| 10280 | if (!instr_is_unreachable(result)) { | 10248 | if (!instr_is_unreachable(result)) { |
| 10281 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, result->base.source_node, result, nullptr)); | 10249 | ir_mark_gen(ir_build_add_implicit_return_type(irb, scope, result->base.source_node, result, nullptr)); |
| 10282 | // no need for save_err_ret_addr because this cannot return error | 10250 | // no need for save_err_ret_addr because this cannot return error |
| 10283 | ResultLocReturn *result_loc_ret = allocate<ResultLocReturn>(1, "ResultLocReturn"); | 10251 | ResultLocReturn *result_loc_ret = heap::c_allocator.create<ResultLocReturn>(); |
| 10284 | result_loc_ret->base.id = ResultLocIdReturn; | 10252 | result_loc_ret->base.id = ResultLocIdReturn; |
| 10285 | ir_build_reset_result(irb, scope, node, &result_loc_ret->base); | 10253 | ir_build_reset_result(irb, scope, node, &result_loc_ret->base); |
| 10286 | ir_mark_gen(ir_build_end_expr(irb, scope, node, result, &result_loc_ret->base)); | 10254 | ir_mark_gen(ir_build_end_expr(irb, scope, node, result, &result_loc_ret->base)); |
| ... | @@ -10372,7 +10340,7 @@ static Error eval_comptime_ptr_reinterpret(IrAnalyze *ira, CodeGen *codegen, Ast | ... | @@ -10372,7 +10340,7 @@ static Error eval_comptime_ptr_reinterpret(IrAnalyze *ira, CodeGen *codegen, Ast |
| 10372 | if ((err = ir_read_const_ptr(ira, codegen, source_node, &tmp, ptr_val))) | 10340 | if ((err = ir_read_const_ptr(ira, codegen, source_node, &tmp, ptr_val))) |
| 10373 | return err; | 10341 | return err; |
| 10374 | ZigValue *child_val = const_ptr_pointee_unchecked(codegen, ptr_val); | 10342 | ZigValue *child_val = const_ptr_pointee_unchecked(codegen, ptr_val); |
| 10375 | copy_const_val(child_val, &tmp); | 10343 | copy_const_val(codegen, child_val, &tmp); |
| 10376 | return ErrorNone; | 10344 | return ErrorNone; |
| 10377 | } | 10345 | } |
| 10378 | | 10346 | |
| ... | @@ -11522,7 +11490,7 @@ static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigTyp | ... | @@ -11522,7 +11490,7 @@ static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigTyp |
| 11522 | return set1; | 11490 | return set1; |
| 11523 | } | 11491 | } |
| 11524 | size_t errors_count = ira->codegen->errors_by_index.length; | 11492 | size_t errors_count = ira->codegen->errors_by_index.length; |
| 11525 | ErrorTableEntry **errors = allocate<ErrorTableEntry *>(errors_count, "ErrorTableEntry *"); | 11493 | ErrorTableEntry **errors = heap::c_allocator.allocate<ErrorTableEntry *>(errors_count); |
| 11526 | populate_error_set_table(errors, set1); | 11494 | populate_error_set_table(errors, set1); |
| 11527 | ZigList<ErrorTableEntry *> intersection_list = {}; | 11495 | ZigList<ErrorTableEntry *> intersection_list = {}; |
| 11528 | | 11496 | |
| ... | @@ -11543,7 +11511,7 @@ static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigTyp | ... | @@ -11543,7 +11511,7 @@ static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigTyp |
| 11543 | buf_appendf(&err_set_type->name, "%s%s", comma, buf_ptr(&existing_entry_with_docs->name)); | 11511 | buf_appendf(&err_set_type->name, "%s%s", comma, buf_ptr(&existing_entry_with_docs->name)); |
| 11544 | } | 11512 | } |
| 11545 | } | 11513 | } |
| 11546 | deallocate(errors, errors_count, "ErrorTableEntry *"); | 11514 | heap::c_allocator.deallocate(errors, errors_count); |
| 11547 | | 11515 | |
| 11548 | err_set_type->data.error_set.err_count = intersection_list.length; | 11516 | err_set_type->data.error_set.err_count = intersection_list.length; |
| 11549 | err_set_type->data.error_set.errors = intersection_list.items; | 11517 | err_set_type->data.error_set.errors = intersection_list.items; |
| ... | @@ -11595,7 +11563,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11595,7 +11563,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11595 | actual_ptr_type->data.pointer.sentinel)); | 11563 | actual_ptr_type->data.pointer.sentinel)); |
| 11596 | if (!ok_null_term_ptrs) { | 11564 | if (!ok_null_term_ptrs) { |
| 11597 | result.id = ConstCastResultIdPtrSentinel; | 11565 | result.id = ConstCastResultIdPtrSentinel; |
| 11598 | result.data.bad_ptr_sentinel = allocate_nonzero<ConstCastPtrSentinel>(1); | 11566 | result.data.bad_ptr_sentinel = heap::c_allocator.allocate_nonzero<ConstCastPtrSentinel>(1); |
| 11599 | result.data.bad_ptr_sentinel->wanted_type = wanted_ptr_type; | 11567 | result.data.bad_ptr_sentinel->wanted_type = wanted_ptr_type; |
| 11600 | result.data.bad_ptr_sentinel->actual_type = actual_ptr_type; | 11568 | result.data.bad_ptr_sentinel->actual_type = actual_ptr_type; |
| 11601 | return result; | 11569 | return result; |
| ... | @@ -11611,7 +11579,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11611,7 +11579,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11611 | (!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile); | 11579 | (!actual_ptr_type->data.pointer.is_volatile || wanted_ptr_type->data.pointer.is_volatile); |
| 11612 | if (!ok_cv_qualifiers) { | 11580 | if (!ok_cv_qualifiers) { |
| 11613 | result.id = ConstCastResultIdCV; | 11581 | result.id = ConstCastResultIdCV; |
| 11614 | result.data.bad_cv = allocate_nonzero<ConstCastBadCV>(1); | 11582 | result.data.bad_cv = heap::c_allocator.allocate_nonzero<ConstCastBadCV>(1); |
| 11615 | result.data.bad_cv->wanted_type = wanted_ptr_type; | 11583 | result.data.bad_cv->wanted_type = wanted_ptr_type; |
| 11616 | result.data.bad_cv->actual_type = actual_ptr_type; | 11584 | result.data.bad_cv->actual_type = actual_ptr_type; |
| 11617 | return result; | 11585 | return result; |
| ... | @@ -11623,7 +11591,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11623,7 +11591,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11623 | return child; | 11591 | return child; |
| 11624 | if (child.id != ConstCastResultIdOk) { | 11592 | if (child.id != ConstCastResultIdOk) { |
| 11625 | result.id = ConstCastResultIdPointerChild; | 11593 | result.id = ConstCastResultIdPointerChild; |
| 11626 | result.data.pointer_mismatch = allocate_nonzero<ConstCastPointerMismatch>(1); | 11594 | result.data.pointer_mismatch = heap::c_allocator.allocate_nonzero<ConstCastPointerMismatch>(1); |
| 11627 | result.data.pointer_mismatch->child = child; | 11595 | result.data.pointer_mismatch->child = child; |
| 11628 | result.data.pointer_mismatch->wanted_child = wanted_ptr_type->data.pointer.child_type; | 11596 | result.data.pointer_mismatch->wanted_child = wanted_ptr_type->data.pointer.child_type; |
| 11629 | result.data.pointer_mismatch->actual_child = actual_ptr_type->data.pointer.child_type; | 11597 | result.data.pointer_mismatch->actual_child = actual_ptr_type->data.pointer.child_type; |
| ... | @@ -11634,7 +11602,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11634,7 +11602,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11634 | (!wanted_allows_zero && !actual_allows_zero); | 11602 | (!wanted_allows_zero && !actual_allows_zero); |
| 11635 | if (!ok_allows_zero) { | 11603 | if (!ok_allows_zero) { |
| 11636 | result.id = ConstCastResultIdBadAllowsZero; | 11604 | result.id = ConstCastResultIdBadAllowsZero; |
| 11637 | result.data.bad_allows_zero = allocate_nonzero<ConstCastBadAllowsZero>(1); | 11605 | result.data.bad_allows_zero = heap::c_allocator.allocate_nonzero<ConstCastBadAllowsZero>(1); |
| 11638 | result.data.bad_allows_zero->wanted_type = wanted_type; | 11606 | result.data.bad_allows_zero->wanted_type = wanted_type; |
| 11639 | result.data.bad_allows_zero->actual_type = actual_type; | 11607 | result.data.bad_allows_zero->actual_type = actual_type; |
| 11640 | return result; | 11608 | return result; |
| ... | @@ -11674,7 +11642,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11674,7 +11642,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11674 | return child; | 11642 | return child; |
| 11675 | if (child.id != ConstCastResultIdOk) { | 11643 | if (child.id != ConstCastResultIdOk) { |
| 11676 | result.id = ConstCastResultIdArrayChild; | 11644 | result.id = ConstCastResultIdArrayChild; |
| 11677 | result.data.array_mismatch = allocate_nonzero<ConstCastArrayMismatch>(1); | 11645 | result.data.array_mismatch = heap::c_allocator.allocate_nonzero<ConstCastArrayMismatch>(1); |
| 11678 | result.data.array_mismatch->child = child; | 11646 | result.data.array_mismatch->child = child; |
| 11679 | result.data.array_mismatch->wanted_child = wanted_type->data.array.child_type; | 11647 | result.data.array_mismatch->wanted_child = wanted_type->data.array.child_type; |
| 11680 | result.data.array_mismatch->actual_child = actual_type->data.array.child_type; | 11648 | result.data.array_mismatch->actual_child = actual_type->data.array.child_type; |
| ... | @@ -11685,7 +11653,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11685,7 +11653,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11685 | const_values_equal(ira->codegen, wanted_type->data.array.sentinel, actual_type->data.array.sentinel)); | 11653 | const_values_equal(ira->codegen, wanted_type->data.array.sentinel, actual_type->data.array.sentinel)); |
| 11686 | if (!ok_null_terminated) { | 11654 | if (!ok_null_terminated) { |
| 11687 | result.id = ConstCastResultIdSentinelArrays; | 11655 | result.id = ConstCastResultIdSentinelArrays; |
| 11688 | result.data.sentinel_arrays = allocate_nonzero<ConstCastBadNullTermArrays>(1); | 11656 | result.data.sentinel_arrays = heap::c_allocator.allocate_nonzero<ConstCastBadNullTermArrays>(1); |
| 11689 | result.data.sentinel_arrays->child = child; | 11657 | result.data.sentinel_arrays->child = child; |
| 11690 | result.data.sentinel_arrays->wanted_type = wanted_type; | 11658 | result.data.sentinel_arrays->wanted_type = wanted_type; |
| 11691 | result.data.sentinel_arrays->actual_type = actual_type; | 11659 | result.data.sentinel_arrays->actual_type = actual_type; |
| ... | @@ -11713,7 +11681,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11713,7 +11681,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11713 | actual_ptr_type->data.pointer.sentinel)); | 11681 | actual_ptr_type->data.pointer.sentinel)); |
| 11714 | if (!ok_sentinels) { | 11682 | if (!ok_sentinels) { |
| 11715 | result.id = ConstCastResultIdPtrSentinel; | 11683 | result.id = ConstCastResultIdPtrSentinel; |
| 11716 | result.data.bad_ptr_sentinel = allocate_nonzero<ConstCastPtrSentinel>(1); | 11684 | result.data.bad_ptr_sentinel = heap::c_allocator.allocate_nonzero<ConstCastPtrSentinel>(1); |
| 11717 | result.data.bad_ptr_sentinel->wanted_type = wanted_ptr_type; | 11685 | result.data.bad_ptr_sentinel->wanted_type = wanted_ptr_type; |
| 11718 | result.data.bad_ptr_sentinel->actual_type = actual_ptr_type; | 11686 | result.data.bad_ptr_sentinel->actual_type = actual_ptr_type; |
| 11719 | return result; | 11687 | return result; |
| ... | @@ -11730,7 +11698,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11730,7 +11698,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11730 | return child; | 11698 | return child; |
| 11731 | if (child.id != ConstCastResultIdOk) { | 11699 | if (child.id != ConstCastResultIdOk) { |
| 11732 | result.id = ConstCastResultIdSliceChild; | 11700 | result.id = ConstCastResultIdSliceChild; |
| 11733 | result.data.slice_mismatch = allocate_nonzero<ConstCastSliceMismatch>(1); | 11701 | result.data.slice_mismatch = heap::c_allocator.allocate_nonzero<ConstCastSliceMismatch>(1); |
| 11734 | result.data.slice_mismatch->child = child; | 11702 | result.data.slice_mismatch->child = child; |
| 11735 | result.data.slice_mismatch->actual_child = actual_ptr_type->data.pointer.child_type; | 11703 | result.data.slice_mismatch->actual_child = actual_ptr_type->data.pointer.child_type; |
| 11736 | result.data.slice_mismatch->wanted_child = wanted_ptr_type->data.pointer.child_type; | 11704 | result.data.slice_mismatch->wanted_child = wanted_ptr_type->data.pointer.child_type; |
| ... | @@ -11747,7 +11715,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11747,7 +11715,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11747 | return child; | 11715 | return child; |
| 11748 | if (child.id != ConstCastResultIdOk) { | 11716 | if (child.id != ConstCastResultIdOk) { |
| 11749 | result.id = ConstCastResultIdOptionalChild; | 11717 | result.id = ConstCastResultIdOptionalChild; |
| 11750 | result.data.optional = allocate_nonzero<ConstCastOptionalMismatch>(1); | 11718 | result.data.optional = heap::c_allocator.allocate_nonzero<ConstCastOptionalMismatch>(1); |
| 11751 | result.data.optional->child = child; | 11719 | result.data.optional->child = child; |
| 11752 | result.data.optional->wanted_child = wanted_type->data.maybe.child_type; | 11720 | result.data.optional->wanted_child = wanted_type->data.maybe.child_type; |
| 11753 | result.data.optional->actual_child = actual_type->data.maybe.child_type; | 11721 | result.data.optional->actual_child = actual_type->data.maybe.child_type; |
| ... | @@ -11763,7 +11731,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11763,7 +11731,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11763 | return payload_child; | 11731 | return payload_child; |
| 11764 | if (payload_child.id != ConstCastResultIdOk) { | 11732 | if (payload_child.id != ConstCastResultIdOk) { |
| 11765 | result.id = ConstCastResultIdErrorUnionPayload; | 11733 | result.id = ConstCastResultIdErrorUnionPayload; |
| 11766 | result.data.error_union_payload = allocate_nonzero<ConstCastErrUnionPayloadMismatch>(1); | 11734 | result.data.error_union_payload = heap::c_allocator.allocate_nonzero<ConstCastErrUnionPayloadMismatch>(1); |
| 11767 | result.data.error_union_payload->child = payload_child; | 11735 | result.data.error_union_payload->child = payload_child; |
| 11768 | result.data.error_union_payload->wanted_payload = wanted_type->data.error_union.payload_type; | 11736 | result.data.error_union_payload->wanted_payload = wanted_type->data.error_union.payload_type; |
| 11769 | result.data.error_union_payload->actual_payload = actual_type->data.error_union.payload_type; | 11737 | result.data.error_union_payload->actual_payload = actual_type->data.error_union.payload_type; |
| ... | @@ -11775,7 +11743,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11775,7 +11743,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11775 | return error_set_child; | 11743 | return error_set_child; |
| 11776 | if (error_set_child.id != ConstCastResultIdOk) { | 11744 | if (error_set_child.id != ConstCastResultIdOk) { |
| 11777 | result.id = ConstCastResultIdErrorUnionErrorSet; | 11745 | result.id = ConstCastResultIdErrorUnionErrorSet; |
| 11778 | result.data.error_union_error_set = allocate_nonzero<ConstCastErrUnionErrSetMismatch>(1); | 11746 | result.data.error_union_error_set = heap::c_allocator.allocate_nonzero<ConstCastErrUnionErrSetMismatch>(1); |
| 11779 | result.data.error_union_error_set->child = error_set_child; | 11747 | result.data.error_union_error_set->child = error_set_child; |
| 11780 | result.data.error_union_error_set->wanted_err_set = wanted_type->data.error_union.err_set_type; | 11748 | result.data.error_union_error_set->wanted_err_set = wanted_type->data.error_union.err_set_type; |
| 11781 | result.data.error_union_error_set->actual_err_set = actual_type->data.error_union.err_set_type; | 11749 | result.data.error_union_error_set->actual_err_set = actual_type->data.error_union.err_set_type; |
| ... | @@ -11809,7 +11777,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11809,7 +11777,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11809 | } | 11777 | } |
| 11810 | | 11778 | |
| 11811 | size_t errors_count = g->errors_by_index.length; | 11779 | size_t errors_count = g->errors_by_index.length; |
| 11812 | ErrorTableEntry **errors = allocate<ErrorTableEntry *>(errors_count, "ErrorTableEntry *"); | 11780 | ErrorTableEntry **errors = heap::c_allocator.allocate<ErrorTableEntry *>(errors_count); |
| 11813 | for (uint32_t i = 0; i < container_set->data.error_set.err_count; i += 1) { | 11781 | for (uint32_t i = 0; i < container_set->data.error_set.err_count; i += 1) { |
| 11814 | ErrorTableEntry *error_entry = container_set->data.error_set.errors[i]; | 11782 | ErrorTableEntry *error_entry = container_set->data.error_set.errors[i]; |
| 11815 | assert(errors[error_entry->value] == nullptr); | 11783 | assert(errors[error_entry->value] == nullptr); |
| ... | @@ -11821,12 +11789,12 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11821,12 +11789,12 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11821 | if (error_entry == nullptr) { | 11789 | if (error_entry == nullptr) { |
| 11822 | if (result.id == ConstCastResultIdOk) { | 11790 | if (result.id == ConstCastResultIdOk) { |
| 11823 | result.id = ConstCastResultIdErrSet; | 11791 | result.id = ConstCastResultIdErrSet; |
| 11824 | result.data.error_set_mismatch = allocate<ConstCastErrSetMismatch>(1); | 11792 | result.data.error_set_mismatch = heap::c_allocator.create<ConstCastErrSetMismatch>(); |
| 11825 | } | 11793 | } |
| 11826 | result.data.error_set_mismatch->missing_errors.append(contained_error_entry); | 11794 | result.data.error_set_mismatch->missing_errors.append(contained_error_entry); |
| 11827 | } | 11795 | } |
| 11828 | } | 11796 | } |
| 11829 | deallocate(errors, errors_count, "ErrorTableEntry *"); | 11797 | heap::c_allocator.deallocate(errors, errors_count); |
| 11830 | return result; | 11798 | return result; |
| 11831 | } | 11799 | } |
| 11832 | | 11800 | |
| ... | @@ -11855,7 +11823,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11855,7 +11823,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11855 | return child; | 11823 | return child; |
| 11856 | if (child.id != ConstCastResultIdOk) { | 11824 | if (child.id != ConstCastResultIdOk) { |
| 11857 | result.id = ConstCastResultIdFnReturnType; | 11825 | result.id = ConstCastResultIdFnReturnType; |
| 11858 | result.data.return_type = allocate_nonzero<ConstCastOnly>(1); | 11826 | result.data.return_type = heap::c_allocator.allocate_nonzero<ConstCastOnly>(1); |
| 11859 | *result.data.return_type = child; | 11827 | *result.data.return_type = child; |
| 11860 | return result; | 11828 | return result; |
| 11861 | } | 11829 | } |
| ... | @@ -11884,7 +11852,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11884,7 +11852,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11884 | result.data.fn_arg.arg_index = i; | 11852 | result.data.fn_arg.arg_index = i; |
| 11885 | result.data.fn_arg.actual_param_type = actual_param_info->type; | 11853 | result.data.fn_arg.actual_param_type = actual_param_info->type; |
| 11886 | result.data.fn_arg.expected_param_type = expected_param_info->type; | 11854 | result.data.fn_arg.expected_param_type = expected_param_info->type; |
| 11887 | result.data.fn_arg.child = allocate_nonzero<ConstCastOnly>(1); | 11855 | result.data.fn_arg.child = heap::c_allocator.allocate_nonzero<ConstCastOnly>(1); |
| 11888 | *result.data.fn_arg.child = arg_child; | 11856 | *result.data.fn_arg.child = arg_child; |
| 11889 | return result; | 11857 | return result; |
| 11890 | } | 11858 | } |
| ... | @@ -11905,14 +11873,14 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11905,14 +11873,14 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11905 | | 11873 | |
| 11906 | if (wanted_type->id == ZigTypeIdInt && actual_type->id == ZigTypeIdInt) { | 11874 | if (wanted_type->id == ZigTypeIdInt && actual_type->id == ZigTypeIdInt) { |
| 11907 | result.id = ConstCastResultIdIntShorten; | 11875 | result.id = ConstCastResultIdIntShorten; |
| 11908 | result.data.int_shorten = allocate_nonzero<ConstCastIntShorten>(1); | 11876 | result.data.int_shorten = heap::c_allocator.allocate_nonzero<ConstCastIntShorten>(1); |
| 11909 | result.data.int_shorten->wanted_type = wanted_type; | 11877 | result.data.int_shorten->wanted_type = wanted_type; |
| 11910 | result.data.int_shorten->actual_type = actual_type; | 11878 | result.data.int_shorten->actual_type = actual_type; |
| 11911 | return result; | 11879 | return result; |
| 11912 | } | 11880 | } |
| 11913 | | 11881 | |
| 11914 | result.id = ConstCastResultIdType; | 11882 | result.id = ConstCastResultIdType; |
| 11915 | result.data.type_mismatch = allocate_nonzero<ConstCastTypeMismatch>(1); | 11883 | result.data.type_mismatch = heap::c_allocator.allocate_nonzero<ConstCastTypeMismatch>(1); |
| 11916 | result.data.type_mismatch->wanted_type = wanted_type; | 11884 | result.data.type_mismatch->wanted_type = wanted_type; |
| 11917 | result.data.type_mismatch->actual_type = actual_type; | 11885 | result.data.type_mismatch->actual_type = actual_type; |
| 11918 | return result; | 11886 | return result; |
| ... | @@ -11921,7 +11889,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted | ... | @@ -11921,7 +11889,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 11921 | static void update_errors_helper(CodeGen *g, ErrorTableEntry ***errors, size_t *errors_count) { | 11889 | static void update_errors_helper(CodeGen *g, ErrorTableEntry ***errors, size_t *errors_count) { |
| 11922 | size_t old_errors_count = *errors_count; | 11890 | size_t old_errors_count = *errors_count; |
| 11923 | *errors_count = g->errors_by_index.length; | 11891 | *errors_count = g->errors_by_index.length; |
| 11924 | *errors = reallocate(*errors, old_errors_count, *errors_count); | 11892 | *errors = heap::c_allocator.reallocate(*errors, old_errors_count, *errors_count); |
| 11925 | } | 11893 | } |
| 11926 | | 11894 | |
| 11927 | static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigType *expected_type, | 11895 | static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigType *expected_type, |
| ... | @@ -12591,7 +12559,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT | ... | @@ -12591,7 +12559,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT |
| 12591 | return ira->codegen->builtin_types.entry_invalid; | 12559 | return ira->codegen->builtin_types.entry_invalid; |
| 12592 | } | 12560 | } |
| 12593 | | 12561 | |
| 12594 | free(errors); | 12562 | heap::c_allocator.deallocate(errors, errors_count); |
| 12595 | | 12563 | |
| 12596 | if (convert_to_const_slice) { | 12564 | if (convert_to_const_slice) { |
| 12597 | if (prev_inst->value->type->id == ZigTypeIdPointer) { | 12565 | if (prev_inst->value->type->id == ZigTypeIdPointer) { |
| ... | @@ -12670,7 +12638,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInst *source_instr, | ... | @@ -12670,7 +12638,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInst *source_instr, |
| 12670 | case CastOpBitCast: | 12638 | case CastOpBitCast: |
| 12671 | zig_panic("TODO"); | 12639 | zig_panic("TODO"); |
| 12672 | case CastOpNoop: { | 12640 | case CastOpNoop: { |
| 12673 | copy_const_val(const_val, other_val); | 12641 | copy_const_val(ira->codegen, const_val, other_val); |
| 12674 | const_val->type = new_type; | 12642 | const_val->type = new_type; |
| 12675 | break; | 12643 | break; |
| 12676 | } | 12644 | } |
| ... | @@ -13199,7 +13167,7 @@ Error ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, | ... | @@ -13199,7 +13167,7 @@ Error ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, |
| 13199 | if (type_is_invalid(return_ptr->type)) | 13167 | if (type_is_invalid(return_ptr->type)) |
| 13200 | return ErrorSemanticAnalyzeFail; | 13168 | return ErrorSemanticAnalyzeFail; |
| 13201 | | 13169 | |
| 13202 | IrExecutableSrc *ir_executable = allocate<IrExecutableSrc>(1, "IrExecutableSrc"); | 13170 | IrExecutableSrc *ir_executable = heap::c_allocator.create<IrExecutableSrc>(); |
| 13203 | ir_executable->source_node = source_node; | 13171 | ir_executable->source_node = source_node; |
| 13204 | ir_executable->parent_exec = parent_exec; | 13172 | ir_executable->parent_exec = parent_exec; |
| 13205 | ir_executable->name = exec_name; | 13173 | ir_executable->name = exec_name; |
| ... | @@ -13223,7 +13191,7 @@ Error ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, | ... | @@ -13223,7 +13191,7 @@ Error ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, |
| 13223 | ir_print_src(codegen, stderr, ir_executable, 2); | 13191 | ir_print_src(codegen, stderr, ir_executable, 2); |
| 13224 | fprintf(stderr, "}\n"); | 13192 | fprintf(stderr, "}\n"); |
| 13225 | } | 13193 | } |
| 13226 | IrExecutableGen *analyzed_executable = allocate<IrExecutableGen>(1, "IrExecutableGen"); | 13194 | IrExecutableGen *analyzed_executable = heap::c_allocator.create<IrExecutableGen>(); |
| 13227 | analyzed_executable->source_node = source_node; | 13195 | analyzed_executable->source_node = source_node; |
| 13228 | analyzed_executable->parent_exec = parent_exec; | 13196 | analyzed_executable->parent_exec = parent_exec; |
| 13229 | analyzed_executable->source_exec = ir_executable; | 13197 | analyzed_executable->source_exec = ir_executable; |
| ... | @@ -13424,7 +13392,7 @@ static IrInstGen *ir_analyze_optional_wrap(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -13424,7 +13392,7 @@ static IrInstGen *ir_analyze_optional_wrap(IrAnalyze *ira, IrInst* source_instr, |
| 13424 | source_instr->scope, source_instr->source_node); | 13392 | source_instr->scope, source_instr->source_node); |
| 13425 | const_instruction->base.value->special = ConstValSpecialStatic; | 13393 | const_instruction->base.value->special = ConstValSpecialStatic; |
| 13426 | if (types_have_same_zig_comptime_repr(ira->codegen, wanted_type, payload_type)) { | 13394 | if (types_have_same_zig_comptime_repr(ira->codegen, wanted_type, payload_type)) { |
| 13427 | copy_const_val(const_instruction->base.value, val); | 13395 | copy_const_val(ira->codegen, const_instruction->base.value, val); |
| 13428 | } else { | 13396 | } else { |
| 13429 | const_instruction->base.value->data.x_optional = val; | 13397 | const_instruction->base.value->data.x_optional = val; |
| 13430 | } | 13398 | } |
| ... | @@ -13465,7 +13433,7 @@ static IrInstGen *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInst* source_ins | ... | @@ -13465,7 +13433,7 @@ static IrInstGen *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInst* source_ins |
| 13465 | if (val == nullptr) | 13433 | if (val == nullptr) |
| 13466 | return ira->codegen->invalid_inst_gen; | 13434 | return ira->codegen->invalid_inst_gen; |
| 13467 | | 13435 | |
| 13468 | ZigValue *err_set_val = create_const_vals(1); | 13436 | ZigValue *err_set_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 13469 | err_set_val->type = err_set_type; | 13437 | err_set_val->type = err_set_type; |
| 13470 | err_set_val->special = ConstValSpecialStatic; | 13438 | err_set_val->special = ConstValSpecialStatic; |
| 13471 | err_set_val->data.x_err_set = nullptr; | 13439 | err_set_val->data.x_err_set = nullptr; |
| ... | @@ -13577,7 +13545,7 @@ static IrInstGen *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -13577,7 +13545,7 @@ static IrInstGen *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInst* source_instr, |
| 13577 | if (!val) | 13545 | if (!val) |
| 13578 | return ira->codegen->invalid_inst_gen; | 13546 | return ira->codegen->invalid_inst_gen; |
| 13579 | | 13547 | |
| 13580 | ZigValue *err_set_val = create_const_vals(1); | 13548 | ZigValue *err_set_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 13581 | err_set_val->special = ConstValSpecialStatic; | 13549 | err_set_val->special = ConstValSpecialStatic; |
| 13582 | err_set_val->type = wanted_type->data.error_union.err_set_type; | 13550 | err_set_val->type = wanted_type->data.error_union.err_set_type; |
| 13583 | err_set_val->data.x_err_set = val->data.x_err_set; | 13551 | err_set_val->data.x_err_set = val->data.x_err_set; |
| ... | @@ -13842,7 +13810,7 @@ static IrInstGen *ir_analyze_enum_to_union(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -13842,7 +13810,7 @@ static IrInstGen *ir_analyze_enum_to_union(IrAnalyze *ira, IrInst* source_instr, |
| 13842 | result->value->special = ConstValSpecialStatic; | 13810 | result->value->special = ConstValSpecialStatic; |
| 13843 | result->value->type = wanted_type; | 13811 | result->value->type = wanted_type; |
| 13844 | bigint_init_bigint(&result->value->data.x_union.tag, &val->data.x_enum_tag); | 13812 | bigint_init_bigint(&result->value->data.x_union.tag, &val->data.x_enum_tag); |
| 13845 | result->value->data.x_union.payload = create_const_vals(1); | 13813 | result->value->data.x_union.payload = ira->codegen->pass1_arena->create<ZigValue>(); |
| 13846 | result->value->data.x_union.payload->special = ConstValSpecialStatic; | 13814 | result->value->data.x_union.payload->special = ConstValSpecialStatic; |
| 13847 | result->value->data.x_union.payload->type = field_type; | 13815 | result->value->data.x_union.payload->type = field_type; |
| 13848 | return result; | 13816 | return result; |
| ... | @@ -14147,7 +14115,7 @@ static IrInstGen *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -14147,7 +14115,7 @@ static IrInstGen *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInst* source_instr, |
| 14147 | if (pointee == nullptr) | 14115 | if (pointee == nullptr) |
| 14148 | return ira->codegen->invalid_inst_gen; | 14116 | return ira->codegen->invalid_inst_gen; |
| 14149 | if (pointee->special != ConstValSpecialRuntime) { | 14117 | if (pointee->special != ConstValSpecialRuntime) { |
| 14150 | ZigValue *array_val = create_const_vals(1); | 14118 | ZigValue *array_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 14151 | array_val->special = ConstValSpecialStatic; | 14119 | array_val->special = ConstValSpecialStatic; |
| 14152 | array_val->type = array_type; | 14120 | array_val->type = array_type; |
| 14153 | array_val->data.x_array.special = ConstArraySpecialNone; | 14121 | array_val->data.x_array.special = ConstArraySpecialNone; |
| ... | @@ -14361,7 +14329,7 @@ static IrInstGen *ir_analyze_array_to_vector(IrAnalyze *ira, IrInst* source_inst | ... | @@ -14361,7 +14329,7 @@ static IrInstGen *ir_analyze_array_to_vector(IrAnalyze *ira, IrInst* source_inst |
| 14361 | if (instr_is_comptime(array)) { | 14329 | if (instr_is_comptime(array)) { |
| 14362 | // arrays and vectors have the same ZigValue representation | 14330 | // arrays and vectors have the same ZigValue representation |
| 14363 | IrInstGen *result = ir_const(ira, source_instr, vector_type); | 14331 | IrInstGen *result = ir_const(ira, source_instr, vector_type); |
| 14364 | copy_const_val(result->value, array->value); | 14332 | copy_const_val(ira->codegen, result->value, array->value); |
| 14365 | result->value->type = vector_type; | 14333 | result->value->type = vector_type; |
| 14366 | return result; | 14334 | return result; |
| 14367 | } | 14335 | } |
| ... | @@ -14374,7 +14342,7 @@ static IrInstGen *ir_analyze_vector_to_array(IrAnalyze *ira, IrInst* source_inst | ... | @@ -14374,7 +14342,7 @@ static IrInstGen *ir_analyze_vector_to_array(IrAnalyze *ira, IrInst* source_inst |
| 14374 | if (instr_is_comptime(vector)) { | 14342 | if (instr_is_comptime(vector)) { |
| 14375 | // arrays and vectors have the same ZigValue representation | 14343 | // arrays and vectors have the same ZigValue representation |
| 14376 | IrInstGen *result = ir_const(ira, source_instr, array_type); | 14344 | IrInstGen *result = ir_const(ira, source_instr, array_type); |
| 14377 | copy_const_val(result->value, vector->value); | 14345 | copy_const_val(ira->codegen, result->value, vector->value); |
| 14378 | result->value->type = array_type; | 14346 | result->value->type = array_type; |
| 14379 | return result; | 14347 | return result; |
| 14380 | } | 14348 | } |
| ... | @@ -14674,7 +14642,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr, | ... | @@ -14674,7 +14642,7 @@ static IrInstGen *ir_analyze_cast(IrAnalyze *ira, IrInst *source_instr, |
| 14674 | if (wanted_type->id == ZigTypeIdComptimeInt || wanted_type->id == ZigTypeIdInt) { | 14642 | if (wanted_type->id == ZigTypeIdComptimeInt || wanted_type->id == ZigTypeIdInt) { |
| 14675 | IrInstGen *result = ir_const(ira, source_instr, wanted_type); | 14643 | IrInstGen *result = ir_const(ira, source_instr, wanted_type); |
| 14676 | if (actual_type->id == ZigTypeIdComptimeInt || actual_type->id == ZigTypeIdInt) { | 14644 | if (actual_type->id == ZigTypeIdComptimeInt || actual_type->id == ZigTypeIdInt) { |
| 14677 | copy_const_val(result->value, value->value); | 14645 | copy_const_val(ira->codegen, result->value, value->value); |
| 14678 | result->value->type = wanted_type; | 14646 | result->value->type = wanted_type; |
| 14679 | } else { | 14647 | } else { |
| 14680 | float_init_bigint(&result->value->data.x_bigint, value->value); | 14648 | float_init_bigint(&result->value->data.x_bigint, value->value); |
| ... | @@ -16507,7 +16475,7 @@ static IrInstGen *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstSrcBinOp *bin_op_i | ... | @@ -16507,7 +16475,7 @@ static IrInstGen *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstSrcBinOp *bin_op_i |
| 16507 | IrInstGen *result = ir_const(ira, &bin_op_instruction->base.base, | 16475 | IrInstGen *result = ir_const(ira, &bin_op_instruction->base.base, |
| 16508 | get_vector_type(ira->codegen, resolved_type->data.vector.len, ira->codegen->builtin_types.entry_bool)); | 16476 | get_vector_type(ira->codegen, resolved_type->data.vector.len, ira->codegen->builtin_types.entry_bool)); |
| 16509 | result->value->data.x_array.data.s_none.elements = | 16477 | result->value->data.x_array.data.s_none.elements = |
| 16510 | create_const_vals(resolved_type->data.vector.len); | 16478 | ira->codegen->pass1_arena->allocate<ZigValue>(resolved_type->data.vector.len); |
| 16511 | | 16479 | |
| 16512 | expand_undef_array(ira->codegen, result->value); | 16480 | expand_undef_array(ira->codegen, result->value); |
| 16513 | for (size_t i = 0;i < resolved_type->data.vector.len;i++) { | 16481 | for (size_t i = 0;i < resolved_type->data.vector.len;i++) { |
| ... | @@ -16515,7 +16483,7 @@ static IrInstGen *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstSrcBinOp *bin_op_i | ... | @@ -16515,7 +16483,7 @@ static IrInstGen *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstSrcBinOp *bin_op_i |
| 16515 | &op1_val->data.x_array.data.s_none.elements[i], | 16483 | &op1_val->data.x_array.data.s_none.elements[i], |
| 16516 | &op2_val->data.x_array.data.s_none.elements[i], | 16484 | &op2_val->data.x_array.data.s_none.elements[i], |
| 16517 | bin_op_instruction, op_id, one_possible_value); | 16485 | bin_op_instruction, op_id, one_possible_value); |
| 16518 | copy_const_val(&result->value->data.x_array.data.s_none.elements[i], cur_res->value); | 16486 | copy_const_val(ira->codegen, &result->value->data.x_array.data.s_none.elements[i], cur_res->value); |
| 16519 | } | 16487 | } |
| 16520 | return result; | 16488 | return result; |
| 16521 | } | 16489 | } |
| ... | @@ -17415,7 +17383,7 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi | ... | @@ -17415,7 +17383,7 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi |
| 17415 | ZigValue *out_array_val; | 17383 | ZigValue *out_array_val; |
| 17416 | size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index); | 17384 | size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index); |
| 17417 | if (op1_type->id == ZigTypeIdPointer || op2_type->id == ZigTypeIdPointer) { | 17385 | if (op1_type->id == ZigTypeIdPointer || op2_type->id == ZigTypeIdPointer) { |
| 17418 | out_array_val = create_const_vals(1); | 17386 | out_array_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 17419 | out_array_val->special = ConstValSpecialStatic; | 17387 | out_array_val->special = ConstValSpecialStatic; |
| 17420 | out_array_val->type = get_array_type(ira->codegen, child_type, new_len, sentinel); | 17388 | out_array_val->type = get_array_type(ira->codegen, child_type, new_len, sentinel); |
| 17421 | | 17389 | |
| ... | @@ -17427,11 +17395,11 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi | ... | @@ -17427,11 +17395,11 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi |
| 17427 | true, false, PtrLenUnknown, 0, 0, 0, false, | 17395 | true, false, PtrLenUnknown, 0, 0, 0, false, |
| 17428 | VECTOR_INDEX_NONE, nullptr, sentinel); | 17396 | VECTOR_INDEX_NONE, nullptr, sentinel); |
| 17429 | result->value->type = get_slice_type(ira->codegen, ptr_type); | 17397 | result->value->type = get_slice_type(ira->codegen, ptr_type); |
| 17430 | out_array_val = create_const_vals(1); | 17398 | out_array_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 17431 | out_array_val->special = ConstValSpecialStatic; | 17399 | out_array_val->special = ConstValSpecialStatic; |
| 17432 | out_array_val->type = get_array_type(ira->codegen, child_type, new_len, sentinel); | 17400 | out_array_val->type = get_array_type(ira->codegen, child_type, new_len, sentinel); |
| 17433 | | 17401 | |
| 17434 | out_val->data.x_struct.fields = alloc_const_vals_ptrs(2); | 17402 | out_val->data.x_struct.fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 17435 | | 17403 | |
| 17436 | out_val->data.x_struct.fields[slice_ptr_index]->type = ptr_type; | 17404 | out_val->data.x_struct.fields[slice_ptr_index]->type = ptr_type; |
| 17437 | out_val->data.x_struct.fields[slice_ptr_index]->special = ConstValSpecialStatic; | 17405 | out_val->data.x_struct.fields[slice_ptr_index]->special = ConstValSpecialStatic; |
| ... | @@ -17448,7 +17416,7 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi | ... | @@ -17448,7 +17416,7 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi |
| 17448 | } else { | 17416 | } else { |
| 17449 | result->value->type = get_pointer_to_type_extra2(ira->codegen, child_type, true, false, PtrLenUnknown, | 17417 | result->value->type = get_pointer_to_type_extra2(ira->codegen, child_type, true, false, PtrLenUnknown, |
| 17450 | 0, 0, 0, false, VECTOR_INDEX_NONE, nullptr, sentinel); | 17418 | 0, 0, 0, false, VECTOR_INDEX_NONE, nullptr, sentinel); |
| 17451 | out_array_val = create_const_vals(1); | 17419 | out_array_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 17452 | out_array_val->special = ConstValSpecialStatic; | 17420 | out_array_val->special = ConstValSpecialStatic; |
| 17453 | out_array_val->type = get_array_type(ira->codegen, child_type, new_len, sentinel); | 17421 | out_array_val->type = get_array_type(ira->codegen, child_type, new_len, sentinel); |
| 17454 | out_val->data.x_ptr.special = ConstPtrSpecialBaseArray; | 17422 | out_val->data.x_ptr.special = ConstPtrSpecialBaseArray; |
| ... | @@ -17464,7 +17432,7 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi | ... | @@ -17464,7 +17432,7 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi |
| 17464 | } | 17432 | } |
| 17465 | | 17433 | |
| 17466 | uint64_t full_len = new_len + ((sentinel != nullptr) ? 1 : 0); | 17434 | uint64_t full_len = new_len + ((sentinel != nullptr) ? 1 : 0); |
| 17467 | out_array_val->data.x_array.data.s_none.elements = create_const_vals(full_len); | 17435 | out_array_val->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(full_len); |
| 17468 | // TODO handle the buf case here for an optimization | 17436 | // TODO handle the buf case here for an optimization |
| 17469 | expand_undef_array(ira->codegen, op1_array_val); | 17437 | expand_undef_array(ira->codegen, op1_array_val); |
| 17470 | expand_undef_array(ira->codegen, op2_array_val); | 17438 | expand_undef_array(ira->codegen, op2_array_val); |
| ... | @@ -17472,21 +17440,21 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi | ... | @@ -17472,21 +17440,21 @@ static IrInstGen *ir_analyze_array_cat(IrAnalyze *ira, IrInstSrcBinOp *instructi |
| 17472 | size_t next_index = 0; | 17440 | size_t next_index = 0; |
| 17473 | for (size_t i = op1_array_index; i < op1_array_end; i += 1, next_index += 1) { | 17441 | for (size_t i = op1_array_index; i < op1_array_end; i += 1, next_index += 1) { |
| 17474 | ZigValue *elem_dest_val = &out_array_val->data.x_array.data.s_none.elements[next_index]; | 17442 | ZigValue *elem_dest_val = &out_array_val->data.x_array.data.s_none.elements[next_index]; |
| 17475 | copy_const_val(elem_dest_val, &op1_array_val->data.x_array.data.s_none.elements[i]); | 17443 | copy_const_val(ira->codegen, elem_dest_val, &op1_array_val->data.x_array.data.s_none.elements[i]); |
| 17476 | elem_dest_val->parent.id = ConstParentIdArray; | 17444 | elem_dest_val->parent.id = ConstParentIdArray; |
| 17477 | elem_dest_val->parent.data.p_array.array_val = out_array_val; | 17445 | elem_dest_val->parent.data.p_array.array_val = out_array_val; |
| 17478 | elem_dest_val->parent.data.p_array.elem_index = next_index; | 17446 | elem_dest_val->parent.data.p_array.elem_index = next_index; |
| 17479 | } | 17447 | } |
| 17480 | for (size_t i = op2_array_index; i < op2_array_end; i += 1, next_index += 1) { | 17448 | for (size_t i = op2_array_index; i < op2_array_end; i += 1, next_index += 1) { |
| 17481 | ZigValue *elem_dest_val = &out_array_val->data.x_array.data.s_none.elements[next_index]; | 17449 | ZigValue *elem_dest_val = &out_array_val->data.x_array.data.s_none.elements[next_index]; |
| 17482 | copy_const_val(elem_dest_val, &op2_array_val->data.x_array.data.s_none.elements[i]); | 17450 | copy_const_val(ira->codegen, elem_dest_val, &op2_array_val->data.x_array.data.s_none.elements[i]); |
| 17483 | elem_dest_val->parent.id = ConstParentIdArray; | 17451 | elem_dest_val->parent.id = ConstParentIdArray; |
| 17484 | elem_dest_val->parent.data.p_array.array_val = out_array_val; | 17452 | elem_dest_val->parent.data.p_array.array_val = out_array_val; |
| 17485 | elem_dest_val->parent.data.p_array.elem_index = next_index; | 17453 | elem_dest_val->parent.data.p_array.elem_index = next_index; |
| 17486 | } | 17454 | } |
| 17487 | if (next_index < full_len) { | 17455 | if (next_index < full_len) { |
| 17488 | ZigValue *elem_dest_val = &out_array_val->data.x_array.data.s_none.elements[next_index]; | 17456 | ZigValue *elem_dest_val = &out_array_val->data.x_array.data.s_none.elements[next_index]; |
| 17489 | copy_const_val(elem_dest_val, sentinel); | 17457 | copy_const_val(ira->codegen, elem_dest_val, sentinel); |
| 17490 | elem_dest_val->parent.id = ConstParentIdArray; | 17458 | elem_dest_val->parent.id = ConstParentIdArray; |
| 17491 | elem_dest_val->parent.data.p_array.array_val = out_array_val; | 17459 | elem_dest_val->parent.data.p_array.array_val = out_array_val; |
| 17492 | elem_dest_val->parent.data.p_array.elem_index = next_index; | 17460 | elem_dest_val->parent.data.p_array.elem_index = next_index; |
| ... | @@ -17565,13 +17533,13 @@ static IrInstGen *ir_analyze_array_mult(IrAnalyze *ira, IrInstSrcBinOp *instruct | ... | @@ -17565,13 +17533,13 @@ static IrInstGen *ir_analyze_array_mult(IrAnalyze *ira, IrInstSrcBinOp *instruct |
| 17565 | // TODO optimize the buf case | 17533 | // TODO optimize the buf case |
| 17566 | expand_undef_array(ira->codegen, array_val); | 17534 | expand_undef_array(ira->codegen, array_val); |
| 17567 | size_t extra_null_term = (array_type->data.array.sentinel != nullptr) ? 1 : 0; | 17535 | size_t extra_null_term = (array_type->data.array.sentinel != nullptr) ? 1 : 0; |
| 17568 | out_val->data.x_array.data.s_none.elements = create_const_vals(new_array_len + extra_null_term); | 17536 | out_val->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(new_array_len + extra_null_term); |
| 17569 | | 17537 | |
| 17570 | uint64_t i = 0; | 17538 | uint64_t i = 0; |
| 17571 | for (uint64_t x = 0; x < mult_amt; x += 1) { | 17539 | for (uint64_t x = 0; x < mult_amt; x += 1) { |
| 17572 | for (uint64_t y = 0; y < old_array_len; y += 1) { | 17540 | for (uint64_t y = 0; y < old_array_len; y += 1) { |
| 17573 | ZigValue *elem_dest_val = &out_val->data.x_array.data.s_none.elements[i]; | 17541 | ZigValue *elem_dest_val = &out_val->data.x_array.data.s_none.elements[i]; |
| 17574 | copy_const_val(elem_dest_val, &array_val->data.x_array.data.s_none.elements[y]); | 17542 | copy_const_val(ira->codegen, elem_dest_val, &array_val->data.x_array.data.s_none.elements[y]); |
| 17575 | elem_dest_val->parent.id = ConstParentIdArray; | 17543 | elem_dest_val->parent.id = ConstParentIdArray; |
| 17576 | elem_dest_val->parent.data.p_array.array_val = out_val; | 17544 | elem_dest_val->parent.data.p_array.array_val = out_val; |
| 17577 | elem_dest_val->parent.data.p_array.elem_index = i; | 17545 | elem_dest_val->parent.data.p_array.elem_index = i; |
| ... | @@ -17582,7 +17550,7 @@ static IrInstGen *ir_analyze_array_mult(IrAnalyze *ira, IrInstSrcBinOp *instruct | ... | @@ -17582,7 +17550,7 @@ static IrInstGen *ir_analyze_array_mult(IrAnalyze *ira, IrInstSrcBinOp *instruct |
| 17582 | | 17550 | |
| 17583 | if (array_type->data.array.sentinel != nullptr) { | 17551 | if (array_type->data.array.sentinel != nullptr) { |
| 17584 | ZigValue *elem_dest_val = &out_val->data.x_array.data.s_none.elements[i]; | 17552 | ZigValue *elem_dest_val = &out_val->data.x_array.data.s_none.elements[i]; |
| 17585 | copy_const_val(elem_dest_val, array_type->data.array.sentinel); | 17553 | copy_const_val(ira->codegen, elem_dest_val, array_type->data.array.sentinel); |
| 17586 | elem_dest_val->parent.id = ConstParentIdArray; | 17554 | elem_dest_val->parent.id = ConstParentIdArray; |
| 17587 | elem_dest_val->parent.data.p_array.array_val = out_val; | 17555 | elem_dest_val->parent.data.p_array.array_val = out_val; |
| 17588 | elem_dest_val->parent.data.p_array.elem_index = i; | 17556 | elem_dest_val->parent.data.p_array.elem_index = i; |
| ... | @@ -17623,14 +17591,14 @@ static IrInstGen *ir_analyze_instruction_merge_err_sets(IrAnalyze *ira, | ... | @@ -17623,14 +17591,14 @@ static IrInstGen *ir_analyze_instruction_merge_err_sets(IrAnalyze *ira, |
| 17623 | } | 17591 | } |
| 17624 | | 17592 | |
| 17625 | size_t errors_count = ira->codegen->errors_by_index.length; | 17593 | size_t errors_count = ira->codegen->errors_by_index.length; |
| 17626 | ErrorTableEntry **errors = allocate<ErrorTableEntry *>(errors_count, "ErrorTableEntry *"); | 17594 | ErrorTableEntry **errors = heap::c_allocator.allocate<ErrorTableEntry *>(errors_count); |
| 17627 | for (uint32_t i = 0, count = op1_type->data.error_set.err_count; i < count; i += 1) { | 17595 | for (uint32_t i = 0, count = op1_type->data.error_set.err_count; i < count; i += 1) { |
| 17628 | ErrorTableEntry *error_entry = op1_type->data.error_set.errors[i]; | 17596 | ErrorTableEntry *error_entry = op1_type->data.error_set.errors[i]; |
| 17629 | assert(errors[error_entry->value] == nullptr); | 17597 | assert(errors[error_entry->value] == nullptr); |
| 17630 | errors[error_entry->value] = error_entry; | 17598 | errors[error_entry->value] = error_entry; |
| 17631 | } | 17599 | } |
| 17632 | ZigType *result_type = get_error_set_union(ira->codegen, errors, op1_type, op2_type, instruction->type_name); | 17600 | ZigType *result_type = get_error_set_union(ira->codegen, errors, op1_type, op2_type, instruction->type_name); |
| 17633 | deallocate(errors, errors_count, "ErrorTableEntry *"); | 17601 | heap::c_allocator.deallocate(errors, errors_count); |
| 17634 | | 17602 | |
| 17635 | return ir_const_type(ira, &instruction->base.base, result_type); | 17603 | return ir_const_type(ira, &instruction->base.base, result_type); |
| 17636 | } | 17604 | } |
| ... | @@ -17729,8 +17697,8 @@ static IrInstGen *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstSrcDeclV | ... | @@ -17729,8 +17697,8 @@ static IrInstGen *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstSrcDeclV |
| 17729 | if (var->gen_is_const) { | 17697 | if (var->gen_is_const) { |
| 17730 | var->const_value = init_val; | 17698 | var->const_value = init_val; |
| 17731 | } else { | 17699 | } else { |
| 17732 | var->const_value = create_const_vals(1); | 17700 | var->const_value = ira->codegen->pass1_arena->create<ZigValue>(); |
| 17733 | copy_const_val(var->const_value, init_val); | 17701 | copy_const_val(ira->codegen, var->const_value, init_val); |
| 17734 | } | 17702 | } |
| 17735 | } | 17703 | } |
| 17736 | } | 17704 | } |
| ... | @@ -17904,7 +17872,7 @@ static IrInstGen *ir_analyze_instruction_export(IrAnalyze *ira, IrInstSrcExport | ... | @@ -17904,7 +17872,7 @@ static IrInstGen *ir_analyze_instruction_export(IrAnalyze *ira, IrInstSrcExport |
| 17904 | // It's not clear how all the different types are supposed to be handled. | 17872 | // It's not clear how all the different types are supposed to be handled. |
| 17905 | // Need comprehensive tests for exporting one thing in one file and declaring an extern var | 17873 | // Need comprehensive tests for exporting one thing in one file and declaring an extern var |
| 17906 | // in another file. | 17874 | // in another file. |
| 17907 | TldFn *tld_fn = allocate<TldFn>(1); | 17875 | TldFn *tld_fn = heap::c_allocator.create<TldFn>(); |
| 17908 | tld_fn->base.id = TldIdFn; | 17876 | tld_fn->base.id = TldIdFn; |
| 17909 | tld_fn->base.source_node = instruction->base.base.source_node; | 17877 | tld_fn->base.source_node = instruction->base.base.source_node; |
| 17910 | | 17878 | |
| ... | @@ -18133,7 +18101,7 @@ static IrInstGen *ir_analyze_instruction_error_union(IrAnalyze *ira, IrInstSrcEr | ... | @@ -18133,7 +18101,7 @@ static IrInstGen *ir_analyze_instruction_error_union(IrAnalyze *ira, IrInstSrcEr |
| 18133 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); | 18101 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); |
| 18134 | result->value->special = ConstValSpecialLazy; | 18102 | result->value->special = ConstValSpecialLazy; |
| 18135 | | 18103 | |
| 18136 | LazyValueErrUnionType *lazy_err_union_type = allocate<LazyValueErrUnionType>(1, "LazyValueErrUnionType"); | 18104 | LazyValueErrUnionType *lazy_err_union_type = heap::c_allocator.create<LazyValueErrUnionType>(); |
| 18137 | lazy_err_union_type->ira = ira; ira_ref(ira); | 18105 | lazy_err_union_type->ira = ira; ira_ref(ira); |
| 18138 | result->value->data.x_lazy = &lazy_err_union_type->base; | 18106 | result->value->data.x_lazy = &lazy_err_union_type->base; |
| 18139 | lazy_err_union_type->base.id = LazyValueIdErrUnionType; | 18107 | lazy_err_union_type->base.id = LazyValueIdErrUnionType; |
| ... | @@ -18154,7 +18122,7 @@ static IrInstGen *ir_analyze_alloca(IrAnalyze *ira, IrInst *source_inst, ZigType | ... | @@ -18154,7 +18122,7 @@ static IrInstGen *ir_analyze_alloca(IrAnalyze *ira, IrInst *source_inst, ZigType |
| 18154 | { | 18122 | { |
| 18155 | Error err; | 18123 | Error err; |
| 18156 | | 18124 | |
| 18157 | ZigValue *pointee = create_const_vals(1); | 18125 | ZigValue *pointee = ira->codegen->pass1_arena->create<ZigValue>(); |
| 18158 | pointee->special = ConstValSpecialUndef; | 18126 | pointee->special = ConstValSpecialUndef; |
| 18159 | pointee->llvm_align = align; | 18127 | pointee->llvm_align = align; |
| 18160 | | 18128 | |
| ... | @@ -18235,8 +18203,8 @@ static bool type_can_bit_cast(ZigType *t) { | ... | @@ -18235,8 +18203,8 @@ static bool type_can_bit_cast(ZigType *t) { |
| 18235 | } | 18203 | } |
| 18236 | } | 18204 | } |
| 18237 | | 18205 | |
| 18238 | static void set_up_result_loc_for_inferred_comptime(IrInstGen *ptr) { | 18206 | static void set_up_result_loc_for_inferred_comptime(IrAnalyze *ira, IrInstGen *ptr) { |
| 18239 | ZigValue *undef_child = create_const_vals(1); | 18207 | ZigValue *undef_child = ira->codegen->pass1_arena->create<ZigValue>(); |
| 18240 | undef_child->type = ptr->value->type->data.pointer.child_type; | 18208 | undef_child->type = ptr->value->type->data.pointer.child_type; |
| 18241 | undef_child->special = ConstValSpecialUndef; | 18209 | undef_child->special = ConstValSpecialUndef; |
| 18242 | ptr->value->special = ConstValSpecialStatic; | 18210 | ptr->value->special = ConstValSpecialStatic; |
| ... | @@ -18282,7 +18250,7 @@ static IrInstGen *ir_resolve_no_result_loc(IrAnalyze *ira, IrInst *suspend_sourc | ... | @@ -18282,7 +18250,7 @@ static IrInstGen *ir_resolve_no_result_loc(IrAnalyze *ira, IrInst *suspend_sourc |
| 18282 | IrInstGenAlloca *alloca_gen = ir_build_alloca_gen(ira, suspend_source_instr, 0, ""); | 18250 | IrInstGenAlloca *alloca_gen = ir_build_alloca_gen(ira, suspend_source_instr, 0, ""); |
| 18283 | alloca_gen->base.value->type = get_pointer_to_type_extra(ira->codegen, value_type, false, false, | 18251 | alloca_gen->base.value->type = get_pointer_to_type_extra(ira->codegen, value_type, false, false, |
| 18284 | PtrLenSingle, 0, 0, 0, false); | 18252 | PtrLenSingle, 0, 0, 0, false); |
| 18285 | set_up_result_loc_for_inferred_comptime(&alloca_gen->base); | 18253 | set_up_result_loc_for_inferred_comptime(ira, &alloca_gen->base); |
| 18286 | ZigFn *fn_entry = ira->new_irb.exec->fn_entry; | 18254 | ZigFn *fn_entry = ira->new_irb.exec->fn_entry; |
| 18287 | if (fn_entry != nullptr && get_scope_typeof(suspend_source_instr->scope) == nullptr) { | 18255 | if (fn_entry != nullptr && get_scope_typeof(suspend_source_instr->scope) == nullptr) { |
| 18288 | fn_entry->alloca_gen_list.append(alloca_gen); | 18256 | fn_entry->alloca_gen_list.append(alloca_gen); |
| ... | @@ -18346,7 +18314,6 @@ static IrInstGen *ir_resolve_result_raw(IrAnalyze *ira, IrInst *suspend_source_i | ... | @@ -18346,7 +18314,6 @@ static IrInstGen *ir_resolve_result_raw(IrAnalyze *ira, IrInst *suspend_source_i |
| 18346 | ZigVar *new_var = create_local_var(ira->codegen, var->decl_node, var->child_scope, | 18314 | ZigVar *new_var = create_local_var(ira->codegen, var->decl_node, var->child_scope, |
| 18347 | buf_create_from_str(var->name), var->src_is_const, var->gen_is_const, | 18315 | buf_create_from_str(var->name), var->src_is_const, var->gen_is_const, |
| 18348 | var->shadowable, var->is_comptime, true); | 18316 | var->shadowable, var->is_comptime, true); |
| 18349 | new_var->owner_exec = var->owner_exec; | | |
| 18350 | new_var->align_bytes = var->align_bytes; | 18317 | new_var->align_bytes = var->align_bytes; |
| 18351 | | 18318 | |
| 18352 | var->next_var = new_var; | 18319 | var->next_var = new_var; |
| ... | @@ -18685,15 +18652,15 @@ static IrInstGen *ir_resolve_result(IrAnalyze *ira, IrInst *suspend_source_instr | ... | @@ -18685,15 +18652,15 @@ static IrInstGen *ir_resolve_result(IrAnalyze *ira, IrInst *suspend_source_instr |
| 18685 | if (!val) | 18652 | if (!val) |
| 18686 | return ira->codegen->invalid_inst_gen; | 18653 | return ira->codegen->invalid_inst_gen; |
| 18687 | field->is_comptime = true; | 18654 | field->is_comptime = true; |
| 18688 | field->init_val = create_const_vals(1); | 18655 | field->init_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 18689 | copy_const_val(field->init_val, val); | 18656 | copy_const_val(ira->codegen, field->init_val, val); |
| 18690 | return result_loc; | 18657 | return result_loc; |
| 18691 | } | 18658 | } |
| 18692 | | 18659 | |
| 18693 | ZigType *struct_ptr_type = get_pointer_to_type(ira->codegen, isf->inferred_struct_type, false); | 18660 | ZigType *struct_ptr_type = get_pointer_to_type(ira->codegen, isf->inferred_struct_type, false); |
| 18694 | if (instr_is_comptime(result_loc)) { | 18661 | if (instr_is_comptime(result_loc)) { |
| 18695 | casted_ptr = ir_const(ira, suspend_source_instr, struct_ptr_type); | 18662 | casted_ptr = ir_const(ira, suspend_source_instr, struct_ptr_type); |
| 18696 | copy_const_val(casted_ptr->value, result_loc->value); | 18663 | copy_const_val(ira->codegen, casted_ptr->value, result_loc->value); |
| 18697 | casted_ptr->value->type = struct_ptr_type; | 18664 | casted_ptr->value->type = struct_ptr_type; |
| 18698 | } else { | 18665 | } else { |
| 18699 | casted_ptr = result_loc; | 18666 | casted_ptr = result_loc; |
| ... | @@ -18706,8 +18673,8 @@ static IrInstGen *ir_resolve_result(IrAnalyze *ira, IrInst *suspend_source_instr | ... | @@ -18706,8 +18673,8 @@ static IrInstGen *ir_resolve_result(IrAnalyze *ira, IrInst *suspend_source_instr |
| 18706 | ZigValue *struct_val = const_ptr_pointee(ira, ira->codegen, ptr_val, | 18673 | ZigValue *struct_val = const_ptr_pointee(ira, ira->codegen, ptr_val, |
| 18707 | suspend_source_instr->source_node); | 18674 | suspend_source_instr->source_node); |
| 18708 | struct_val->special = ConstValSpecialStatic; | 18675 | struct_val->special = ConstValSpecialStatic; |
| 18709 | struct_val->data.x_struct.fields = realloc_const_vals_ptrs(struct_val->data.x_struct.fields, | 18676 | struct_val->data.x_struct.fields = realloc_const_vals_ptrs(ira->codegen, |
| 18710 | old_field_count, new_field_count); | 18677 | struct_val->data.x_struct.fields, old_field_count, new_field_count); |
| 18711 | | 18678 | |
| 18712 | ZigValue *field_val = struct_val->data.x_struct.fields[old_field_count]; | 18679 | ZigValue *field_val = struct_val->data.x_struct.fields[old_field_count]; |
| 18713 | field_val->special = ConstValSpecialUndef; | 18680 | field_val->special = ConstValSpecialUndef; |
| ... | @@ -19007,10 +18974,10 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod | ... | @@ -19007,10 +18974,10 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod |
| 19007 | if (!arg_val) | 18974 | if (!arg_val) |
| 19008 | return false; | 18975 | return false; |
| 19009 | } else { | 18976 | } else { |
| 19010 | arg_val = create_const_runtime(casted_arg->value->type); | 18977 | arg_val = create_const_runtime(ira->codegen, casted_arg->value->type); |
| 19011 | } | 18978 | } |
| 19012 | if (arg_part_of_generic_id) { | 18979 | if (arg_part_of_generic_id) { |
| 19013 | copy_const_val(&generic_id->params[generic_id->param_count], arg_val); | 18980 | copy_const_val(ira->codegen, &generic_id->params[generic_id->param_count], arg_val); |
| 19014 | generic_id->param_count += 1; | 18981 | generic_id->param_count += 1; |
| 19015 | } | 18982 | } |
| 19016 | | 18983 | |
| ... | @@ -19159,7 +19126,7 @@ static IrInstGen *ir_analyze_store_ptr(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -19159,7 +19126,7 @@ static IrInstGen *ir_analyze_store_ptr(IrAnalyze *ira, IrInst* source_instr, |
| 19159 | if (dest_val == nullptr) | 19126 | if (dest_val == nullptr) |
| 19160 | return ira->codegen->invalid_inst_gen; | 19127 | return ira->codegen->invalid_inst_gen; |
| 19161 | if (dest_val->special != ConstValSpecialRuntime) { | 19128 | if (dest_val->special != ConstValSpecialRuntime) { |
| 19162 | copy_const_val(dest_val, value->value); | 19129 | copy_const_val(ira->codegen, dest_val, value->value); |
| 19163 | | 19130 | |
| 19164 | if (ptr->value->data.x_ptr.mut == ConstPtrMutComptimeVar && | 19131 | if (ptr->value->data.x_ptr.mut == ConstPtrMutComptimeVar && |
| 19165 | !ira->new_irb.current_basic_block->must_be_comptime_source_instr) | 19132 | !ira->new_irb.current_basic_block->must_be_comptime_source_instr) |
| ... | @@ -19394,8 +19361,6 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -19394,8 +19361,6 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 19394 | { | 19361 | { |
| 19395 | return ira->codegen->invalid_inst_gen; | 19362 | return ira->codegen->invalid_inst_gen; |
| 19396 | } | 19363 | } |
| 19397 | destroy(result_ptr, "ZigValue"); | | |
| 19398 | result_ptr = nullptr; | | |
| 19399 | | 19364 | |
| 19400 | if (inferred_err_set_type != nullptr) { | 19365 | if (inferred_err_set_type != nullptr) { |
| 19401 | inferred_err_set_type->data.error_set.incomplete = false; | 19366 | inferred_err_set_type->data.error_set.incomplete = false; |
| ... | @@ -19403,7 +19368,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -19403,7 +19368,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 19403 | ErrorTableEntry *err = result->data.x_err_union.error_set->data.x_err_set; | 19368 | ErrorTableEntry *err = result->data.x_err_union.error_set->data.x_err_set; |
| 19404 | if (err != nullptr) { | 19369 | if (err != nullptr) { |
| 19405 | inferred_err_set_type->data.error_set.err_count = 1; | 19370 | inferred_err_set_type->data.error_set.err_count = 1; |
| 19406 | inferred_err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(1); | 19371 | inferred_err_set_type->data.error_set.errors = heap::c_allocator.create<ErrorTableEntry *>(); |
| 19407 | inferred_err_set_type->data.error_set.errors[0] = err; | 19372 | inferred_err_set_type->data.error_set.errors[0] = err; |
| 19408 | } | 19373 | } |
| 19409 | ZigType *fn_inferred_err_set_type = result->type->data.error_union.err_set_type; | 19374 | ZigType *fn_inferred_err_set_type = result->type->data.error_union.err_set_type; |
| ... | @@ -19437,12 +19402,12 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -19437,12 +19402,12 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 19437 | | 19402 | |
| 19438 | size_t new_fn_arg_count = first_arg_1_or_0 + args_len; | 19403 | size_t new_fn_arg_count = first_arg_1_or_0 + args_len; |
| 19439 | | 19404 | |
| 19440 | IrInstGen **casted_args = allocate<IrInstGen *>(new_fn_arg_count); | 19405 | IrInstGen **casted_args = heap::c_allocator.allocate<IrInstGen *>(new_fn_arg_count); |
| 19441 | | 19406 | |
| 19442 | // Fork a scope of the function with known values for the parameters. | 19407 | // Fork a scope of the function with known values for the parameters. |
| 19443 | Scope *parent_scope = fn_entry->fndef_scope->base.parent; | 19408 | Scope *parent_scope = fn_entry->fndef_scope->base.parent; |
| 19444 | ZigFn *impl_fn = create_fn(ira->codegen, fn_proto_node); | 19409 | ZigFn *impl_fn = create_fn(ira->codegen, fn_proto_node); |
| 19445 | impl_fn->param_source_nodes = allocate<AstNode *>(new_fn_arg_count); | 19410 | impl_fn->param_source_nodes = heap::c_allocator.allocate<AstNode *>(new_fn_arg_count); |
| 19446 | buf_init_from_buf(&impl_fn->symbol_name, &fn_entry->symbol_name); | 19411 | buf_init_from_buf(&impl_fn->symbol_name, &fn_entry->symbol_name); |
| 19447 | impl_fn->fndef_scope = create_fndef_scope(ira->codegen, impl_fn->body_node, parent_scope, impl_fn); | 19412 | impl_fn->fndef_scope = create_fndef_scope(ira->codegen, impl_fn->body_node, parent_scope, impl_fn); |
| 19448 | impl_fn->child_scope = &impl_fn->fndef_scope->base; | 19413 | impl_fn->child_scope = &impl_fn->fndef_scope->base; |
| ... | @@ -19453,10 +19418,10 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -19453,10 +19418,10 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 19453 | | 19418 | |
| 19454 | // TODO maybe GenericFnTypeId can be replaced with using the child_scope directly | 19419 | // TODO maybe GenericFnTypeId can be replaced with using the child_scope directly |
| 19455 | // as the key in generic_table | 19420 | // as the key in generic_table |
| 19456 | GenericFnTypeId *generic_id = allocate<GenericFnTypeId>(1); | 19421 | GenericFnTypeId *generic_id = heap::c_allocator.create<GenericFnTypeId>(); |
| 19457 | generic_id->fn_entry = fn_entry; | 19422 | generic_id->fn_entry = fn_entry; |
| 19458 | generic_id->param_count = 0; | 19423 | generic_id->param_count = 0; |
| 19459 | generic_id->params = create_const_vals(new_fn_arg_count); | 19424 | generic_id->params = ira->codegen->pass1_arena->allocate<ZigValue>(new_fn_arg_count); |
| 19460 | size_t next_proto_i = 0; | 19425 | size_t next_proto_i = 0; |
| 19461 | | 19426 | |
| 19462 | if (first_arg_ptr) { | 19427 | if (first_arg_ptr) { |
| ... | @@ -19516,7 +19481,6 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -19516,7 +19481,6 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 19516 | IrInstGenConst *const_instruction = ir_create_inst_noval<IrInstGenConst>(&ira->new_irb, | 19481 | IrInstGenConst *const_instruction = ir_create_inst_noval<IrInstGenConst>(&ira->new_irb, |
| 19517 | impl_fn->child_scope, fn_proto_node->data.fn_proto.align_expr); | 19482 | impl_fn->child_scope, fn_proto_node->data.fn_proto.align_expr); |
| 19518 | const_instruction->base.value = align_result; | 19483 | const_instruction->base.value = align_result; |
| 19519 | destroy(result_ptr, "ZigValue"); | | |
| 19520 | | 19484 | |
| 19521 | uint32_t align_bytes = 0; | 19485 | uint32_t align_bytes = 0; |
| 19522 | ir_resolve_align(ira, &const_instruction->base, nullptr, &align_bytes); | 19486 | ir_resolve_align(ira, &const_instruction->base, nullptr, &align_bytes); |
| ... | @@ -19649,7 +19613,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, | ... | @@ -19649,7 +19613,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, |
| 19649 | } | 19613 | } |
| 19650 | | 19614 | |
| 19651 | | 19615 | |
| 19652 | IrInstGen **casted_args = allocate<IrInstGen *>(call_param_count); | 19616 | IrInstGen **casted_args = heap::c_allocator.allocate<IrInstGen *>(call_param_count); |
| 19653 | size_t next_arg_index = 0; | 19617 | size_t next_arg_index = 0; |
| 19654 | if (first_arg_ptr) { | 19618 | if (first_arg_ptr) { |
| 19655 | assert(first_arg_ptr->value->type->id == ZigTypeIdPointer); | 19619 | assert(first_arg_ptr->value->type->id == ZigTypeIdPointer); |
| ... | @@ -19781,7 +19745,7 @@ static IrInstGen *ir_analyze_fn_call_src(IrAnalyze *ira, IrInstSrcCall *call_ins | ... | @@ -19781,7 +19745,7 @@ static IrInstGen *ir_analyze_fn_call_src(IrAnalyze *ira, IrInstSrcCall *call_ins |
| 19781 | return ira->codegen->invalid_inst_gen; | 19745 | return ira->codegen->invalid_inst_gen; |
| 19782 | new_stack_src = &call_instruction->new_stack->base; | 19746 | new_stack_src = &call_instruction->new_stack->base; |
| 19783 | } | 19747 | } |
| 19784 | IrInstGen **args_ptr = allocate<IrInstGen *>(call_instruction->arg_count, "IrInstGen *"); | 19748 | IrInstGen **args_ptr = heap::c_allocator.allocate<IrInstGen *>(call_instruction->arg_count); |
| 19785 | for (size_t i = 0; i < call_instruction->arg_count; i += 1) { | 19749 | for (size_t i = 0; i < call_instruction->arg_count; i += 1) { |
| 19786 | args_ptr[i] = call_instruction->args[i]->child; | 19750 | args_ptr[i] = call_instruction->args[i]->child; |
| 19787 | if (type_is_invalid(args_ptr[i]->value->type)) | 19751 | if (type_is_invalid(args_ptr[i]->value->type)) |
| ... | @@ -19797,7 +19761,7 @@ static IrInstGen *ir_analyze_fn_call_src(IrAnalyze *ira, IrInstSrcCall *call_ins | ... | @@ -19797,7 +19761,7 @@ static IrInstGen *ir_analyze_fn_call_src(IrAnalyze *ira, IrInstSrcCall *call_ins |
| 19797 | first_arg_ptr, first_arg_ptr_src, modifier, new_stack, new_stack_src, | 19761 | first_arg_ptr, first_arg_ptr_src, modifier, new_stack, new_stack_src, |
| 19798 | call_instruction->is_async_call_builtin, args_ptr, call_instruction->arg_count, ret_ptr, | 19762 | call_instruction->is_async_call_builtin, args_ptr, call_instruction->arg_count, ret_ptr, |
| 19799 | call_instruction->result_loc); | 19763 | call_instruction->result_loc); |
| 19800 | deallocate(args_ptr, call_instruction->arg_count, "IrInstGen *"); | 19764 | heap::c_allocator.deallocate(args_ptr, call_instruction->arg_count); |
| 19801 | return result; | 19765 | return result; |
| 19802 | } | 19766 | } |
| 19803 | | 19767 | |
| ... | @@ -19917,7 +19881,7 @@ static IrInstGen *ir_analyze_instruction_call_extra(IrAnalyze *ira, IrInstSrcCal | ... | @@ -19917,7 +19881,7 @@ static IrInstGen *ir_analyze_instruction_call_extra(IrAnalyze *ira, IrInstSrcCal |
| 19917 | | 19881 | |
| 19918 | if (is_tuple(args_type)) { | 19882 | if (is_tuple(args_type)) { |
| 19919 | args_len = args_type->data.structure.src_field_count; | 19883 | args_len = args_type->data.structure.src_field_count; |
| 19920 | args_ptr = allocate<IrInstGen *>(args_len, "IrInstGen *"); | 19884 | args_ptr = heap::c_allocator.allocate<IrInstGen *>(args_len); |
| 19921 | for (size_t i = 0; i < args_len; i += 1) { | 19885 | for (size_t i = 0; i < args_len; i += 1) { |
| 19922 | TypeStructField *arg_field = args_type->data.structure.fields[i]; | 19886 | TypeStructField *arg_field = args_type->data.structure.fields[i]; |
| 19923 | args_ptr[i] = ir_analyze_struct_value_field_value(ira, &instruction->base.base, args, arg_field); | 19887 | args_ptr[i] = ir_analyze_struct_value_field_value(ira, &instruction->base.base, args, arg_field); |
| ... | @@ -19930,12 +19894,12 @@ static IrInstGen *ir_analyze_instruction_call_extra(IrAnalyze *ira, IrInstSrcCal | ... | @@ -19930,12 +19894,12 @@ static IrInstGen *ir_analyze_instruction_call_extra(IrAnalyze *ira, IrInstSrcCal |
| 19930 | } | 19894 | } |
| 19931 | IrInstGen *result = ir_analyze_call_extra(ira, &instruction->base.base, instruction->options, | 19895 | IrInstGen *result = ir_analyze_call_extra(ira, &instruction->base.base, instruction->options, |
| 19932 | instruction->fn_ref, args_ptr, args_len, instruction->result_loc); | 19896 | instruction->fn_ref, args_ptr, args_len, instruction->result_loc); |
| 19933 | deallocate(args_ptr, args_len, "IrInstGen *"); | 19897 | heap::c_allocator.deallocate(args_ptr, args_len); |
| 19934 | return result; | 19898 | return result; |
| 19935 | } | 19899 | } |
| 19936 | | 19900 | |
| 19937 | static IrInstGen *ir_analyze_instruction_call_args(IrAnalyze *ira, IrInstSrcCallArgs *instruction) { | 19901 | static IrInstGen *ir_analyze_instruction_call_args(IrAnalyze *ira, IrInstSrcCallArgs *instruction) { |
| 19938 | IrInstGen **args_ptr = allocate<IrInstGen *>(instruction->args_len, "IrInstGen *"); | 19902 | IrInstGen **args_ptr = heap::c_allocator.allocate<IrInstGen *>(instruction->args_len); |
| 19939 | for (size_t i = 0; i < instruction->args_len; i += 1) { | 19903 | for (size_t i = 0; i < instruction->args_len; i += 1) { |
| 19940 | args_ptr[i] = instruction->args_ptr[i]->child; | 19904 | args_ptr[i] = instruction->args_ptr[i]->child; |
| 19941 | if (type_is_invalid(args_ptr[i]->value->type)) | 19905 | if (type_is_invalid(args_ptr[i]->value->type)) |
| ... | @@ -19944,7 +19908,7 @@ static IrInstGen *ir_analyze_instruction_call_args(IrAnalyze *ira, IrInstSrcCall | ... | @@ -19944,7 +19908,7 @@ static IrInstGen *ir_analyze_instruction_call_args(IrAnalyze *ira, IrInstSrcCall |
| 19944 | | 19908 | |
| 19945 | IrInstGen *result = ir_analyze_call_extra(ira, &instruction->base.base, instruction->options, | 19909 | IrInstGen *result = ir_analyze_call_extra(ira, &instruction->base.base, instruction->options, |
| 19946 | instruction->fn_ref, args_ptr, instruction->args_len, instruction->result_loc); | 19910 | instruction->fn_ref, args_ptr, instruction->args_len, instruction->result_loc); |
| 19947 | deallocate(args_ptr, instruction->args_len, "IrInstGen *"); | 19911 | heap::c_allocator.deallocate(args_ptr, instruction->args_len); |
| 19948 | return result; | 19912 | return result; |
| 19949 | } | 19913 | } |
| 19950 | | 19914 | |
| ... | @@ -20019,7 +19983,7 @@ static Error ir_read_const_ptr(IrAnalyze *ira, CodeGen *codegen, AstNode *source | ... | @@ -20019,7 +19983,7 @@ static Error ir_read_const_ptr(IrAnalyze *ira, CodeGen *codegen, AstNode *source |
| 20019 | | 19983 | |
| 20020 | if (dst_size <= src_size) { | 19984 | if (dst_size <= src_size) { |
| 20021 | if (src_size == dst_size && types_have_same_zig_comptime_repr(codegen, out_val->type, pointee->type)) { | 19985 | if (src_size == dst_size && types_have_same_zig_comptime_repr(codegen, out_val->type, pointee->type)) { |
| 20022 | copy_const_val(out_val, pointee); | 19986 | copy_const_val(codegen, out_val, pointee); |
| 20023 | return ErrorNone; | 19987 | return ErrorNone; |
| 20024 | } | 19988 | } |
| 20025 | Buf buf = BUF_INIT; | 19989 | Buf buf = BUF_INIT; |
| ... | @@ -20087,7 +20051,7 @@ static IrInstGen *ir_analyze_optional_type(IrAnalyze *ira, IrInstSrcUnOp *instru | ... | @@ -20087,7 +20051,7 @@ static IrInstGen *ir_analyze_optional_type(IrAnalyze *ira, IrInstSrcUnOp *instru |
| 20087 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); | 20051 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); |
| 20088 | result->value->special = ConstValSpecialLazy; | 20052 | result->value->special = ConstValSpecialLazy; |
| 20089 | | 20053 | |
| 20090 | LazyValueOptType *lazy_opt_type = allocate<LazyValueOptType>(1, "LazyValueOptType"); | 20054 | LazyValueOptType *lazy_opt_type = heap::c_allocator.create<LazyValueOptType>(); |
| 20091 | lazy_opt_type->ira = ira; ira_ref(ira); | 20055 | lazy_opt_type->ira = ira; ira_ref(ira); |
| 20092 | result->value->data.x_lazy = &lazy_opt_type->base; | 20056 | result->value->data.x_lazy = &lazy_opt_type->base; |
| 20093 | lazy_opt_type->base.id = LazyValueIdOptType; | 20057 | lazy_opt_type->base.id = LazyValueIdOptType; |
| ... | @@ -20371,7 +20335,7 @@ static IrInstGen *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstSrcPhi *phi_i | ... | @@ -20371,7 +20335,7 @@ static IrInstGen *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstSrcPhi *phi_i |
| 20371 | | 20335 | |
| 20372 | if (value->value->special != ConstValSpecialRuntime) { | 20336 | if (value->value->special != ConstValSpecialRuntime) { |
| 20373 | IrInstGen *result = ir_const(ira, &phi_instruction->base.base, nullptr); | 20337 | IrInstGen *result = ir_const(ira, &phi_instruction->base.base, nullptr); |
| 20374 | copy_const_val(result->value, value->value); | 20338 | copy_const_val(ira->codegen, result->value, value->value); |
| 20375 | return result; | 20339 | return result; |
| 20376 | } else { | 20340 | } else { |
| 20377 | return value; | 20341 | return value; |
| ... | @@ -20385,7 +20349,7 @@ static IrInstGen *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstSrcPhi *phi_i | ... | @@ -20385,7 +20349,7 @@ static IrInstGen *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstSrcPhi *phi_i |
| 20385 | peer_parent->peers.length >= 2) | 20349 | peer_parent->peers.length >= 2) |
| 20386 | { | 20350 | { |
| 20387 | if (peer_parent->resolved_type == nullptr) { | 20351 | if (peer_parent->resolved_type == nullptr) { |
| 20388 | IrInstGen **instructions = allocate<IrInstGen *>(peer_parent->peers.length); | 20352 | IrInstGen **instructions = heap::c_allocator.allocate<IrInstGen *>(peer_parent->peers.length); |
| 20389 | for (size_t i = 0; i < peer_parent->peers.length; i += 1) { | 20353 | for (size_t i = 0; i < peer_parent->peers.length; i += 1) { |
| 20390 | ResultLocPeer *this_peer = peer_parent->peers.at(i); | 20354 | ResultLocPeer *this_peer = peer_parent->peers.at(i); |
| 20391 | | 20355 | |
| ... | @@ -20758,7 +20722,7 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP | ... | @@ -20758,7 +20722,7 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP |
| 20758 | if (index == array_len && array_type->data.array.sentinel != nullptr) { | 20722 | if (index == array_len && array_type->data.array.sentinel != nullptr) { |
| 20759 | ZigType *elem_type = array_type->data.array.child_type; | 20723 | ZigType *elem_type = array_type->data.array.child_type; |
| 20760 | IrInstGen *sentinel_elem = ir_const(ira, &elem_ptr_instruction->base.base, elem_type); | 20724 | IrInstGen *sentinel_elem = ir_const(ira, &elem_ptr_instruction->base.base, elem_type); |
| 20761 | copy_const_val(sentinel_elem->value, array_type->data.array.sentinel); | 20725 | copy_const_val(ira->codegen, sentinel_elem->value, array_type->data.array.sentinel); |
| 20762 | return ir_get_ref(ira, &elem_ptr_instruction->base.base, sentinel_elem, true, false); | 20726 | return ir_get_ref(ira, &elem_ptr_instruction->base.base, sentinel_elem, true, false); |
| 20763 | } | 20727 | } |
| 20764 | if (index >= array_len) { | 20728 | if (index >= array_len) { |
| ... | @@ -20822,7 +20786,7 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP | ... | @@ -20822,7 +20786,7 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP |
| 20822 | { | 20786 | { |
| 20823 | if (array_type->id == ZigTypeIdArray || array_type->id == ZigTypeIdVector) { | 20787 | if (array_type->id == ZigTypeIdArray || array_type->id == ZigTypeIdVector) { |
| 20824 | array_ptr_val->data.x_array.special = ConstArraySpecialNone; | 20788 | array_ptr_val->data.x_array.special = ConstArraySpecialNone; |
| 20825 | array_ptr_val->data.x_array.data.s_none.elements = create_const_vals(array_type->data.array.len); | 20789 | array_ptr_val->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(array_type->data.array.len); |
| 20826 | array_ptr_val->special = ConstValSpecialStatic; | 20790 | array_ptr_val->special = ConstValSpecialStatic; |
| 20827 | for (size_t i = 0; i < array_type->data.array.len; i += 1) { | 20791 | for (size_t i = 0; i < array_type->data.array.len; i += 1) { |
| 20828 | ZigValue *elem_val = &array_ptr_val->data.x_array.data.s_none.elements[i]; | 20792 | ZigValue *elem_val = &array_ptr_val->data.x_array.data.s_none.elements[i]; |
| ... | @@ -20845,11 +20809,11 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP | ... | @@ -20845,11 +20809,11 @@ static IrInstGen *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstSrcElemP |
| 20845 | return ira->codegen->invalid_inst_gen; | 20809 | return ira->codegen->invalid_inst_gen; |
| 20846 | } | 20810 | } |
| 20847 | | 20811 | |
| 20848 | ZigValue *array_init_val = create_const_vals(1); | 20812 | ZigValue *array_init_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 20849 | array_init_val->special = ConstValSpecialStatic; | 20813 | array_init_val->special = ConstValSpecialStatic; |
| 20850 | array_init_val->type = actual_array_type; | 20814 | array_init_val->type = actual_array_type; |
| 20851 | array_init_val->data.x_array.special = ConstArraySpecialNone; | 20815 | array_init_val->data.x_array.special = ConstArraySpecialNone; |
| 20852 | array_init_val->data.x_array.data.s_none.elements = create_const_vals(actual_array_type->data.array.len); | 20816 | array_init_val->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(actual_array_type->data.array.len); |
| 20853 | array_init_val->special = ConstValSpecialStatic; | 20817 | array_init_val->special = ConstValSpecialStatic; |
| 20854 | for (size_t i = 0; i < actual_array_type->data.array.len; i += 1) { | 20818 | for (size_t i = 0; i < actual_array_type->data.array.len; i += 1) { |
| 20855 | ZigValue *elem_val = &array_init_val->data.x_array.data.s_none.elements[i]; | 20819 | ZigValue *elem_val = &array_init_val->data.x_array.data.s_none.elements[i]; |
| ... | @@ -21175,7 +21139,7 @@ static IrInstGen *ir_analyze_struct_field_ptr(IrAnalyze *ira, IrInst* source_ins | ... | @@ -21175,7 +21139,7 @@ static IrInstGen *ir_analyze_struct_field_ptr(IrAnalyze *ira, IrInst* source_ins |
| 21175 | if (field->is_comptime) { | 21139 | if (field->is_comptime) { |
| 21176 | IrInstGen *elem = ir_const(ira, source_instr, field_type); | 21140 | IrInstGen *elem = ir_const(ira, source_instr, field_type); |
| 21177 | memoize_field_init_val(ira->codegen, struct_type, field); | 21141 | memoize_field_init_val(ira->codegen, struct_type, field); |
| 21178 | copy_const_val(elem->value, field->init_val); | 21142 | copy_const_val(ira->codegen, elem->value, field->init_val); |
| 21179 | return ir_get_ref2(ira, source_instr, elem, field_type, true, false); | 21143 | return ir_get_ref2(ira, source_instr, elem, field_type, true, false); |
| 21180 | } | 21144 | } |
| 21181 | switch (type_has_one_possible_value(ira->codegen, field_type)) { | 21145 | switch (type_has_one_possible_value(ira->codegen, field_type)) { |
| ... | @@ -21223,7 +21187,7 @@ static IrInstGen *ir_analyze_struct_field_ptr(IrAnalyze *ira, IrInst* source_ins | ... | @@ -21223,7 +21187,7 @@ static IrInstGen *ir_analyze_struct_field_ptr(IrAnalyze *ira, IrInst* source_ins |
| 21223 | if (type_is_invalid(struct_val->type)) | 21187 | if (type_is_invalid(struct_val->type)) |
| 21224 | return ira->codegen->invalid_inst_gen; | 21188 | return ira->codegen->invalid_inst_gen; |
| 21225 | if (initializing && struct_val->special == ConstValSpecialUndef) { | 21189 | if (initializing && struct_val->special == ConstValSpecialUndef) { |
| 21226 | struct_val->data.x_struct.fields = alloc_const_vals_ptrs(struct_type->data.structure.src_field_count); | 21190 | struct_val->data.x_struct.fields = alloc_const_vals_ptrs(ira->codegen, struct_type->data.structure.src_field_count); |
| 21227 | struct_val->special = ConstValSpecialStatic; | 21191 | struct_val->special = ConstValSpecialStatic; |
| 21228 | for (size_t i = 0; i < struct_type->data.structure.src_field_count; i += 1) { | 21192 | for (size_t i = 0; i < struct_type->data.structure.src_field_count; i += 1) { |
| 21229 | ZigValue *field_val = struct_val->data.x_struct.fields[i]; | 21193 | ZigValue *field_val = struct_val->data.x_struct.fields[i]; |
| ... | @@ -21265,7 +21229,7 @@ static IrInstGen *ir_analyze_inferred_field_ptr(IrAnalyze *ira, Buf *field_name, | ... | @@ -21265,7 +21229,7 @@ static IrInstGen *ir_analyze_inferred_field_ptr(IrAnalyze *ira, Buf *field_name, |
| 21265 | ZigType *container_ptr_type = container_ptr->value->type; | 21229 | ZigType *container_ptr_type = container_ptr->value->type; |
| 21266 | ir_assert(container_ptr_type->id == ZigTypeIdPointer, source_instr); | 21230 | ir_assert(container_ptr_type->id == ZigTypeIdPointer, source_instr); |
| 21267 | | 21231 | |
| 21268 | InferredStructField *inferred_struct_field = allocate<InferredStructField>(1, "InferredStructField"); | 21232 | InferredStructField *inferred_struct_field = heap::c_allocator.create<InferredStructField>(); |
| 21269 | inferred_struct_field->inferred_struct_type = container_type; | 21233 | inferred_struct_field->inferred_struct_type = container_type; |
| 21270 | inferred_struct_field->field_name = field_name; | 21234 | inferred_struct_field->field_name = field_name; |
| 21271 | | 21235 | |
| ... | @@ -21285,7 +21249,7 @@ static IrInstGen *ir_analyze_inferred_field_ptr(IrAnalyze *ira, Buf *field_name, | ... | @@ -21285,7 +21249,7 @@ static IrInstGen *ir_analyze_inferred_field_ptr(IrAnalyze *ira, Buf *field_name, |
| 21285 | } else { | 21249 | } else { |
| 21286 | result = ir_const(ira, source_instr, field_ptr_type); | 21250 | result = ir_const(ira, source_instr, field_ptr_type); |
| 21287 | } | 21251 | } |
| 21288 | copy_const_val(result->value, ptr_val); | 21252 | copy_const_val(ira->codegen, result->value, ptr_val); |
| 21289 | result->value->type = field_ptr_type; | 21253 | result->value->type = field_ptr_type; |
| 21290 | return result; | 21254 | return result; |
| 21291 | } | 21255 | } |
| ... | @@ -21356,7 +21320,7 @@ static IrInstGen *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_name | ... | @@ -21356,7 +21320,7 @@ static IrInstGen *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_name |
| 21356 | return ira->codegen->invalid_inst_gen; | 21320 | return ira->codegen->invalid_inst_gen; |
| 21357 | | 21321 | |
| 21358 | if (initializing) { | 21322 | if (initializing) { |
| 21359 | ZigValue *payload_val = create_const_vals(1); | 21323 | ZigValue *payload_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 21360 | payload_val->special = ConstValSpecialUndef; | 21324 | payload_val->special = ConstValSpecialUndef; |
| 21361 | payload_val->type = field_type; | 21325 | payload_val->type = field_type; |
| 21362 | payload_val->parent.id = ConstParentIdUnion; | 21326 | payload_val->parent.id = ConstParentIdUnion; |
| ... | @@ -21539,7 +21503,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21539,7 +21503,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21539 | } | 21503 | } |
| 21540 | } else if (is_array_ref(container_type) && !field_ptr_instruction->initializing) { | 21504 | } else if (is_array_ref(container_type) && !field_ptr_instruction->initializing) { |
| 21541 | if (buf_eql_str(field_name, "len")) { | 21505 | if (buf_eql_str(field_name, "len")) { |
| 21542 | ZigValue *len_val = create_const_vals(1); | 21506 | ZigValue *len_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 21543 | if (container_type->id == ZigTypeIdPointer) { | 21507 | if (container_type->id == ZigTypeIdPointer) { |
| 21544 | init_const_usize(ira->codegen, len_val, container_type->data.pointer.child_type->data.array.len); | 21508 | init_const_usize(ira->codegen, len_val, container_type->data.pointer.child_type->data.array.len); |
| 21545 | } else { | 21509 | } else { |
| ... | @@ -21585,7 +21549,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21585,7 +21549,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21585 | bool ptr_is_const = true; | 21549 | bool ptr_is_const = true; |
| 21586 | bool ptr_is_volatile = false; | 21550 | bool ptr_is_volatile = false; |
| 21587 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, | 21551 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, |
| 21588 | create_const_enum(child_type, &field->value), child_type, | 21552 | create_const_enum(ira->codegen, child_type, &field->value), child_type, |
| 21589 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); | 21553 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); |
| 21590 | } | 21554 | } |
| 21591 | } | 21555 | } |
| ... | @@ -21614,7 +21578,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21614,7 +21578,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21614 | bool ptr_is_const = true; | 21578 | bool ptr_is_const = true; |
| 21615 | bool ptr_is_volatile = false; | 21579 | bool ptr_is_volatile = false; |
| 21616 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, | 21580 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, |
| 21617 | create_const_enum(enum_type, &field->enum_field->value), enum_type, | 21581 | create_const_enum(ira->codegen, enum_type, &field->enum_field->value), enum_type, |
| 21618 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); | 21582 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); |
| 21619 | } | 21583 | } |
| 21620 | } | 21584 | } |
| ... | @@ -21632,7 +21596,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21632,7 +21596,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21632 | if (existing_entry) { | 21596 | if (existing_entry) { |
| 21633 | err_entry = existing_entry->value; | 21597 | err_entry = existing_entry->value; |
| 21634 | } else { | 21598 | } else { |
| 21635 | err_entry = allocate<ErrorTableEntry>(1); | 21599 | err_entry = heap::c_allocator.create<ErrorTableEntry>(); |
| 21636 | err_entry->decl_node = field_ptr_instruction->base.base.source_node; | 21600 | err_entry->decl_node = field_ptr_instruction->base.base.source_node; |
| 21637 | buf_init_from_buf(&err_entry->name, field_name); | 21601 | buf_init_from_buf(&err_entry->name, field_name); |
| 21638 | size_t error_value_count = ira->codegen->errors_by_index.length; | 21602 | size_t error_value_count = ira->codegen->errors_by_index.length; |
| ... | @@ -21659,7 +21623,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21659,7 +21623,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21659 | } | 21623 | } |
| 21660 | err_set_type = child_type; | 21624 | err_set_type = child_type; |
| 21661 | } | 21625 | } |
| 21662 | ZigValue *const_val = create_const_vals(1); | 21626 | ZigValue *const_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 21663 | const_val->special = ConstValSpecialStatic; | 21627 | const_val->special = ConstValSpecialStatic; |
| 21664 | const_val->type = err_set_type; | 21628 | const_val->type = err_set_type; |
| 21665 | const_val->data.x_err_set = err_entry; | 21629 | const_val->data.x_err_set = err_entry; |
| ... | @@ -21673,7 +21637,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21673,7 +21637,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21673 | bool ptr_is_const = true; | 21637 | bool ptr_is_const = true; |
| 21674 | bool ptr_is_volatile = false; | 21638 | bool ptr_is_volatile = false; |
| 21675 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, | 21639 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, |
| 21676 | create_const_unsigned_negative(ira->codegen->builtin_types.entry_num_lit_int, | 21640 | create_const_unsigned_negative(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int, |
| 21677 | child_type->data.integral.bit_count, false), | 21641 | child_type->data.integral.bit_count, false), |
| 21678 | ira->codegen->builtin_types.entry_num_lit_int, | 21642 | ira->codegen->builtin_types.entry_num_lit_int, |
| 21679 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); | 21643 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); |
| ... | @@ -21695,7 +21659,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21695,7 +21659,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21695 | bool ptr_is_const = true; | 21659 | bool ptr_is_const = true; |
| 21696 | bool ptr_is_volatile = false; | 21660 | bool ptr_is_volatile = false; |
| 21697 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, | 21661 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, |
| 21698 | create_const_unsigned_negative(ira->codegen->builtin_types.entry_num_lit_int, | 21662 | create_const_unsigned_negative(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int, |
| 21699 | child_type->data.floating.bit_count, false), | 21663 | child_type->data.floating.bit_count, false), |
| 21700 | ira->codegen->builtin_types.entry_num_lit_int, | 21664 | ira->codegen->builtin_types.entry_num_lit_int, |
| 21701 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); | 21665 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); |
| ... | @@ -21722,7 +21686,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21722,7 +21686,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21722 | return ira->codegen->invalid_inst_gen; | 21686 | return ira->codegen->invalid_inst_gen; |
| 21723 | } | 21687 | } |
| 21724 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, | 21688 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, |
| 21725 | create_const_unsigned_negative(ira->codegen->builtin_types.entry_num_lit_int, | 21689 | create_const_unsigned_negative(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int, |
| 21726 | get_ptr_align(ira->codegen, child_type), false), | 21690 | get_ptr_align(ira->codegen, child_type), false), |
| 21727 | ira->codegen->builtin_types.entry_num_lit_int, | 21691 | ira->codegen->builtin_types.entry_num_lit_int, |
| 21728 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); | 21692 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); |
| ... | @@ -21744,7 +21708,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel | ... | @@ -21744,7 +21708,7 @@ static IrInstGen *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstSrcFiel |
| 21744 | bool ptr_is_const = true; | 21708 | bool ptr_is_const = true; |
| 21745 | bool ptr_is_volatile = false; | 21709 | bool ptr_is_volatile = false; |
| 21746 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, | 21710 | return ir_get_const_ptr(ira, &field_ptr_instruction->base.base, |
| 21747 | create_const_unsigned_negative(ira->codegen->builtin_types.entry_num_lit_int, | 21711 | create_const_unsigned_negative(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int, |
| 21748 | child_type->data.array.len, false), | 21712 | child_type->data.array.len, false), |
| 21749 | ira->codegen->builtin_types.entry_num_lit_int, | 21713 | ira->codegen->builtin_types.entry_num_lit_int, |
| 21750 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); | 21714 | ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile, 0); |
| ... | @@ -22024,7 +21988,7 @@ static IrInstGen *ir_analyze_instruction_slice_type(IrAnalyze *ira, IrInstSrcSli | ... | @@ -22024,7 +21988,7 @@ static IrInstGen *ir_analyze_instruction_slice_type(IrAnalyze *ira, IrInstSrcSli |
| 22024 | IrInstGen *result = ir_const(ira, &slice_type_instruction->base.base, ira->codegen->builtin_types.entry_type); | 21988 | IrInstGen *result = ir_const(ira, &slice_type_instruction->base.base, ira->codegen->builtin_types.entry_type); |
| 22025 | result->value->special = ConstValSpecialLazy; | 21989 | result->value->special = ConstValSpecialLazy; |
| 22026 | | 21990 | |
| 22027 | LazyValueSliceType *lazy_slice_type = allocate<LazyValueSliceType>(1, "LazyValueSliceType"); | 21991 | LazyValueSliceType *lazy_slice_type = heap::c_allocator.create<LazyValueSliceType>(); |
| 22028 | lazy_slice_type->ira = ira; ira_ref(ira); | 21992 | lazy_slice_type->ira = ira; ira_ref(ira); |
| 22029 | result->value->data.x_lazy = &lazy_slice_type->base; | 21993 | result->value->data.x_lazy = &lazy_slice_type->base; |
| 22030 | lazy_slice_type->base.id = LazyValueIdSliceType; | 21994 | lazy_slice_type->base.id = LazyValueIdSliceType; |
| ... | @@ -22097,8 +22061,8 @@ static IrInstGen *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstSrcAsm *asm_i | ... | @@ -22097,8 +22061,8 @@ static IrInstGen *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstSrcAsm *asm_i |
| 22097 | | 22061 | |
| 22098 | // TODO validate the output types and variable types | 22062 | // TODO validate the output types and variable types |
| 22099 | | 22063 | |
| 22100 | IrInstGen **input_list = allocate<IrInstGen *>(asm_expr->input_list.length); | 22064 | IrInstGen **input_list = heap::c_allocator.allocate<IrInstGen *>(asm_expr->input_list.length); |
| 22101 | IrInstGen **output_types = allocate<IrInstGen *>(asm_expr->output_list.length); | 22065 | IrInstGen **output_types = heap::c_allocator.allocate<IrInstGen *>(asm_expr->output_list.length); |
| 22102 | | 22066 | |
| 22103 | ZigType *return_type = ira->codegen->builtin_types.entry_void; | 22067 | ZigType *return_type = ira->codegen->builtin_types.entry_void; |
| 22104 | for (size_t i = 0; i < asm_expr->output_list.length; i += 1) { | 22068 | for (size_t i = 0; i < asm_expr->output_list.length; i += 1) { |
| ... | @@ -22137,7 +22101,7 @@ static IrInstGen *ir_analyze_instruction_array_type(IrAnalyze *ira, IrInstSrcArr | ... | @@ -22137,7 +22101,7 @@ static IrInstGen *ir_analyze_instruction_array_type(IrAnalyze *ira, IrInstSrcArr |
| 22137 | IrInstGen *result = ir_const(ira, &array_type_instruction->base.base, ira->codegen->builtin_types.entry_type); | 22101 | IrInstGen *result = ir_const(ira, &array_type_instruction->base.base, ira->codegen->builtin_types.entry_type); |
| 22138 | result->value->special = ConstValSpecialLazy; | 22102 | result->value->special = ConstValSpecialLazy; |
| 22139 | | 22103 | |
| 22140 | LazyValueArrayType *lazy_array_type = allocate<LazyValueArrayType>(1, "LazyValueArrayType"); | 22104 | LazyValueArrayType *lazy_array_type = heap::c_allocator.create<LazyValueArrayType>(); |
| 22141 | lazy_array_type->ira = ira; ira_ref(ira); | 22105 | lazy_array_type->ira = ira; ira_ref(ira); |
| 22142 | result->value->data.x_lazy = &lazy_array_type->base; | 22106 | result->value->data.x_lazy = &lazy_array_type->base; |
| 22143 | lazy_array_type->base.id = LazyValueIdArrayType; | 22107 | lazy_array_type->base.id = LazyValueIdArrayType; |
| ... | @@ -22162,7 +22126,7 @@ static IrInstGen *ir_analyze_instruction_size_of(IrAnalyze *ira, IrInstSrcSizeOf | ... | @@ -22162,7 +22126,7 @@ static IrInstGen *ir_analyze_instruction_size_of(IrAnalyze *ira, IrInstSrcSizeOf |
| 22162 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_num_lit_int); | 22126 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_num_lit_int); |
| 22163 | result->value->special = ConstValSpecialLazy; | 22127 | result->value->special = ConstValSpecialLazy; |
| 22164 | | 22128 | |
| 22165 | LazyValueSizeOf *lazy_size_of = allocate<LazyValueSizeOf>(1, "LazyValueSizeOf"); | 22129 | LazyValueSizeOf *lazy_size_of = heap::c_allocator.create<LazyValueSizeOf>(); |
| 22166 | lazy_size_of->ira = ira; ira_ref(ira); | 22130 | lazy_size_of->ira = ira; ira_ref(ira); |
| 22167 | result->value->data.x_lazy = &lazy_size_of->base; | 22131 | result->value->data.x_lazy = &lazy_size_of->base; |
| 22168 | lazy_size_of->base.id = LazyValueIdSizeOf; | 22132 | lazy_size_of->base.id = LazyValueIdSizeOf; |
| ... | @@ -22282,7 +22246,7 @@ static IrInstGen *ir_analyze_unwrap_optional_payload(IrAnalyze *ira, IrInst* sou | ... | @@ -22282,7 +22246,7 @@ static IrInstGen *ir_analyze_unwrap_optional_payload(IrAnalyze *ira, IrInst* sou |
| 22282 | return ira->codegen->invalid_inst_gen; | 22246 | return ira->codegen->invalid_inst_gen; |
| 22283 | case OnePossibleValueNo: | 22247 | case OnePossibleValueNo: |
| 22284 | if (!same_comptime_repr) { | 22248 | if (!same_comptime_repr) { |
| 22285 | ZigValue *payload_val = create_const_vals(1); | 22249 | ZigValue *payload_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 22286 | payload_val->type = child_type; | 22250 | payload_val->type = child_type; |
| 22287 | payload_val->special = ConstValSpecialUndef; | 22251 | payload_val->special = ConstValSpecialUndef; |
| 22288 | payload_val->parent.id = ConstParentIdOptionalPayload; | 22252 | payload_val->parent.id = ConstParentIdOptionalPayload; |
| ... | @@ -22529,7 +22493,7 @@ static IrInstGen *ir_analyze_instruction_switch_br(IrAnalyze *ira, | ... | @@ -22529,7 +22493,7 @@ static IrInstGen *ir_analyze_instruction_switch_br(IrAnalyze *ira, |
| 22529 | } | 22493 | } |
| 22530 | } | 22494 | } |
| 22531 | | 22495 | |
| 22532 | IrInstGenSwitchBrCase *cases = allocate<IrInstGenSwitchBrCase>(case_count); | 22496 | IrInstGenSwitchBrCase *cases = heap::c_allocator.allocate<IrInstGenSwitchBrCase>(case_count); |
| 22533 | for (size_t i = 0; i < case_count; i += 1) { | 22497 | for (size_t i = 0; i < case_count; i += 1) { |
| 22534 | IrInstSrcSwitchBrCase *old_case = &switch_br_instruction->cases[i]; | 22498 | IrInstSrcSwitchBrCase *old_case = &switch_br_instruction->cases[i]; |
| 22535 | IrInstGenSwitchBrCase *new_case = &cases[i]; | 22499 | IrInstGenSwitchBrCase *new_case = &cases[i]; |
| ... | @@ -22614,7 +22578,7 @@ static IrInstGen *ir_analyze_instruction_switch_target(IrAnalyze *ira, | ... | @@ -22614,7 +22578,7 @@ static IrInstGen *ir_analyze_instruction_switch_target(IrAnalyze *ira, |
| 22614 | case ZigTypeIdErrorSet: { | 22578 | case ZigTypeIdErrorSet: { |
| 22615 | if (pointee_val) { | 22579 | if (pointee_val) { |
| 22616 | IrInstGen *result = ir_const(ira, &switch_target_instruction->base.base, nullptr); | 22580 | IrInstGen *result = ir_const(ira, &switch_target_instruction->base.base, nullptr); |
| 22617 | copy_const_val(result->value, pointee_val); | 22581 | copy_const_val(ira->codegen, result->value, pointee_val); |
| 22618 | result->value->type = target_type; | 22582 | result->value->type = target_type; |
| 22619 | return result; | 22583 | return result; |
| 22620 | } | 22584 | } |
| ... | @@ -22834,7 +22798,7 @@ static IrInstGen *ir_analyze_instruction_switch_else_var(IrAnalyze *ira, | ... | @@ -22834,7 +22798,7 @@ static IrInstGen *ir_analyze_instruction_switch_else_var(IrAnalyze *ira, |
| 22834 | return target_value_ptr; | 22798 | return target_value_ptr; |
| 22835 | } | 22799 | } |
| 22836 | // Make note of the errors handled by other cases | 22800 | // Make note of the errors handled by other cases |
| 22837 | ErrorTableEntry **errors = allocate<ErrorTableEntry *>(ira->codegen->errors_by_index.length); | 22801 | ErrorTableEntry **errors = heap::c_allocator.allocate<ErrorTableEntry *>(ira->codegen->errors_by_index.length); |
| 22838 | // We may not have any case in the switch if this is a lone else | 22802 | // We may not have any case in the switch if this is a lone else |
| 22839 | const size_t switch_cases = instruction->switch_br ? instruction->switch_br->case_count : 0; | 22803 | const size_t switch_cases = instruction->switch_br ? instruction->switch_br->case_count : 0; |
| 22840 | for (size_t case_i = 0; case_i < switch_cases; case_i += 1) { | 22804 | for (size_t case_i = 0; case_i < switch_cases; case_i += 1) { |
| ... | @@ -22870,7 +22834,7 @@ static IrInstGen *ir_analyze_instruction_switch_else_var(IrAnalyze *ira, | ... | @@ -22870,7 +22834,7 @@ static IrInstGen *ir_analyze_instruction_switch_else_var(IrAnalyze *ira, |
| 22870 | buf_appendf(&err_set_type->name, "%s,", buf_ptr(&error_entry->name)); | 22834 | buf_appendf(&err_set_type->name, "%s,", buf_ptr(&error_entry->name)); |
| 22871 | } | 22835 | } |
| 22872 | } | 22836 | } |
| 22873 | free(errors); | 22837 | heap::c_allocator.deallocate(errors, ira->codegen->errors_by_index.length); |
| 22874 | | 22838 | |
| 22875 | err_set_type->data.error_set.err_count = result_list.length; | 22839 | err_set_type->data.error_set.err_count = result_list.length; |
| 22876 | err_set_type->data.error_set.errors = result_list.items; | 22840 | err_set_type->data.error_set.errors = result_list.items; |
| ... | @@ -23018,7 +22982,7 @@ static IrInstGen *ir_analyze_container_init_fields(IrAnalyze *ira, IrInst *sourc | ... | @@ -23018,7 +22982,7 @@ static IrInstGen *ir_analyze_container_init_fields(IrAnalyze *ira, IrInst *sourc |
| 23018 | | 22982 | |
| 23019 | IrInstGen *first_non_const_instruction = nullptr; | 22983 | IrInstGen *first_non_const_instruction = nullptr; |
| 23020 | | 22984 | |
| 23021 | AstNode **field_assign_nodes = allocate<AstNode *>(actual_field_count); | 22985 | AstNode **field_assign_nodes = heap::c_allocator.allocate<AstNode *>(actual_field_count); |
| 23022 | ZigList<IrInstGen *> const_ptrs = {}; | 22986 | ZigList<IrInstGen *> const_ptrs = {}; |
| 23023 | | 22987 | |
| 23024 | bool is_comptime = ir_should_inline(ira->old_irb.exec, source_instr->scope) | 22988 | bool is_comptime = ir_should_inline(ira->old_irb.exec, source_instr->scope) |
| ... | @@ -23089,7 +23053,7 @@ static IrInstGen *ir_analyze_container_init_fields(IrAnalyze *ira, IrInst *sourc | ... | @@ -23089,7 +23053,7 @@ static IrInstGen *ir_analyze_container_init_fields(IrAnalyze *ira, IrInst *sourc |
| 23089 | return ira->codegen->invalid_inst_gen; | 23053 | return ira->codegen->invalid_inst_gen; |
| 23090 | | 23054 | |
| 23091 | IrInstGen *runtime_inst = ir_const(ira, source_instr, field->init_val->type); | 23055 | IrInstGen *runtime_inst = ir_const(ira, source_instr, field->init_val->type); |
| 23092 | copy_const_val(runtime_inst->value, field->init_val); | 23056 | copy_const_val(ira->codegen, runtime_inst->value, field->init_val); |
| 23093 | | 23057 | |
| 23094 | IrInstGen *field_ptr = ir_analyze_struct_field_ptr(ira, source_instr, field, result_loc, | 23058 | IrInstGen *field_ptr = ir_analyze_struct_field_ptr(ira, source_instr, field, result_loc, |
| 23095 | container_type, true); | 23059 | container_type, true); |
| ... | @@ -23353,7 +23317,7 @@ static IrInstGen *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstSrcErrNa | ... | @@ -23353,7 +23317,7 @@ static IrInstGen *ir_analyze_instruction_err_name(IrAnalyze *ira, IrInstSrcErrNa |
| 23353 | err->cached_error_name_val = create_const_slice(ira->codegen, array_val, 0, buf_len(&err->name), true); | 23317 | err->cached_error_name_val = create_const_slice(ira->codegen, array_val, 0, buf_len(&err->name), true); |
| 23354 | } | 23318 | } |
| 23355 | IrInstGen *result = ir_const(ira, &instruction->base.base, nullptr); | 23319 | IrInstGen *result = ir_const(ira, &instruction->base.base, nullptr); |
| 23356 | copy_const_val(result->value, err->cached_error_name_val); | 23320 | copy_const_val(ira->codegen, result->value, err->cached_error_name_val); |
| 23357 | result->value->type = str_type; | 23321 | result->value->type = str_type; |
| 23358 | return result; | 23322 | return result; |
| 23359 | } | 23323 | } |
| ... | @@ -23679,11 +23643,11 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa | ... | @@ -23679,11 +23643,11 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23679 | } | 23643 | } |
| 23680 | } | 23644 | } |
| 23681 | | 23645 | |
| 23682 | ZigValue *declaration_array = create_const_vals(1); | 23646 | ZigValue *declaration_array = ira->codegen->pass1_arena->create<ZigValue>(); |
| 23683 | declaration_array->special = ConstValSpecialStatic; | 23647 | declaration_array->special = ConstValSpecialStatic; |
| 23684 | declaration_array->type = get_array_type(ira->codegen, type_info_declaration_type, declaration_count, nullptr); | 23648 | declaration_array->type = get_array_type(ira->codegen, type_info_declaration_type, declaration_count, nullptr); |
| 23685 | declaration_array->data.x_array.special = ConstArraySpecialNone; | 23649 | declaration_array->data.x_array.special = ConstArraySpecialNone; |
| 23686 | declaration_array->data.x_array.data.s_none.elements = create_const_vals(declaration_count); | 23650 | declaration_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(declaration_count); |
| 23687 | init_const_slice(ira->codegen, out_val, declaration_array, 0, declaration_count, false); | 23651 | init_const_slice(ira->codegen, out_val, declaration_array, 0, declaration_count, false); |
| 23688 | | 23652 | |
| 23689 | // Loop through the declarations and generate info. | 23653 | // Loop through the declarations and generate info. |
| ... | @@ -23705,7 +23669,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa | ... | @@ -23705,7 +23669,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23705 | declaration_val->special = ConstValSpecialStatic; | 23669 | declaration_val->special = ConstValSpecialStatic; |
| 23706 | declaration_val->type = type_info_declaration_type; | 23670 | declaration_val->type = type_info_declaration_type; |
| 23707 | | 23671 | |
| 23708 | ZigValue **inner_fields = alloc_const_vals_ptrs(3); | 23672 | ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 3); |
| 23709 | ZigValue *name = create_const_str_lit(ira->codegen, curr_entry->key)->data.x_ptr.data.ref.pointee; | 23673 | ZigValue *name = create_const_str_lit(ira->codegen, curr_entry->key)->data.x_ptr.data.ref.pointee; |
| 23710 | init_const_slice(ira->codegen, inner_fields[0], name, 0, buf_len(curr_entry->key), true); | 23674 | init_const_slice(ira->codegen, inner_fields[0], name, 0, buf_len(curr_entry->key), true); |
| 23711 | inner_fields[1]->special = ConstValSpecialStatic; | 23675 | inner_fields[1]->special = ConstValSpecialStatic; |
| ... | @@ -23736,7 +23700,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa | ... | @@ -23736,7 +23700,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23736 | // 1: Data.Var: type | 23700 | // 1: Data.Var: type |
| 23737 | bigint_init_unsigned(&inner_fields[2]->data.x_union.tag, 1); | 23701 | bigint_init_unsigned(&inner_fields[2]->data.x_union.tag, 1); |
| 23738 | | 23702 | |
| 23739 | ZigValue *payload = create_const_vals(1); | 23703 | ZigValue *payload = ira->codegen->pass1_arena->create<ZigValue>(); |
| 23740 | payload->special = ConstValSpecialStatic; | 23704 | payload->special = ConstValSpecialStatic; |
| 23741 | payload->type = ira->codegen->builtin_types.entry_type; | 23705 | payload->type = ira->codegen->builtin_types.entry_type; |
| 23742 | payload->data.x_type = var->const_value->type; | 23706 | payload->data.x_type = var->const_value->type; |
| ... | @@ -23757,13 +23721,13 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa | ... | @@ -23757,13 +23721,13 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23757 | | 23721 | |
| 23758 | AstNodeFnProto *fn_node = &fn_entry->proto_node->data.fn_proto; | 23722 | AstNodeFnProto *fn_node = &fn_entry->proto_node->data.fn_proto; |
| 23759 | | 23723 | |
| 23760 | ZigValue *fn_decl_val = create_const_vals(1); | 23724 | ZigValue *fn_decl_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 23761 | fn_decl_val->special = ConstValSpecialStatic; | 23725 | fn_decl_val->special = ConstValSpecialStatic; |
| 23762 | fn_decl_val->type = type_info_fn_decl_type; | 23726 | fn_decl_val->type = type_info_fn_decl_type; |
| 23763 | fn_decl_val->parent.id = ConstParentIdUnion; | 23727 | fn_decl_val->parent.id = ConstParentIdUnion; |
| 23764 | fn_decl_val->parent.data.p_union.union_val = inner_fields[2]; | 23728 | fn_decl_val->parent.data.p_union.union_val = inner_fields[2]; |
| 23765 | | 23729 | |
| 23766 | ZigValue **fn_decl_fields = alloc_const_vals_ptrs(9); | 23730 | ZigValue **fn_decl_fields = alloc_const_vals_ptrs(ira->codegen, 9); |
| 23767 | fn_decl_val->data.x_struct.fields = fn_decl_fields; | 23731 | fn_decl_val->data.x_struct.fields = fn_decl_fields; |
| 23768 | | 23732 | |
| 23769 | // fn_type: type | 23733 | // fn_type: type |
| ... | @@ -23801,7 +23765,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa | ... | @@ -23801,7 +23765,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23801 | 0, 0, 0, false); | 23765 | 0, 0, 0, false); |
| 23802 | fn_decl_fields[5]->type = get_optional_type(ira->codegen, get_slice_type(ira->codegen, u8_ptr)); | 23766 | fn_decl_fields[5]->type = get_optional_type(ira->codegen, get_slice_type(ira->codegen, u8_ptr)); |
| 23803 | if (fn_node->is_extern && fn_node->lib_name != nullptr && buf_len(fn_node->lib_name) > 0) { | 23767 | if (fn_node->is_extern && fn_node->lib_name != nullptr && buf_len(fn_node->lib_name) > 0) { |
| 23804 | fn_decl_fields[5]->data.x_optional = create_const_vals(1); | 23768 | fn_decl_fields[5]->data.x_optional = ira->codegen->pass1_arena->create<ZigValue>(); |
| 23805 | ZigValue *lib_name = create_const_str_lit(ira->codegen, fn_node->lib_name)->data.x_ptr.data.ref.pointee; | 23769 | ZigValue *lib_name = create_const_str_lit(ira->codegen, fn_node->lib_name)->data.x_ptr.data.ref.pointee; |
| 23806 | init_const_slice(ira->codegen, fn_decl_fields[5]->data.x_optional, lib_name, 0, | 23770 | init_const_slice(ira->codegen, fn_decl_fields[5]->data.x_optional, lib_name, 0, |
| 23807 | buf_len(fn_node->lib_name), true); | 23771 | buf_len(fn_node->lib_name), true); |
| ... | @@ -23816,12 +23780,12 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa | ... | @@ -23816,12 +23780,12 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23816 | // arg_names: [][] const u8 | 23780 | // arg_names: [][] const u8 |
| 23817 | ensure_field_index(fn_decl_val->type, "arg_names", 7); | 23781 | ensure_field_index(fn_decl_val->type, "arg_names", 7); |
| 23818 | size_t fn_arg_count = fn_entry->variable_list.length; | 23782 | size_t fn_arg_count = fn_entry->variable_list.length; |
| 23819 | ZigValue *fn_arg_name_array = create_const_vals(1); | 23783 | ZigValue *fn_arg_name_array = ira->codegen->pass1_arena->create<ZigValue>(); |
| 23820 | fn_arg_name_array->special = ConstValSpecialStatic; | 23784 | fn_arg_name_array->special = ConstValSpecialStatic; |
| 23821 | fn_arg_name_array->type = get_array_type(ira->codegen, | 23785 | fn_arg_name_array->type = get_array_type(ira->codegen, |
| 23822 | get_slice_type(ira->codegen, u8_ptr), fn_arg_count, nullptr); | 23786 | get_slice_type(ira->codegen, u8_ptr), fn_arg_count, nullptr); |
| 23823 | fn_arg_name_array->data.x_array.special = ConstArraySpecialNone; | 23787 | fn_arg_name_array->data.x_array.special = ConstArraySpecialNone; |
| 23824 | fn_arg_name_array->data.x_array.data.s_none.elements = create_const_vals(fn_arg_count); | 23788 | fn_arg_name_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(fn_arg_count); |
| 23825 | | 23789 | |
| 23826 | init_const_slice(ira->codegen, fn_decl_fields[7], fn_arg_name_array, 0, fn_arg_count, false); | 23790 | init_const_slice(ira->codegen, fn_decl_fields[7], fn_arg_name_array, 0, fn_arg_count, false); |
| 23827 | | 23791 | |
| ... | @@ -23848,7 +23812,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa | ... | @@ -23848,7 +23812,7 @@ static Error ir_make_type_info_decls(IrAnalyze *ira, IrInst* source_instr, ZigVa |
| 23848 | // This is a type. | 23812 | // This is a type. |
| 23849 | bigint_init_unsigned(&inner_fields[2]->data.x_union.tag, 0); | 23813 | bigint_init_unsigned(&inner_fields[2]->data.x_union.tag, 0); |
| 23850 | | 23814 | |
| 23851 | ZigValue *payload = create_const_vals(1); | 23815 | ZigValue *payload = ira->codegen->pass1_arena->create<ZigValue>(); |
| 23852 | payload->special = ConstValSpecialStatic; | 23816 | payload->special = ConstValSpecialStatic; |
| 23853 | payload->type = ira->codegen->builtin_types.entry_type; | 23817 | payload->type = ira->codegen->builtin_types.entry_type; |
| 23854 | payload->data.x_type = type_entry; | 23818 | payload->data.x_type = type_entry; |
| ... | @@ -23914,11 +23878,11 @@ static ZigValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_type_ent | ... | @@ -23914,11 +23878,11 @@ static ZigValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_type_ent |
| 23914 | ZigType *type_info_pointer_type = ir_type_info_get_type(ira, "Pointer", nullptr); | 23878 | ZigType *type_info_pointer_type = ir_type_info_get_type(ira, "Pointer", nullptr); |
| 23915 | assertNoError(type_resolve(ira->codegen, type_info_pointer_type, ResolveStatusSizeKnown)); | 23879 | assertNoError(type_resolve(ira->codegen, type_info_pointer_type, ResolveStatusSizeKnown)); |
| 23916 | | 23880 | |
| 23917 | ZigValue *result = create_const_vals(1); | 23881 | ZigValue *result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 23918 | result->special = ConstValSpecialStatic; | 23882 | result->special = ConstValSpecialStatic; |
| 23919 | result->type = type_info_pointer_type; | 23883 | result->type = type_info_pointer_type; |
| 23920 | | 23884 | |
| 23921 | ZigValue **fields = alloc_const_vals_ptrs(7); | 23885 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 7); |
| 23922 | result->data.x_struct.fields = fields; | 23886 | result->data.x_struct.fields = fields; |
| 23923 | | 23887 | |
| 23924 | // size: Size | 23888 | // size: Size |
| ... | @@ -23973,7 +23937,7 @@ static void make_enum_field_val(IrAnalyze *ira, ZigValue *enum_field_val, TypeEn | ... | @@ -23973,7 +23937,7 @@ static void make_enum_field_val(IrAnalyze *ira, ZigValue *enum_field_val, TypeEn |
| 23973 | enum_field_val->special = ConstValSpecialStatic; | 23937 | enum_field_val->special = ConstValSpecialStatic; |
| 23974 | enum_field_val->type = type_info_enum_field_type; | 23938 | enum_field_val->type = type_info_enum_field_type; |
| 23975 | | 23939 | |
| 23976 | ZigValue **inner_fields = alloc_const_vals_ptrs(2); | 23940 | ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 23977 | inner_fields[1]->special = ConstValSpecialStatic; | 23941 | inner_fields[1]->special = ConstValSpecialStatic; |
| 23978 | inner_fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int; | 23942 | inner_fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int; |
| 23979 | | 23943 | |
| ... | @@ -24019,11 +23983,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24019,11 +23983,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24019 | break; | 23983 | break; |
| 24020 | case ZigTypeIdInt: | 23984 | case ZigTypeIdInt: |
| 24021 | { | 23985 | { |
| 24022 | result = create_const_vals(1); | 23986 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24023 | result->special = ConstValSpecialStatic; | 23987 | result->special = ConstValSpecialStatic; |
| 24024 | result->type = ir_type_info_get_type(ira, "Int", nullptr); | 23988 | result->type = ir_type_info_get_type(ira, "Int", nullptr); |
| 24025 | | 23989 | |
| 24026 | ZigValue **fields = alloc_const_vals_ptrs(2); | 23990 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 24027 | result->data.x_struct.fields = fields; | 23991 | result->data.x_struct.fields = fields; |
| 24028 | | 23992 | |
| 24029 | // is_signed: bool | 23993 | // is_signed: bool |
| ... | @@ -24041,11 +24005,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24041,11 +24005,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24041 | } | 24005 | } |
| 24042 | case ZigTypeIdFloat: | 24006 | case ZigTypeIdFloat: |
| 24043 | { | 24007 | { |
| 24044 | result = create_const_vals(1); | 24008 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24045 | result->special = ConstValSpecialStatic; | 24009 | result->special = ConstValSpecialStatic; |
| 24046 | result->type = ir_type_info_get_type(ira, "Float", nullptr); | 24010 | result->type = ir_type_info_get_type(ira, "Float", nullptr); |
| 24047 | | 24011 | |
| 24048 | ZigValue **fields = alloc_const_vals_ptrs(1); | 24012 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 1); |
| 24049 | result->data.x_struct.fields = fields; | 24013 | result->data.x_struct.fields = fields; |
| 24050 | | 24014 | |
| 24051 | // bits: u8 | 24015 | // bits: u8 |
| ... | @@ -24065,11 +24029,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24065,11 +24029,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24065 | } | 24029 | } |
| 24066 | case ZigTypeIdArray: | 24030 | case ZigTypeIdArray: |
| 24067 | { | 24031 | { |
| 24068 | result = create_const_vals(1); | 24032 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24069 | result->special = ConstValSpecialStatic; | 24033 | result->special = ConstValSpecialStatic; |
| 24070 | result->type = ir_type_info_get_type(ira, "Array", nullptr); | 24034 | result->type = ir_type_info_get_type(ira, "Array", nullptr); |
| 24071 | | 24035 | |
| 24072 | ZigValue **fields = alloc_const_vals_ptrs(3); | 24036 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 3); |
| 24073 | result->data.x_struct.fields = fields; | 24037 | result->data.x_struct.fields = fields; |
| 24074 | | 24038 | |
| 24075 | // len: usize | 24039 | // len: usize |
| ... | @@ -24089,11 +24053,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24089,11 +24053,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24089 | break; | 24053 | break; |
| 24090 | } | 24054 | } |
| 24091 | case ZigTypeIdVector: { | 24055 | case ZigTypeIdVector: { |
| 24092 | result = create_const_vals(1); | 24056 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24093 | result->special = ConstValSpecialStatic; | 24057 | result->special = ConstValSpecialStatic; |
| 24094 | result->type = ir_type_info_get_type(ira, "Vector", nullptr); | 24058 | result->type = ir_type_info_get_type(ira, "Vector", nullptr); |
| 24095 | | 24059 | |
| 24096 | ZigValue **fields = alloc_const_vals_ptrs(2); | 24060 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 24097 | result->data.x_struct.fields = fields; | 24061 | result->data.x_struct.fields = fields; |
| 24098 | | 24062 | |
| 24099 | // len: usize | 24063 | // len: usize |
| ... | @@ -24111,11 +24075,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24111,11 +24075,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24111 | } | 24075 | } |
| 24112 | case ZigTypeIdOptional: | 24076 | case ZigTypeIdOptional: |
| 24113 | { | 24077 | { |
| 24114 | result = create_const_vals(1); | 24078 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24115 | result->special = ConstValSpecialStatic; | 24079 | result->special = ConstValSpecialStatic; |
| 24116 | result->type = ir_type_info_get_type(ira, "Optional", nullptr); | 24080 | result->type = ir_type_info_get_type(ira, "Optional", nullptr); |
| 24117 | | 24081 | |
| 24118 | ZigValue **fields = alloc_const_vals_ptrs(1); | 24082 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 1); |
| 24119 | result->data.x_struct.fields = fields; | 24083 | result->data.x_struct.fields = fields; |
| 24120 | | 24084 | |
| 24121 | // child: type | 24085 | // child: type |
| ... | @@ -24127,11 +24091,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24127,11 +24091,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24127 | break; | 24091 | break; |
| 24128 | } | 24092 | } |
| 24129 | case ZigTypeIdAnyFrame: { | 24093 | case ZigTypeIdAnyFrame: { |
| 24130 | result = create_const_vals(1); | 24094 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24131 | result->special = ConstValSpecialStatic; | 24095 | result->special = ConstValSpecialStatic; |
| 24132 | result->type = ir_type_info_get_type(ira, "AnyFrame", nullptr); | 24096 | result->type = ir_type_info_get_type(ira, "AnyFrame", nullptr); |
| 24133 | | 24097 | |
| 24134 | ZigValue **fields = alloc_const_vals_ptrs(1); | 24098 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 1); |
| 24135 | result->data.x_struct.fields = fields; | 24099 | result->data.x_struct.fields = fields; |
| 24136 | | 24100 | |
| 24137 | // child: ?type | 24101 | // child: ?type |
| ... | @@ -24144,11 +24108,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24144,11 +24108,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24144 | } | 24108 | } |
| 24145 | case ZigTypeIdEnum: | 24109 | case ZigTypeIdEnum: |
| 24146 | { | 24110 | { |
| 24147 | result = create_const_vals(1); | 24111 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24148 | result->special = ConstValSpecialStatic; | 24112 | result->special = ConstValSpecialStatic; |
| 24149 | result->type = ir_type_info_get_type(ira, "Enum", nullptr); | 24113 | result->type = ir_type_info_get_type(ira, "Enum", nullptr); |
| 24150 | | 24114 | |
| 24151 | ZigValue **fields = alloc_const_vals_ptrs(5); | 24115 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 5); |
| 24152 | result->data.x_struct.fields = fields; | 24116 | result->data.x_struct.fields = fields; |
| 24153 | | 24117 | |
| 24154 | // layout: ContainerLayout | 24118 | // layout: ContainerLayout |
| ... | @@ -24170,11 +24134,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24170,11 +24134,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24170 | } | 24134 | } |
| 24171 | uint32_t enum_field_count = type_entry->data.enumeration.src_field_count; | 24135 | uint32_t enum_field_count = type_entry->data.enumeration.src_field_count; |
| 24172 | | 24136 | |
| 24173 | ZigValue *enum_field_array = create_const_vals(1); | 24137 | ZigValue *enum_field_array = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24174 | enum_field_array->special = ConstValSpecialStatic; | 24138 | enum_field_array->special = ConstValSpecialStatic; |
| 24175 | enum_field_array->type = get_array_type(ira->codegen, type_info_enum_field_type, enum_field_count, nullptr); | 24139 | enum_field_array->type = get_array_type(ira->codegen, type_info_enum_field_type, enum_field_count, nullptr); |
| 24176 | enum_field_array->data.x_array.special = ConstArraySpecialNone; | 24140 | enum_field_array->data.x_array.special = ConstArraySpecialNone; |
| 24177 | enum_field_array->data.x_array.data.s_none.elements = create_const_vals(enum_field_count); | 24141 | enum_field_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(enum_field_count); |
| 24178 | | 24142 | |
| 24179 | init_const_slice(ira->codegen, fields[2], enum_field_array, 0, enum_field_count, false); | 24143 | init_const_slice(ira->codegen, fields[2], enum_field_array, 0, enum_field_count, false); |
| 24180 | | 24144 | |
| ... | @@ -24204,7 +24168,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24204,7 +24168,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24204 | } | 24168 | } |
| 24205 | case ZigTypeIdErrorSet: | 24169 | case ZigTypeIdErrorSet: |
| 24206 | { | 24170 | { |
| 24207 | result = create_const_vals(1); | 24171 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24208 | result->special = ConstValSpecialStatic; | 24172 | result->special = ConstValSpecialStatic; |
| 24209 | result->type = ir_type_info_get_type(ira, "ErrorSet", nullptr); | 24173 | result->type = ir_type_info_get_type(ira, "ErrorSet", nullptr); |
| 24210 | | 24174 | |
| ... | @@ -24219,15 +24183,15 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24219,15 +24183,15 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24219 | if ((err = type_resolve(ira->codegen, type_info_error_type, ResolveStatusSizeKnown))) { | 24183 | if ((err = type_resolve(ira->codegen, type_info_error_type, ResolveStatusSizeKnown))) { |
| 24220 | zig_unreachable(); | 24184 | zig_unreachable(); |
| 24221 | } | 24185 | } |
| 24222 | ZigValue *slice_val = create_const_vals(1); | 24186 | ZigValue *slice_val = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24223 | result->data.x_optional = slice_val; | 24187 | result->data.x_optional = slice_val; |
| 24224 | | 24188 | |
| 24225 | uint32_t error_count = type_entry->data.error_set.err_count; | 24189 | uint32_t error_count = type_entry->data.error_set.err_count; |
| 24226 | ZigValue *error_array = create_const_vals(1); | 24190 | ZigValue *error_array = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24227 | error_array->special = ConstValSpecialStatic; | 24191 | error_array->special = ConstValSpecialStatic; |
| 24228 | error_array->type = get_array_type(ira->codegen, type_info_error_type, error_count, nullptr); | 24192 | error_array->type = get_array_type(ira->codegen, type_info_error_type, error_count, nullptr); |
| 24229 | error_array->data.x_array.special = ConstArraySpecialNone; | 24193 | error_array->data.x_array.special = ConstArraySpecialNone; |
| 24230 | error_array->data.x_array.data.s_none.elements = create_const_vals(error_count); | 24194 | error_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(error_count); |
| 24231 | | 24195 | |
| 24232 | init_const_slice(ira->codegen, slice_val, error_array, 0, error_count, false); | 24196 | init_const_slice(ira->codegen, slice_val, error_array, 0, error_count, false); |
| 24233 | for (uint32_t error_index = 0; error_index < error_count; error_index++) { | 24197 | for (uint32_t error_index = 0; error_index < error_count; error_index++) { |
| ... | @@ -24237,7 +24201,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24237,7 +24201,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24237 | error_val->special = ConstValSpecialStatic; | 24201 | error_val->special = ConstValSpecialStatic; |
| 24238 | error_val->type = type_info_error_type; | 24202 | error_val->type = type_info_error_type; |
| 24239 | | 24203 | |
| 24240 | ZigValue **inner_fields = alloc_const_vals_ptrs(2); | 24204 | ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 24241 | inner_fields[1]->special = ConstValSpecialStatic; | 24205 | inner_fields[1]->special = ConstValSpecialStatic; |
| 24242 | inner_fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int; | 24206 | inner_fields[1]->type = ira->codegen->builtin_types.entry_num_lit_int; |
| 24243 | | 24207 | |
| ... | @@ -24259,11 +24223,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24259,11 +24223,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24259 | } | 24223 | } |
| 24260 | case ZigTypeIdErrorUnion: | 24224 | case ZigTypeIdErrorUnion: |
| 24261 | { | 24225 | { |
| 24262 | result = create_const_vals(1); | 24226 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24263 | result->special = ConstValSpecialStatic; | 24227 | result->special = ConstValSpecialStatic; |
| 24264 | result->type = ir_type_info_get_type(ira, "ErrorUnion", nullptr); | 24228 | result->type = ir_type_info_get_type(ira, "ErrorUnion", nullptr); |
| 24265 | | 24229 | |
| 24266 | ZigValue **fields = alloc_const_vals_ptrs(2); | 24230 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 24267 | result->data.x_struct.fields = fields; | 24231 | result->data.x_struct.fields = fields; |
| 24268 | | 24232 | |
| 24269 | // error_set: type | 24233 | // error_set: type |
| ... | @@ -24282,11 +24246,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24282,11 +24246,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24282 | } | 24246 | } |
| 24283 | case ZigTypeIdUnion: | 24247 | case ZigTypeIdUnion: |
| 24284 | { | 24248 | { |
| 24285 | result = create_const_vals(1); | 24249 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24286 | result->special = ConstValSpecialStatic; | 24250 | result->special = ConstValSpecialStatic; |
| 24287 | result->type = ir_type_info_get_type(ira, "Union", nullptr); | 24251 | result->type = ir_type_info_get_type(ira, "Union", nullptr); |
| 24288 | | 24252 | |
| 24289 | ZigValue **fields = alloc_const_vals_ptrs(4); | 24253 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 4); |
| 24290 | result->data.x_struct.fields = fields; | 24254 | result->data.x_struct.fields = fields; |
| 24291 | | 24255 | |
| 24292 | // layout: ContainerLayout | 24256 | // layout: ContainerLayout |
| ... | @@ -24303,7 +24267,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24303,7 +24267,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24303 | if (union_decl_node->data.container_decl.auto_enum || | 24267 | if (union_decl_node->data.container_decl.auto_enum || |
| 24304 | union_decl_node->data.container_decl.init_arg_expr != nullptr) | 24268 | union_decl_node->data.container_decl.init_arg_expr != nullptr) |
| 24305 | { | 24269 | { |
| 24306 | ZigValue *tag_type = create_const_vals(1); | 24270 | ZigValue *tag_type = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24307 | tag_type->special = ConstValSpecialStatic; | 24271 | tag_type->special = ConstValSpecialStatic; |
| 24308 | tag_type->type = ira->codegen->builtin_types.entry_type; | 24272 | tag_type->type = ira->codegen->builtin_types.entry_type; |
| 24309 | tag_type->data.x_type = type_entry->data.unionation.tag_type; | 24273 | tag_type->data.x_type = type_entry->data.unionation.tag_type; |
| ... | @@ -24319,11 +24283,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24319,11 +24283,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24319 | zig_unreachable(); | 24283 | zig_unreachable(); |
| 24320 | uint32_t union_field_count = type_entry->data.unionation.src_field_count; | 24284 | uint32_t union_field_count = type_entry->data.unionation.src_field_count; |
| 24321 | | 24285 | |
| 24322 | ZigValue *union_field_array = create_const_vals(1); | 24286 | ZigValue *union_field_array = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24323 | union_field_array->special = ConstValSpecialStatic; | 24287 | union_field_array->special = ConstValSpecialStatic; |
| 24324 | union_field_array->type = get_array_type(ira->codegen, type_info_union_field_type, union_field_count, nullptr); | 24288 | union_field_array->type = get_array_type(ira->codegen, type_info_union_field_type, union_field_count, nullptr); |
| 24325 | union_field_array->data.x_array.special = ConstArraySpecialNone; | 24289 | union_field_array->data.x_array.special = ConstArraySpecialNone; |
| 24326 | union_field_array->data.x_array.data.s_none.elements = create_const_vals(union_field_count); | 24290 | union_field_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(union_field_count); |
| 24327 | | 24291 | |
| 24328 | init_const_slice(ira->codegen, fields[2], union_field_array, 0, union_field_count, false); | 24292 | init_const_slice(ira->codegen, fields[2], union_field_array, 0, union_field_count, false); |
| 24329 | | 24293 | |
| ... | @@ -24336,14 +24300,14 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24336,14 +24300,14 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24336 | union_field_val->special = ConstValSpecialStatic; | 24300 | union_field_val->special = ConstValSpecialStatic; |
| 24337 | union_field_val->type = type_info_union_field_type; | 24301 | union_field_val->type = type_info_union_field_type; |
| 24338 | | 24302 | |
| 24339 | ZigValue **inner_fields = alloc_const_vals_ptrs(3); | 24303 | ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 3); |
| 24340 | inner_fields[1]->special = ConstValSpecialStatic; | 24304 | inner_fields[1]->special = ConstValSpecialStatic; |
| 24341 | inner_fields[1]->type = get_optional_type(ira->codegen, type_info_enum_field_type); | 24305 | inner_fields[1]->type = get_optional_type(ira->codegen, type_info_enum_field_type); |
| 24342 | | 24306 | |
| 24343 | if (fields[1]->data.x_optional == nullptr) { | 24307 | if (fields[1]->data.x_optional == nullptr) { |
| 24344 | inner_fields[1]->data.x_optional = nullptr; | 24308 | inner_fields[1]->data.x_optional = nullptr; |
| 24345 | } else { | 24309 | } else { |
| 24346 | inner_fields[1]->data.x_optional = create_const_vals(1); | 24310 | inner_fields[1]->data.x_optional = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24347 | make_enum_field_val(ira, inner_fields[1]->data.x_optional, union_field->enum_field, type_info_enum_field_type); | 24311 | make_enum_field_val(ira, inner_fields[1]->data.x_optional, union_field->enum_field, type_info_enum_field_type); |
| 24348 | } | 24312 | } |
| 24349 | | 24313 | |
| ... | @@ -24378,11 +24342,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24378,11 +24342,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24378 | break; | 24342 | break; |
| 24379 | } | 24343 | } |
| 24380 | | 24344 | |
| 24381 | result = create_const_vals(1); | 24345 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24382 | result->special = ConstValSpecialStatic; | 24346 | result->special = ConstValSpecialStatic; |
| 24383 | result->type = ir_type_info_get_type(ira, "Struct", nullptr); | 24347 | result->type = ir_type_info_get_type(ira, "Struct", nullptr); |
| 24384 | | 24348 | |
| 24385 | ZigValue **fields = alloc_const_vals_ptrs(3); | 24349 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 3); |
| 24386 | result->data.x_struct.fields = fields; | 24350 | result->data.x_struct.fields = fields; |
| 24387 | | 24351 | |
| 24388 | // layout: ContainerLayout | 24352 | // layout: ContainerLayout |
| ... | @@ -24399,11 +24363,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24399,11 +24363,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24399 | } | 24363 | } |
| 24400 | uint32_t struct_field_count = type_entry->data.structure.src_field_count; | 24364 | uint32_t struct_field_count = type_entry->data.structure.src_field_count; |
| 24401 | | 24365 | |
| 24402 | ZigValue *struct_field_array = create_const_vals(1); | 24366 | ZigValue *struct_field_array = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24403 | struct_field_array->special = ConstValSpecialStatic; | 24367 | struct_field_array->special = ConstValSpecialStatic; |
| 24404 | struct_field_array->type = get_array_type(ira->codegen, type_info_struct_field_type, struct_field_count, nullptr); | 24368 | struct_field_array->type = get_array_type(ira->codegen, type_info_struct_field_type, struct_field_count, nullptr); |
| 24405 | struct_field_array->data.x_array.special = ConstArraySpecialNone; | 24369 | struct_field_array->data.x_array.special = ConstArraySpecialNone; |
| 24406 | struct_field_array->data.x_array.data.s_none.elements = create_const_vals(struct_field_count); | 24370 | struct_field_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(struct_field_count); |
| 24407 | | 24371 | |
| 24408 | init_const_slice(ira->codegen, fields[1], struct_field_array, 0, struct_field_count, false); | 24372 | init_const_slice(ira->codegen, fields[1], struct_field_array, 0, struct_field_count, false); |
| 24409 | | 24373 | |
| ... | @@ -24414,7 +24378,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24414,7 +24378,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24414 | struct_field_val->special = ConstValSpecialStatic; | 24378 | struct_field_val->special = ConstValSpecialStatic; |
| 24415 | struct_field_val->type = type_info_struct_field_type; | 24379 | struct_field_val->type = type_info_struct_field_type; |
| 24416 | | 24380 | |
| 24417 | ZigValue **inner_fields = alloc_const_vals_ptrs(4); | 24381 | ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 4); |
| 24418 | inner_fields[1]->special = ConstValSpecialStatic; | 24382 | inner_fields[1]->special = ConstValSpecialStatic; |
| 24419 | inner_fields[1]->type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int); | 24383 | inner_fields[1]->type = get_optional_type(ira->codegen, ira->codegen->builtin_types.entry_num_lit_int); |
| 24420 | | 24384 | |
| ... | @@ -24427,7 +24391,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24427,7 +24391,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24427 | inner_fields[1]->data.x_optional = nullptr; | 24391 | inner_fields[1]->data.x_optional = nullptr; |
| 24428 | } else { | 24392 | } else { |
| 24429 | size_t byte_offset = struct_field->offset; | 24393 | size_t byte_offset = struct_field->offset; |
| 24430 | inner_fields[1]->data.x_optional = create_const_vals(1); | 24394 | inner_fields[1]->data.x_optional = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24431 | inner_fields[1]->data.x_optional->special = ConstValSpecialStatic; | 24395 | inner_fields[1]->data.x_optional->special = ConstValSpecialStatic; |
| 24432 | inner_fields[1]->data.x_optional->type = ira->codegen->builtin_types.entry_num_lit_int; | 24396 | inner_fields[1]->data.x_optional->type = ira->codegen->builtin_types.entry_num_lit_int; |
| 24433 | bigint_init_unsigned(&inner_fields[1]->data.x_optional->data.x_bigint, byte_offset); | 24397 | bigint_init_unsigned(&inner_fields[1]->data.x_optional->data.x_bigint, byte_offset); |
| ... | @@ -24463,11 +24427,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24463,11 +24427,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24463 | } | 24427 | } |
| 24464 | case ZigTypeIdFn: | 24428 | case ZigTypeIdFn: |
| 24465 | { | 24429 | { |
| 24466 | result = create_const_vals(1); | 24430 | result = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24467 | result->special = ConstValSpecialStatic; | 24431 | result->special = ConstValSpecialStatic; |
| 24468 | result->type = ir_type_info_get_type(ira, "Fn", nullptr); | 24432 | result->type = ir_type_info_get_type(ira, "Fn", nullptr); |
| 24469 | | 24433 | |
| 24470 | ZigValue **fields = alloc_const_vals_ptrs(5); | 24434 | ZigValue **fields = alloc_const_vals_ptrs(ira->codegen, 5); |
| 24471 | result->data.x_struct.fields = fields; | 24435 | result->data.x_struct.fields = fields; |
| 24472 | | 24436 | |
| 24473 | // calling_convention: TypeInfo.CallingConvention | 24437 | // calling_convention: TypeInfo.CallingConvention |
| ... | @@ -24494,7 +24458,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24494,7 +24458,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24494 | if (type_entry->data.fn.fn_type_id.return_type == nullptr) | 24458 | if (type_entry->data.fn.fn_type_id.return_type == nullptr) |
| 24495 | fields[3]->data.x_optional = nullptr; | 24459 | fields[3]->data.x_optional = nullptr; |
| 24496 | else { | 24460 | else { |
| 24497 | ZigValue *return_type = create_const_vals(1); | 24461 | ZigValue *return_type = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24498 | return_type->special = ConstValSpecialStatic; | 24462 | return_type->special = ConstValSpecialStatic; |
| 24499 | return_type->type = ira->codegen->builtin_types.entry_type; | 24463 | return_type->type = ira->codegen->builtin_types.entry_type; |
| 24500 | return_type->data.x_type = type_entry->data.fn.fn_type_id.return_type; | 24464 | return_type->data.x_type = type_entry->data.fn.fn_type_id.return_type; |
| ... | @@ -24508,11 +24472,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24508,11 +24472,11 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24508 | size_t fn_arg_count = type_entry->data.fn.fn_type_id.param_count - | 24472 | size_t fn_arg_count = type_entry->data.fn.fn_type_id.param_count - |
| 24509 | (is_varargs && type_entry->data.fn.fn_type_id.cc != CallingConventionC); | 24473 | (is_varargs && type_entry->data.fn.fn_type_id.cc != CallingConventionC); |
| 24510 | | 24474 | |
| 24511 | ZigValue *fn_arg_array = create_const_vals(1); | 24475 | ZigValue *fn_arg_array = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24512 | fn_arg_array->special = ConstValSpecialStatic; | 24476 | fn_arg_array->special = ConstValSpecialStatic; |
| 24513 | fn_arg_array->type = get_array_type(ira->codegen, type_info_fn_arg_type, fn_arg_count, nullptr); | 24477 | fn_arg_array->type = get_array_type(ira->codegen, type_info_fn_arg_type, fn_arg_count, nullptr); |
| 24514 | fn_arg_array->data.x_array.special = ConstArraySpecialNone; | 24478 | fn_arg_array->data.x_array.special = ConstArraySpecialNone; |
| 24515 | fn_arg_array->data.x_array.data.s_none.elements = create_const_vals(fn_arg_count); | 24479 | fn_arg_array->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(fn_arg_count); |
| 24516 | | 24480 | |
| 24517 | init_const_slice(ira->codegen, fields[4], fn_arg_array, 0, fn_arg_count, false); | 24481 | init_const_slice(ira->codegen, fields[4], fn_arg_array, 0, fn_arg_count, false); |
| 24518 | | 24482 | |
| ... | @@ -24526,7 +24490,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24526,7 +24490,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24526 | bool arg_is_generic = fn_param_info->type == nullptr; | 24490 | bool arg_is_generic = fn_param_info->type == nullptr; |
| 24527 | if (arg_is_generic) assert(is_generic); | 24491 | if (arg_is_generic) assert(is_generic); |
| 24528 | | 24492 | |
| 24529 | ZigValue **inner_fields = alloc_const_vals_ptrs(3); | 24493 | ZigValue **inner_fields = alloc_const_vals_ptrs(ira->codegen, 3); |
| 24530 | inner_fields[0]->special = ConstValSpecialStatic; | 24494 | inner_fields[0]->special = ConstValSpecialStatic; |
| 24531 | inner_fields[0]->type = ira->codegen->builtin_types.entry_bool; | 24495 | inner_fields[0]->type = ira->codegen->builtin_types.entry_bool; |
| 24532 | inner_fields[0]->data.x_bool = arg_is_generic; | 24496 | inner_fields[0]->data.x_bool = arg_is_generic; |
| ... | @@ -24539,7 +24503,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy | ... | @@ -24539,7 +24503,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, IrInst* source_instr, ZigTy |
| 24539 | if (arg_is_generic) | 24503 | if (arg_is_generic) |
| 24540 | inner_fields[2]->data.x_optional = nullptr; | 24504 | inner_fields[2]->data.x_optional = nullptr; |
| 24541 | else { | 24505 | else { |
| 24542 | ZigValue *arg_type = create_const_vals(1); | 24506 | ZigValue *arg_type = ira->codegen->pass1_arena->create<ZigValue>(); |
| 24543 | arg_type->special = ConstValSpecialStatic; | 24507 | arg_type->special = ConstValSpecialStatic; |
| 24544 | arg_type->type = ira->codegen->builtin_types.entry_type; | 24508 | arg_type->type = ira->codegen->builtin_types.entry_type; |
| 24545 | arg_type->data.x_type = fn_param_info->type; | 24509 | arg_type->data.x_type = fn_param_info->type; |
| ... | @@ -24863,7 +24827,7 @@ static IrInstGen *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstSrcType | ... | @@ -24863,7 +24827,7 @@ static IrInstGen *ir_analyze_instruction_type_name(IrAnalyze *ira, IrInstSrcType |
| 24863 | type_entry->cached_const_name_val = create_const_str_lit(ira->codegen, type_bare_name(type_entry)); | 24827 | type_entry->cached_const_name_val = create_const_str_lit(ira->codegen, type_bare_name(type_entry)); |
| 24864 | } | 24828 | } |
| 24865 | IrInstGen *result = ir_const(ira, &instruction->base.base, nullptr); | 24829 | IrInstGen *result = ir_const(ira, &instruction->base.base, nullptr); |
| 24866 | copy_const_val(result->value, type_entry->cached_const_name_val); | 24830 | copy_const_val(ira->codegen, result->value, type_entry->cached_const_name_val); |
| 24867 | return result; | 24831 | return result; |
| 24868 | } | 24832 | } |
| 24869 | | 24833 | |
| ... | @@ -24895,7 +24859,6 @@ static IrInstGen *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstSrcCImpo | ... | @@ -24895,7 +24859,6 @@ static IrInstGen *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstSrcCImpo |
| 24895 | } | 24859 | } |
| 24896 | if (type_is_invalid(cimport_result->type)) | 24860 | if (type_is_invalid(cimport_result->type)) |
| 24897 | return ira->codegen->invalid_inst_gen; | 24861 | return ira->codegen->invalid_inst_gen; |
| 24898 | destroy(result_ptr, "ZigValue"); | | |
| 24899 | | 24862 | |
| 24900 | ZigPackage *cur_scope_pkg = scope_package(instruction->base.base.scope); | 24863 | ZigPackage *cur_scope_pkg = scope_package(instruction->base.base.scope); |
| 24901 | Buf *namespace_name = buf_sprintf("%s.cimport:%" ZIG_PRI_usize ":%" ZIG_PRI_usize, | 24864 | Buf *namespace_name = buf_sprintf("%s.cimport:%" ZIG_PRI_usize ":%" ZIG_PRI_usize, |
| ... | @@ -25574,11 +25537,11 @@ static IrInstGen *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstSrcToByt | ... | @@ -25574,11 +25537,11 @@ static IrInstGen *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstSrcToByt |
| 25574 | return ira->codegen->invalid_inst_gen; | 25537 | return ira->codegen->invalid_inst_gen; |
| 25575 | | 25538 | |
| 25576 | IrInstGen *result = ir_const(ira, &instruction->base.base, dest_slice_type); | 25539 | IrInstGen *result = ir_const(ira, &instruction->base.base, dest_slice_type); |
| 25577 | result->value->data.x_struct.fields = alloc_const_vals_ptrs(2); | 25540 | result->value->data.x_struct.fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 25578 | | 25541 | |
| 25579 | ZigValue *ptr_val = result->value->data.x_struct.fields[slice_ptr_index]; | 25542 | ZigValue *ptr_val = result->value->data.x_struct.fields[slice_ptr_index]; |
| 25580 | ZigValue *target_ptr_val = target_val->data.x_struct.fields[slice_ptr_index]; | 25543 | ZigValue *target_ptr_val = target_val->data.x_struct.fields[slice_ptr_index]; |
| 25581 | copy_const_val(ptr_val, target_ptr_val); | 25544 | copy_const_val(ira->codegen, ptr_val, target_ptr_val); |
| 25582 | ptr_val->type = dest_ptr_type; | 25545 | ptr_val->type = dest_ptr_type; |
| 25583 | | 25546 | |
| 25584 | ZigValue *len_val = result->value->data.x_struct.fields[slice_len_index]; | 25547 | ZigValue *len_val = result->value->data.x_struct.fields[slice_len_index]; |
| ... | @@ -25865,7 +25828,7 @@ static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr | ... | @@ -25865,7 +25828,7 @@ static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr |
| 25865 | expand_undef_array(ira->codegen, b_val); | 25828 | expand_undef_array(ira->codegen, b_val); |
| 25866 | | 25829 | |
| 25867 | IrInstGen *result = ir_const(ira, source_instr, result_type); | 25830 | IrInstGen *result = ir_const(ira, source_instr, result_type); |
| 25868 | result->value->data.x_array.data.s_none.elements = create_const_vals(len_mask); | 25831 | result->value->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(len_mask); |
| 25869 | for (uint32_t i = 0; i < mask_val->type->data.vector.len; i += 1) { | 25832 | for (uint32_t i = 0; i < mask_val->type->data.vector.len; i += 1) { |
| 25870 | ZigValue *mask_elem_val = &mask_val->data.x_array.data.s_none.elements[i]; | 25833 | ZigValue *mask_elem_val = &mask_val->data.x_array.data.s_none.elements[i]; |
| 25871 | ZigValue *result_elem_val = &result->value->data.x_array.data.s_none.elements[i]; | 25834 | ZigValue *result_elem_val = &result->value->data.x_array.data.s_none.elements[i]; |
| ... | @@ -25878,7 +25841,7 @@ static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr | ... | @@ -25878,7 +25841,7 @@ static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr |
| 25878 | ZigValue *src_elem_val = (v >= 0) ? | 25841 | ZigValue *src_elem_val = (v >= 0) ? |
| 25879 | &a->value->data.x_array.data.s_none.elements[v] : | 25842 | &a->value->data.x_array.data.s_none.elements[v] : |
| 25880 | &b->value->data.x_array.data.s_none.elements[~v]; | 25843 | &b->value->data.x_array.data.s_none.elements[~v]; |
| 25881 | copy_const_val(result_elem_val, src_elem_val); | 25844 | copy_const_val(ira->codegen, result_elem_val, src_elem_val); |
| 25882 | | 25845 | |
| 25883 | ir_assert(result_elem_val->special == ConstValSpecialStatic, source_instr); | 25846 | ir_assert(result_elem_val->special == ConstValSpecialStatic, source_instr); |
| 25884 | } | 25847 | } |
| ... | @@ -25898,7 +25861,7 @@ static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr | ... | @@ -25898,7 +25861,7 @@ static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr |
| 25898 | | 25861 | |
| 25899 | IrInstGen *expand_mask = ir_const(ira, &mask->base, | 25862 | IrInstGen *expand_mask = ir_const(ira, &mask->base, |
| 25900 | get_vector_type(ira->codegen, len_max, ira->codegen->builtin_types.entry_i32)); | 25863 | get_vector_type(ira->codegen, len_max, ira->codegen->builtin_types.entry_i32)); |
| 25901 | expand_mask->value->data.x_array.data.s_none.elements = create_const_vals(len_max); | 25864 | expand_mask->value->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(len_max); |
| 25902 | uint32_t i = 0; | 25865 | uint32_t i = 0; |
| 25903 | for (; i < len_min; i += 1) | 25866 | for (; i < len_min; i += 1) |
| 25904 | bigint_init_unsigned(&expand_mask->value->data.x_array.data.s_none.elements[i].data.x_bigint, i); | 25867 | bigint_init_unsigned(&expand_mask->value->data.x_array.data.s_none.elements[i].data.x_bigint, i); |
| ... | @@ -25968,9 +25931,9 @@ static IrInstGen *ir_analyze_instruction_splat(IrAnalyze *ira, IrInstSrcSplat *i | ... | @@ -25968,9 +25931,9 @@ static IrInstGen *ir_analyze_instruction_splat(IrAnalyze *ira, IrInstSrcSplat *i |
| 25968 | return ir_const_undef(ira, &instruction->base.base, return_type); | 25931 | return ir_const_undef(ira, &instruction->base.base, return_type); |
| 25969 | | 25932 | |
| 25970 | IrInstGen *result = ir_const(ira, &instruction->base.base, return_type); | 25933 | IrInstGen *result = ir_const(ira, &instruction->base.base, return_type); |
| 25971 | result->value->data.x_array.data.s_none.elements = create_const_vals(len_int); | 25934 | result->value->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(len_int); |
| 25972 | for (uint32_t i = 0; i < len_int; i += 1) { | 25935 | for (uint32_t i = 0; i < len_int; i += 1) { |
| 25973 | copy_const_val(&result->value->data.x_array.data.s_none.elements[i], scalar_val); | 25936 | copy_const_val(ira->codegen, &result->value->data.x_array.data.s_none.elements[i], scalar_val); |
| 25974 | } | 25937 | } |
| 25975 | return result; | 25938 | return result; |
| 25976 | } | 25939 | } |
| ... | @@ -26108,7 +26071,7 @@ static IrInstGen *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstSrcMemset | ... | @@ -26108,7 +26071,7 @@ static IrInstGen *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstSrcMemset |
| 26108 | } | 26071 | } |
| 26109 | | 26072 | |
| 26110 | for (size_t i = start; i < end; i += 1) { | 26073 | for (size_t i = start; i < end; i += 1) { |
| 26111 | copy_const_val(&dest_elements[i], byte_val); | 26074 | copy_const_val(ira->codegen, &dest_elements[i], byte_val); |
| 26112 | } | 26075 | } |
| 26113 | | 26076 | |
| 26114 | return ir_const_void(ira, &instruction->base.base); | 26077 | return ir_const_void(ira, &instruction->base.base); |
| ... | @@ -26284,7 +26247,7 @@ static IrInstGen *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstSrcMemcpy | ... | @@ -26284,7 +26247,7 @@ static IrInstGen *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstSrcMemcpy |
| 26284 | // TODO check for noalias violations - this should be generalized to work for any function | 26247 | // TODO check for noalias violations - this should be generalized to work for any function |
| 26285 | | 26248 | |
| 26286 | for (size_t i = 0; i < count; i += 1) { | 26249 | for (size_t i = 0; i < count; i += 1) { |
| 26287 | copy_const_val(&dest_elements[dest_start + i], &src_elements[src_start + i]); | 26250 | copy_const_val(ira->codegen, &dest_elements[dest_start + i], &src_elements[src_start + i]); |
| 26288 | } | 26251 | } |
| 26289 | | 26252 | |
| 26290 | return ir_const_void(ira, &instruction->base.base); | 26253 | return ir_const_void(ira, &instruction->base.base); |
| ... | @@ -26568,7 +26531,7 @@ static IrInstGen *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstSrcSlice *i | ... | @@ -26568,7 +26531,7 @@ static IrInstGen *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstSrcSlice *i |
| 26568 | | 26531 | |
| 26569 | IrInstGen *result = ir_const(ira, &instruction->base.base, return_type); | 26532 | IrInstGen *result = ir_const(ira, &instruction->base.base, return_type); |
| 26570 | ZigValue *out_val = result->value; | 26533 | ZigValue *out_val = result->value; |
| 26571 | out_val->data.x_struct.fields = alloc_const_vals_ptrs(2); | 26534 | out_val->data.x_struct.fields = alloc_const_vals_ptrs(ira->codegen, 2); |
| 26572 | | 26535 | |
| 26573 | ZigValue *ptr_val = out_val->data.x_struct.fields[slice_ptr_index]; | 26536 | ZigValue *ptr_val = out_val->data.x_struct.fields[slice_ptr_index]; |
| 26574 | | 26537 | |
| ... | @@ -26863,7 +26826,7 @@ static IrInstGen *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstSrcAlign | ... | @@ -26863,7 +26826,7 @@ static IrInstGen *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstSrcAlign |
| 26863 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_num_lit_int); | 26826 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_num_lit_int); |
| 26864 | result->value->special = ConstValSpecialLazy; | 26827 | result->value->special = ConstValSpecialLazy; |
| 26865 | | 26828 | |
| 26866 | LazyValueAlignOf *lazy_align_of = allocate<LazyValueAlignOf>(1, "LazyValueAlignOf"); | 26829 | LazyValueAlignOf *lazy_align_of = heap::c_allocator.create<LazyValueAlignOf>(); |
| 26867 | lazy_align_of->ira = ira; ira_ref(ira); | 26830 | lazy_align_of->ira = ira; ira_ref(ira); |
| 26868 | result->value->data.x_lazy = &lazy_align_of->base; | 26831 | result->value->data.x_lazy = &lazy_align_of->base; |
| 26869 | lazy_align_of->base.id = LazyValueIdAlignOf; | 26832 | lazy_align_of->base.id = LazyValueIdAlignOf; |
| ... | @@ -27189,7 +27152,7 @@ static IrInstGen *ir_analyze_unwrap_err_code(IrAnalyze *ira, IrInst* source_inst | ... | @@ -27189,7 +27152,7 @@ static IrInstGen *ir_analyze_unwrap_err_code(IrAnalyze *ira, IrInst* source_inst |
| 27189 | return ira->codegen->invalid_inst_gen; | 27152 | return ira->codegen->invalid_inst_gen; |
| 27190 | | 27153 | |
| 27191 | if (initializing && err_union_val->special == ConstValSpecialUndef) { | 27154 | if (initializing && err_union_val->special == ConstValSpecialUndef) { |
| 27192 | ZigValue *vals = create_const_vals(2); | 27155 | ZigValue *vals = ira->codegen->pass1_arena->allocate<ZigValue>(2); |
| 27193 | ZigValue *err_set_val = &vals[0]; | 27156 | ZigValue *err_set_val = &vals[0]; |
| 27194 | ZigValue *payload_val = &vals[1]; | 27157 | ZigValue *payload_val = &vals[1]; |
| 27195 | | 27158 | |
| ... | @@ -27270,7 +27233,7 @@ static IrInstGen *ir_analyze_unwrap_error_payload(IrAnalyze *ira, IrInst* source | ... | @@ -27270,7 +27233,7 @@ static IrInstGen *ir_analyze_unwrap_error_payload(IrAnalyze *ira, IrInst* source |
| 27270 | if (err_union_val == nullptr) | 27233 | if (err_union_val == nullptr) |
| 27271 | return ira->codegen->invalid_inst_gen; | 27234 | return ira->codegen->invalid_inst_gen; |
| 27272 | if (initializing && err_union_val->special == ConstValSpecialUndef) { | 27235 | if (initializing && err_union_val->special == ConstValSpecialUndef) { |
| 27273 | ZigValue *vals = create_const_vals(2); | 27236 | ZigValue *vals = ira->codegen->pass1_arena->allocate<ZigValue>(2); |
| 27274 | ZigValue *err_set_val = &vals[0]; | 27237 | ZigValue *err_set_val = &vals[0]; |
| 27275 | ZigValue *payload_val = &vals[1]; | 27238 | ZigValue *payload_val = &vals[1]; |
| 27276 | | 27239 | |
| ... | @@ -27332,7 +27295,7 @@ static IrInstGen *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstSrcFnPro | ... | @@ -27332,7 +27295,7 @@ static IrInstGen *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstSrcFnPro |
| 27332 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); | 27295 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); |
| 27333 | result->value->special = ConstValSpecialLazy; | 27296 | result->value->special = ConstValSpecialLazy; |
| 27334 | | 27297 | |
| 27335 | LazyValueFnType *lazy_fn_type = allocate<LazyValueFnType>(1, "LazyValueFnType"); | 27298 | LazyValueFnType *lazy_fn_type = heap::c_allocator.create<LazyValueFnType>(); |
| 27336 | lazy_fn_type->ira = ira; ira_ref(ira); | 27299 | lazy_fn_type->ira = ira; ira_ref(ira); |
| 27337 | result->value->data.x_lazy = &lazy_fn_type->base; | 27300 | result->value->data.x_lazy = &lazy_fn_type->base; |
| 27338 | lazy_fn_type->base.id = LazyValueIdFnType; | 27301 | lazy_fn_type->base.id = LazyValueIdFnType; |
| ... | @@ -27360,7 +27323,7 @@ static IrInstGen *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstSrcFnPro | ... | @@ -27360,7 +27323,7 @@ static IrInstGen *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstSrcFnPro |
| 27360 | | 27323 | |
| 27361 | size_t param_count = proto_node->data.fn_proto.params.length; | 27324 | size_t param_count = proto_node->data.fn_proto.params.length; |
| 27362 | lazy_fn_type->proto_node = proto_node; | 27325 | lazy_fn_type->proto_node = proto_node; |
| 27363 | lazy_fn_type->param_types = allocate<IrInstGen *>(param_count); | 27326 | lazy_fn_type->param_types = heap::c_allocator.allocate<IrInstGen *>(param_count); |
| 27364 | | 27327 | |
| 27365 | for (size_t param_index = 0; param_index < param_count; param_index += 1) { | 27328 | for (size_t param_index = 0; param_index < param_count; param_index += 1) { |
| 27366 | AstNode *param_node = proto_node->data.fn_proto.params.at(param_index); | 27329 | AstNode *param_node = proto_node->data.fn_proto.params.at(param_index); |
| ... | @@ -27515,7 +27478,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, | ... | @@ -27515,7 +27478,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 27515 | } | 27478 | } |
| 27516 | | 27479 | |
| 27517 | size_t field_prev_uses_count = ira->codegen->errors_by_index.length; | 27480 | size_t field_prev_uses_count = ira->codegen->errors_by_index.length; |
| 27518 | AstNode **field_prev_uses = allocate<AstNode *>(field_prev_uses_count, "AstNode *"); | 27481 | AstNode **field_prev_uses = heap::c_allocator.allocate<AstNode *>(field_prev_uses_count); |
| 27519 | | 27482 | |
| 27520 | for (size_t range_i = 0; range_i < instruction->range_count; range_i += 1) { | 27483 | for (size_t range_i = 0; range_i < instruction->range_count; range_i += 1) { |
| 27521 | IrInstSrcCheckSwitchProngsRange *range = &instruction->ranges[range_i]; | 27484 | IrInstSrcCheckSwitchProngsRange *range = &instruction->ranges[range_i]; |
| ... | @@ -27572,7 +27535,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, | ... | @@ -27572,7 +27535,7 @@ static IrInstGen *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 27572 | } | 27535 | } |
| 27573 | } | 27536 | } |
| 27574 | | 27537 | |
| 27575 | deallocate(field_prev_uses, field_prev_uses_count, "AstNode *"); | 27538 | heap::c_allocator.deallocate(field_prev_uses, field_prev_uses_count); |
| 27576 | } else if (switch_type->id == ZigTypeIdInt) { | 27539 | } else if (switch_type->id == ZigTypeIdInt) { |
| 27577 | RangeSet rs = {0}; | 27540 | RangeSet rs = {0}; |
| 27578 | for (size_t range_i = 0; range_i < instruction->range_count; range_i += 1) { | 27541 | for (size_t range_i = 0; range_i < instruction->range_count; range_i += 1) { |
| ... | @@ -27765,7 +27728,7 @@ static IrInstGen *ir_align_cast(IrAnalyze *ira, IrInstGen *target, uint32_t alig | ... | @@ -27765,7 +27728,7 @@ static IrInstGen *ir_align_cast(IrAnalyze *ira, IrInstGen *target, uint32_t alig |
| 27765 | } | 27728 | } |
| 27766 | | 27729 | |
| 27767 | IrInstGen *result = ir_const(ira, &target->base, result_type); | 27730 | IrInstGen *result = ir_const(ira, &target->base, result_type); |
| 27768 | copy_const_val(result->value, val); | 27731 | copy_const_val(ira->codegen, result->value, val); |
| 27769 | result->value->type = result_type; | 27732 | result->value->type = result_type; |
| 27770 | return result; | 27733 | return result; |
| 27771 | } | 27734 | } |
| ... | @@ -27861,7 +27824,7 @@ static IrInstGen *ir_analyze_ptr_cast(IrAnalyze *ira, IrInst* source_instr, IrIn | ... | @@ -27861,7 +27824,7 @@ static IrInstGen *ir_analyze_ptr_cast(IrAnalyze *ira, IrInst* source_instr, IrIn |
| 27861 | InferredStructField *isf = (val->type->id == ZigTypeIdPointer) ? | 27824 | InferredStructField *isf = (val->type->id == ZigTypeIdPointer) ? |
| 27862 | val->type->data.pointer.inferred_struct_field : nullptr; | 27825 | val->type->data.pointer.inferred_struct_field : nullptr; |
| 27863 | if (isf == nullptr) { | 27826 | if (isf == nullptr) { |
| 27864 | copy_const_val(result->value, val); | 27827 | copy_const_val(ira->codegen, result->value, val); |
| 27865 | } else { | 27828 | } else { |
| 27866 | // The destination value should have x_ptr struct pointing to underlying struct value | 27829 | // The destination value should have x_ptr struct pointing to underlying struct value |
| 27867 | result->value->data.x_ptr.mut = val->data.x_ptr.mut; | 27830 | result->value->data.x_ptr.mut = val->data.x_ptr.mut; |
| ... | @@ -28018,7 +27981,7 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ZigValue *val) | ... | @@ -28018,7 +27981,7 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ZigValue *val) |
| 28018 | while (gen_i < gen_field_count) { | 27981 | while (gen_i < gen_field_count) { |
| 28019 | size_t big_int_byte_count = val->type->data.structure.host_int_bytes[gen_i]; | 27982 | size_t big_int_byte_count = val->type->data.structure.host_int_bytes[gen_i]; |
| 28020 | if (big_int_byte_count > child_buf_len) { | 27983 | if (big_int_byte_count > child_buf_len) { |
| 28021 | child_buf = allocate_nonzero<uint8_t>(big_int_byte_count); | 27984 | child_buf = heap::c_allocator.allocate_nonzero<uint8_t>(big_int_byte_count); |
| 28022 | child_buf_len = big_int_byte_count; | 27985 | child_buf_len = big_int_byte_count; |
| 28023 | } | 27986 | } |
| 28024 | BigInt big_int; | 27987 | BigInt big_int; |
| ... | @@ -28081,7 +28044,7 @@ static Error buf_read_value_bytes_array(IrAnalyze *ira, CodeGen *codegen, AstNod | ... | @@ -28081,7 +28044,7 @@ static Error buf_read_value_bytes_array(IrAnalyze *ira, CodeGen *codegen, AstNod |
| 28081 | | 28044 | |
| 28082 | switch (val->data.x_array.special) { | 28045 | switch (val->data.x_array.special) { |
| 28083 | case ConstArraySpecialNone: | 28046 | case ConstArraySpecialNone: |
| 28084 | val->data.x_array.data.s_none.elements = create_const_vals(len); | 28047 | val->data.x_array.data.s_none.elements = codegen->pass1_arena->allocate<ZigValue>(len); |
| 28085 | for (size_t i = 0; i < len; i++) { | 28048 | for (size_t i = 0; i < len; i++) { |
| 28086 | ZigValue *elem = &val->data.x_array.data.s_none.elements[i]; | 28049 | ZigValue *elem = &val->data.x_array.data.s_none.elements[i]; |
| 28087 | elem->special = ConstValSpecialStatic; | 28050 | elem->special = ConstValSpecialStatic; |
| ... | @@ -28167,7 +28130,7 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou | ... | @@ -28167,7 +28130,7 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou |
| 28167 | } | 28130 | } |
| 28168 | case ContainerLayoutExtern: { | 28131 | case ContainerLayoutExtern: { |
| 28169 | size_t src_field_count = val->type->data.structure.src_field_count; | 28132 | size_t src_field_count = val->type->data.structure.src_field_count; |
| 28170 | val->data.x_struct.fields = alloc_const_vals_ptrs(src_field_count); | 28133 | val->data.x_struct.fields = alloc_const_vals_ptrs(codegen, src_field_count); |
| 28171 | for (size_t field_i = 0; field_i < src_field_count; field_i += 1) { | 28134 | for (size_t field_i = 0; field_i < src_field_count; field_i += 1) { |
| 28172 | ZigValue *field_val = val->data.x_struct.fields[field_i]; | 28135 | ZigValue *field_val = val->data.x_struct.fields[field_i]; |
| 28173 | field_val->special = ConstValSpecialStatic; | 28136 | field_val->special = ConstValSpecialStatic; |
| ... | @@ -28184,7 +28147,7 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou | ... | @@ -28184,7 +28147,7 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou |
| 28184 | } | 28147 | } |
| 28185 | case ContainerLayoutPacked: { | 28148 | case ContainerLayoutPacked: { |
| 28186 | size_t src_field_count = val->type->data.structure.src_field_count; | 28149 | size_t src_field_count = val->type->data.structure.src_field_count; |
| 28187 | val->data.x_struct.fields = alloc_const_vals_ptrs(src_field_count); | 28150 | val->data.x_struct.fields = alloc_const_vals_ptrs(codegen, src_field_count); |
| 28188 | size_t gen_field_count = val->type->data.structure.gen_field_count; | 28151 | size_t gen_field_count = val->type->data.structure.gen_field_count; |
| 28189 | size_t gen_i = 0; | 28152 | size_t gen_i = 0; |
| 28190 | size_t src_i = 0; | 28153 | size_t src_i = 0; |
| ... | @@ -28196,7 +28159,7 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou | ... | @@ -28196,7 +28159,7 @@ static Error buf_read_value_bytes(IrAnalyze *ira, CodeGen *codegen, AstNode *sou |
| 28196 | while (gen_i < gen_field_count) { | 28159 | while (gen_i < gen_field_count) { |
| 28197 | size_t big_int_byte_count = val->type->data.structure.host_int_bytes[gen_i]; | 28160 | size_t big_int_byte_count = val->type->data.structure.host_int_bytes[gen_i]; |
| 28198 | if (big_int_byte_count > child_buf_len) { | 28161 | if (big_int_byte_count > child_buf_len) { |
| 28199 | child_buf = allocate_nonzero<uint8_t>(big_int_byte_count); | 28162 | child_buf = heap::c_allocator.allocate_nonzero<uint8_t>(big_int_byte_count); |
| 28200 | child_buf_len = big_int_byte_count; | 28163 | child_buf_len = big_int_byte_count; |
| 28201 | } | 28164 | } |
| 28202 | BigInt big_int; | 28165 | BigInt big_int; |
| ... | @@ -28306,7 +28269,7 @@ static IrInstGen *ir_analyze_bit_cast(IrAnalyze *ira, IrInst* source_instr, IrIn | ... | @@ -28306,7 +28269,7 @@ static IrInstGen *ir_analyze_bit_cast(IrAnalyze *ira, IrInst* source_instr, IrIn |
| 28306 | return ira->codegen->invalid_inst_gen; | 28269 | return ira->codegen->invalid_inst_gen; |
| 28307 | | 28270 | |
| 28308 | IrInstGen *result = ir_const(ira, source_instr, dest_type); | 28271 | IrInstGen *result = ir_const(ira, source_instr, dest_type); |
| 28309 | uint8_t *buf = allocate_nonzero<uint8_t>(src_size_bytes); | 28272 | uint8_t *buf = heap::c_allocator.allocate_nonzero<uint8_t>(src_size_bytes); |
| 28310 | buf_write_value_bytes(ira->codegen, buf, val); | 28273 | buf_write_value_bytes(ira->codegen, buf, val); |
| 28311 | if ((err = buf_read_value_bytes(ira, ira->codegen, source_instr->source_node, buf, result->value))) | 28274 | if ((err = buf_read_value_bytes(ira, ira->codegen, source_instr->source_node, buf, result->value))) |
| 28312 | return ira->codegen->invalid_inst_gen; | 28275 | return ira->codegen->invalid_inst_gen; |
| ... | @@ -28448,7 +28411,7 @@ static IrInstGen *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstSrcPtrTy | ... | @@ -28448,7 +28411,7 @@ static IrInstGen *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstSrcPtrTy |
| 28448 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); | 28411 | IrInstGen *result = ir_const(ira, &instruction->base.base, ira->codegen->builtin_types.entry_type); |
| 28449 | result->value->special = ConstValSpecialLazy; | 28412 | result->value->special = ConstValSpecialLazy; |
| 28450 | | 28413 | |
| 28451 | LazyValuePtrType *lazy_ptr_type = allocate<LazyValuePtrType>(1, "LazyValuePtrType"); | 28414 | LazyValuePtrType *lazy_ptr_type = heap::c_allocator.create<LazyValuePtrType>(); |
| 28452 | lazy_ptr_type->ira = ira; ira_ref(ira); | 28415 | lazy_ptr_type->ira = ira; ira_ref(ira); |
| 28453 | result->value->data.x_lazy = &lazy_ptr_type->base; | 28416 | result->value->data.x_lazy = &lazy_ptr_type->base; |
| 28454 | lazy_ptr_type->base.id = LazyValueIdPtrType; | 28417 | lazy_ptr_type->base.id = LazyValueIdPtrType; |
| ... | @@ -29147,11 +29110,11 @@ static IrInstGen *ir_analyze_instruction_bswap(IrAnalyze *ira, IrInstSrcBswap *i | ... | @@ -29147,11 +29110,11 @@ static IrInstGen *ir_analyze_instruction_bswap(IrAnalyze *ira, IrInstSrcBswap *i |
| 29147 | return ir_const_undef(ira, &instruction->base.base, op_type); | 29110 | return ir_const_undef(ira, &instruction->base.base, op_type); |
| 29148 | | 29111 | |
| 29149 | IrInstGen *result = ir_const(ira, &instruction->base.base, op_type); | 29112 | IrInstGen *result = ir_const(ira, &instruction->base.base, op_type); |
| 29150 | size_t buf_size = int_type->data.integral.bit_count / 8; | 29113 | const size_t buf_size = int_type->data.integral.bit_count / 8; |
| 29151 | uint8_t *buf = allocate_nonzero<uint8_t>(buf_size); | 29114 | uint8_t *buf = heap::c_allocator.allocate_nonzero<uint8_t>(buf_size); |
| 29152 | if (is_vector) { | 29115 | if (is_vector) { |
| 29153 | expand_undef_array(ira->codegen, val); | 29116 | expand_undef_array(ira->codegen, val); |
| 29154 | result->value->data.x_array.data.s_none.elements = create_const_vals(op_type->data.vector.len); | 29117 | result->value->data.x_array.data.s_none.elements = ira->codegen->pass1_arena->allocate<ZigValue>(op_type->data.vector.len); |
| 29155 | for (unsigned i = 0; i < op_type->data.vector.len; i += 1) { | 29118 | for (unsigned i = 0; i < op_type->data.vector.len; i += 1) { |
| 29156 | ZigValue *op_elem_val = &val->data.x_array.data.s_none.elements[i]; | 29119 | ZigValue *op_elem_val = &val->data.x_array.data.s_none.elements[i]; |
| 29157 | if ((err = ir_resolve_const_val(ira->codegen, ira->new_irb.exec, instruction->base.base.source_node, | 29120 | if ((err = ir_resolve_const_val(ira->codegen, ira->new_irb.exec, instruction->base.base.source_node, |
| ... | @@ -29175,7 +29138,7 @@ static IrInstGen *ir_analyze_instruction_bswap(IrAnalyze *ira, IrInstSrcBswap *i | ... | @@ -29175,7 +29138,7 @@ static IrInstGen *ir_analyze_instruction_bswap(IrAnalyze *ira, IrInstSrcBswap *i |
| 29175 | bigint_read_twos_complement(&result->value->data.x_bigint, buf, int_type->data.integral.bit_count, false, | 29138 | bigint_read_twos_complement(&result->value->data.x_bigint, buf, int_type->data.integral.bit_count, false, |
| 29176 | int_type->data.integral.is_signed); | 29139 | int_type->data.integral.is_signed); |
| 29177 | } | 29140 | } |
| 29178 | free(buf); | 29141 | heap::c_allocator.deallocate(buf, buf_size); |
| 29179 | return result; | 29142 | return result; |
| 29180 | } | 29143 | } |
| 29181 | | 29144 | |
| ... | @@ -29207,8 +29170,8 @@ static IrInstGen *ir_analyze_instruction_bit_reverse(IrAnalyze *ira, IrInstSrcBi | ... | @@ -29207,8 +29170,8 @@ static IrInstGen *ir_analyze_instruction_bit_reverse(IrAnalyze *ira, IrInstSrcBi |
| 29207 | IrInstGen *result = ir_const(ira, &instruction->base.base, int_type); | 29170 | IrInstGen *result = ir_const(ira, &instruction->base.base, int_type); |
| 29208 | size_t num_bits = int_type->data.integral.bit_count; | 29171 | size_t num_bits = int_type->data.integral.bit_count; |
| 29209 | size_t buf_size = (num_bits + 7) / 8; | 29172 | size_t buf_size = (num_bits + 7) / 8; |
| 29210 | uint8_t *comptime_buf = allocate_nonzero<uint8_t>(buf_size); | 29173 | uint8_t *comptime_buf = heap::c_allocator.allocate_nonzero<uint8_t>(buf_size); |
| 29211 | uint8_t *result_buf = allocate_nonzero<uint8_t>(buf_size); | 29174 | uint8_t *result_buf = heap::c_allocator.allocate_nonzero<uint8_t>(buf_size); |
| 29212 | memset(comptime_buf,0,buf_size); | 29175 | memset(comptime_buf,0,buf_size); |
| 29213 | memset(result_buf,0,buf_size); | 29176 | memset(result_buf,0,buf_size); |
| 29214 | | 29177 | |
| ... | @@ -29894,7 +29857,7 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutableSrc *old_exec, IrExecutableGen | ... | @@ -29894,7 +29857,7 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutableSrc *old_exec, IrExecutableGen |
| 29894 | assert(old_exec->first_err_trace_msg == nullptr); | 29857 | assert(old_exec->first_err_trace_msg == nullptr); |
| 29895 | assert(expected_type == nullptr || !type_is_invalid(expected_type)); | 29858 | assert(expected_type == nullptr || !type_is_invalid(expected_type)); |
| 29896 | | 29859 | |
| 29897 | IrAnalyze *ira = allocate<IrAnalyze>(1, "IrAnalyze"); | 29860 | IrAnalyze *ira = heap::c_allocator.create<IrAnalyze>(); |
| 29898 | ira->ref_count = 1; | 29861 | ira->ref_count = 1; |
| 29899 | old_exec->analysis = ira; | 29862 | old_exec->analysis = ira; |
| 29900 | ira->codegen = codegen; | 29863 | ira->codegen = codegen; |