perf(lang): Reuse generic data arguments

f673b523456df7d2090f8031d616be5b7ca66e8f5fd6995b02f2d0521b476127
Generic data arguments already live in resolver arena storage. Use that slice for cache identity and substitution instead of allocating a second pointer array.
Alexis Sellier committed ago 1 parent 69f1402c
lib/std/lang/resolver.rad +2 -7
3950 3950
        throw emitError(self, site, ErrorKind::GenericSpecializationLimit);
3951 3951
    }
3952 3952
    set self.genericSpecializationCount += 1;
3953 3953
    let template = genericTemplateFor(self, templateSym)
3954 3954
        else throw emitError(self, site, ErrorKind::Internal);
3955 -
    let a = alloc::arenaAllocator(&mut self.arena);
3956 -
    let mut storedArgs: *mut [*Type] = &mut [];
3957 -
    for arg in args {
3958 -
        storedArgs.append(arg, a);
3959 -
    }
3960 3955
    let nominal = allocNominalType(
3961 3956
        self, NominalType::Placeholder(templateSym.node)
3962 3957
    );
3963 3958
    let specialization = try! alloc::alloc(
3964 3959
        &mut self.arena,
3965 3960
        @sizeOf(GenericDataSpecialization),
3966 3961
        @alignOf(GenericDataSpecialization),
3967 3962
    ) as *mut GenericDataSpecialization;
3968 3963
    set *specialization = GenericDataSpecialization {
3969 3964
        template: templateSym,
3970 -
        args: &storedArgs[..],
3965 +
        args,
3971 3966
        nominal,
3972 3967
        rooted,
3973 3968
        site,
3974 3969
        next: self.genericDataSpecializations,
3975 3970
    };
3976 3971
    set self.genericDataSpecializations = specialization;
3977 -
    let sub = Substitution { params: template.params, args: &storedArgs[..] };
3972 +
    let sub = Substitution { params: template.params, args };
3978 3973
    let source = AggregateMemberSource::Generic {
3979 3974
        members: template.members,
3980 3975
        substitution: &sub,
3981 3976
    };
3982 3977
    match templateSym.node.value {