Re: Architectural support for programming languages



"Mayank Kaushik" <prehistorictoad2k@xxxxxxxxx> writes:
In an introductory class i also heard about processors being optimized
for particular languages. This has me confused, what would be a
microarchitectural feature that would make a, say, C compiler`s job
easier?

It's not just about making the compiler's job easier, it's mainly
about making programming language idioms run faster (especially if you
are discussing the microarchitecture).

E.g., C has more and harder-to-predict conditional branches than some
other languages (partly due to the short-circuit evaluation of flags),
so if you want to have a microarchitecture that flies on C code, you
will invest more in the branch predictor than with other languages.

Concerning architectural features: For C, which is a relatively
machine-oriented language, there are not that many such features as
for other languages, but there still are some:

- Comparison instructions on MIPS and Alpha and SETcc on the IA-32 and
AMD64 architectures produce 1 for true and 0 for false, rather than,
e.g., all-bits-set and all-bits clear (which would be better support
for Forth).

- Alpha has string support instructions for C's zero-terminated
strings.

and how would it not (possibly) be of much use to another
language?

If you don't have zero-terminated strings, the corresponding
instructions are useless. If you don't call and return much (like
many Fortran programs), you won't profit much from a return stack. If
you don't do many conditional branches (e.g., Forth), a
conditional-branch predictor will not be of much benefit.

Additionally, would object oriented languages like C++ or
Java perform better with support in a microarchitecture? could you give
an example of any such support feature?

An indirect-branch predictor.

- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@xxxxxxxxxxxxxxxxxxxxxxxxxx Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
.



Relevant Pages

  • Re: How easy is it to learn VB compared to C#?
    ... assemblies - there just is no support in the ide. ... I'm sure that's the case for you, but the languages will always be uneven. ... Even if each language should develop the feature that the other one is currently ... to write inline assembler. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Intel details future Larrabee graphics chip
    ... becomes much harder if a feature is built into the language (or if the language ... large unwind tables and runtime support routines. ... Languages with these properties are inadequate for software engineering. ... A specialized string class ...
    (comp.arch)
  • Re: The map of typological features
    ... No, I don't know of these languages, though I don't ... So this feature only counts when combined with other features?! ... Only for those who don't know what linguistics is. ... not being a tone language). ...
    (sci.lang)
  • Re: XLF V13.1 release for AIX -- fully compliant Fortran 2003 standard
    ... other known languages seem to support similar language feature. ... wouldn't think of PDTs as a viable choice. ... In the abstract (based purely on a rough understanding of the feature and no knowledge of its details), I suspect it might be feasible to hook into C++ templates in some way or another. ... Any generic programming feature will have issues with interop, as there are relatively few other languages that support that. ...
    (comp.lang.fortran)
  • Re: SQL
    ... That is a language-specific feature. ... we are talking about features of languages. ... Relational only cares that the "expression engine" follow a minimum set ... linear programming and other optimization problems, ...
    (comp.object)