Hi Ricardo
The LLVM patch is from back in the day (Extempore originally built
against LLVM 2). I think @digego did some work at the time to try and
get it upstreamed (with no success), but that was 5+ years ago so I
can't remember the details. Since then, it's become part of the
furniture.
> I would also like to know why the patch is needed. Has it been reported
> to LLVM upstream? I just patched Extempore to build with LLVM 3.5 but
> the patch still seems to be necessary.
> Even in LLVM 3.6 this area of LLParser.cpp has not been touched, so I
> wonder if this issue is a) at all known to LLVM upstream, and b) really
> a problem that should be fixed in LLVM or rather an issue in Extempore.
> The comment says
>
> // If the type hasn't been defined yet, create a forward definition and
> // remember where that forward def'n was seen (in case it never is defined).
>
> Not knowing anything about LLVM or Extempore it seems to me that the
> patch would not be needed if the encountered type with name
> 'Lex.getStrVal()' would only need to be a member of 'NamedTypes'.
>
> Looking at the patch I wonder why 'M->getTypeByName(Lex.getStrVal())'
> would return a type when 'NamedTypes[Lex.getStrVal()]' does not.
> 'ParseStructDefinition' should take care of recording the encountered
> type in 'NamedTypes' already.
Thanks for investigating - I'll have a look.
> I think this problem should be solved in Extempore rather than in LLVM.
> It would help to know what the actual problem is this patch should fix.
If possible, then that would certainly be nice. As the primary
"packager" of Extempore (a job which I do well in some ways and poorly
in others) then I'd love to not have to maintain my own fork of the LLVM
packages on each system. Homebrew has helped with this so far, but I
agree it's an impediment to other packaging options.
> The error when loading "libs/core/std.xtm" is:
>
> SetValue: NaNf >>> float
> SetValue: NaNd >>> double
> Extempore: <string>:46:18: error: '@llvm_zone_malloc' defined with type 'i8* (%mzone*, i64)*'
> %dat9 = call i8* @llvm_zone_malloc(%mzone* %zone8, i64 4)
>
> I don't understand the error; does it complain about a type mismatch?
The error is actually from LLVM, it's saying that Extempore has
generated the LLVM IR, but that LLVM can't compile it (even though it
should be able to, and can after the patch is applied).
Thanks for the heads up on this (and see my comments on the GH issues
you opened for more info). I'll see what I can find out.