perf(lang): Reuse generic specialization arguments

69f1402c439b4827861712db9f64a1031a85f81b0cf6483e4ee753a54c2664c6
Specialization arguments already use canonical resolver-owned type pointers and arena storage. Keep that slice instead of allocating and interning a duplicate before substitution.
Alexis Sellier committed ago 1 parent fccaefc7
lib/std/lang/resolver.rad +2 -7
4118 4118
    set self.genericSpecializationCount += 1;
4119 4119
    let template = genericTemplateFor(self, templateSym)
4120 4120
        else throw emitError(self, site, ErrorKind::Internal);
4121 4121
    let signature = template.signature
4122 4122
        else throw emitError(self, site, ErrorKind::GenericFunctionExpected);
4123 -
    let a = alloc::arenaAllocator(&mut self.arena);
4124 -
    let mut storedArgs: *mut [*Type] = &mut [];
4125 -
    for arg in args {
4126 -
        storedArgs.append(allocType(self, *arg), a);
4127 -
    }
4128 -
    let sub = Substitution { params: template.params, args: &storedArgs[..] };
4123 +
    let sub = Substitution { params: template.params, args };
4129 4124
    let concrete = try substituteType(self, Type::Fn(signature), &sub, site);
4130 4125
    let case Type::Fn(fnType) = concrete
4131 4126
        else throw emitError(self, site, ErrorKind::Internal);
4132 4127
    let _ = markGenericDataTypeRooted(self, concrete);
4133 4128
    let specialization = try! alloc::alloc(
4135 4130
        @sizeOf(GenericFnSpecialization),
4136 4131
        @alignOf(GenericFnSpecialization),
4137 4132
    ) as *mut GenericFnSpecialization;
4138 4133
    set *specialization = GenericFnSpecialization {
4139 4134
        template: templateSym,
4140 -
        args: &storedArgs[..],
4135 +
        args,
4141 4136
        fnType,
4142 4137
        site,
4143 4138
        state: GenericFnState::Queued,
4144 4139
        depth,
4145 4140
        typesMaterialized: false,