ISA-independent programming language
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
ISA-independent programming language
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Computer Architecture
Author Message
mihai cartoaje
Guest





Posted: Thu Aug 18, 2005 4:03 pm    Post subject: Re: ISA-independent programming language Reply with quote

The linker quits with an error message.

Linux on the 970 runs 32 and 64 bits programs. Maybe they have an idea
how to mix the two.
Back to top
Ken Hagan
Guest





Posted: Thu Aug 18, 2005 4:15 pm    Post subject: Re: ISA-independent programming language Reply with quote

Andrew Reilly wrote:
Quote:

Do you suggest that evenness be tested by actual division and
multiplication, rather than masking off the LSB?

Well I'd *define* evenness as "x%2==0".

Since that happens to be valid syntax, I'd be sorely tempted to
write exactly that and I'd expect the compiler to sort it out.

I also have a modest preference for making casts and truncating
conversions explicit, so I suppose that marks me out as one who
prefers to express intent rather than implementation, even when
it is at the cost of (source code) verbosity.

I also have an irrational hatred of "unsigned integers", which I
regard as an oxymoron. (I say irrational, since even if others
believe that they can justify their venom, and they do, I don't
believe that I can justify mine.)

To take up a later remark; yes, this does require a peephole
optimisation but in my experience compilers are pretty good at
those (and would certainly be good at *that* one if the language
didn't support shifting on integers).
Back to top
Hank Oredson
Guest





Posted: Thu Aug 18, 2005 4:15 pm    Post subject: Re: ISA-independent programming language Reply with quote

"Ken Hagan" <K.Hagan@thermoteknix.co.uk> wrote in message
news:de1rbu$fi8$1$8302bc10@news.demon.co.uk...
Quote:
Andrew Reilly wrote:

Do you suggest that evenness be tested by actual division and
multiplication, rather than masking off the LSB?

Well I'd *define* evenness as "x%2==0".

Since that happens to be valid syntax, I'd be sorely tempted to
write exactly that and I'd expect the compiler to sort it out.

I also have a modest preference for making casts and truncating
conversions explicit, so I suppose that marks me out as one who
prefers to express intent rather than implementation, even when
it is at the cost of (source code) verbosity.

I also have an irrational hatred of "unsigned integers", which I
regard as an oxymoron. (I say irrational, since even if others
believe that they can justify their venom, and they do, I don't
believe that I can justify mine.)

Would it help if they were called "counting number" or "indices"?

Quote:
To take up a later remark; yes, this does require a peephole
optimisation but in my experience compilers are pretty good at
those (and would certainly be good at *that* one if the language
didn't support shifting on integers).


--

... Hank

http://home.earthlink.net/~horedson
http://home.earthlink.net/~w0rli
Back to top
Hank Oredson
Guest





Posted: Thu Aug 18, 2005 4:15 pm    Post subject: Re: ISA-independent programming language Reply with quote

"mihai cartoaje" <repstsb@yahoo.ca> wrote in message
news:1124362613.626357.186720@o13g2000cwo.googlegroups.com...
Quote:

Hank Oredson wrote:

It doesn't matter, the compiler takes care of it.
Why should I care what size they are?

If I had posted on comp.lang.misc, I would have written about a
isa-independent and compiler-independent programming language. I left
out the compiler-independent part to post to comp.arch. If different C
compilers have a different range for int, it is possible for a program
to know what compiler it is on by testing it.

For a real world application, the PCI configuration space contains
32-bit data. To read it, svgalib uses "long int".


But some (or all? don't have spec handy) of the 32 bit values are unsigned.

--

... Hank

http://home.earthlink.net/~horedson
http://home.earthlink.net/~w0rli
Back to top
Anton Ertl
Guest





Posted: Thu Aug 18, 2005 9:42 pm    Post subject: Re: ISA-independent programming language Reply with quote

Ken Hagan <K.Hagan@thermoteknix.co.uk> writes:
Quote:
Andrew Reilly wrote:

Do you suggest that evenness be tested by actual division and
multiplication, rather than masking off the LSB?

Well I'd *define* evenness as "x%2==0".

Let's see:

[b1:~/tmp:1916] cat xxx.c
int foo(int x)
{
return x%2==0;
}
[b1:~/tmp:1914] ccc -c -O5 xxx.c
[b1:~/tmp:1915] objdump -d xxx.o

xxx.o: file format elf64-alpha

Disassembly of section .text:

0000000000000000 <foo>:
0: 10 00 f0 43 sextl a0,a0
4: 02 30 00 46 and a0,0x1,t1
8: 05 00 00 ea blt a0,20 <foo+0x20>
c: a0 15 40 40 cmpeq t1,0,v0
10: 01 80 fa 6b ret zero,(ra),0x1
14: 00 00 fe 2f unop
18: 00 00 fe 2f unop
1c: 00 00 fe 2f unop
20: fa ff 5f e4 beq t1,c <foo+0xc>
24: fe ff 42 20 lda t1,-2(t1)
28: a0 15 40 40 cmpeq t1,0,v0
2c: 00 00 fe 2f unop
30: 01 80 fa 6b ret zero,(ra),0x1
[b1:~/tmp:1920] ccc -V
Compaq C V6.4-005 on Linux 2.4.18-4.1nhdcustom alpha

Hmm, I think there are better ways to implement this. Let's see if
gcc does better:

[b1:~/tmp:1917] gcc -c -O3 xxx.c
[b1:~/tmp:1918] objdump -d xxx.o

xxx.o: file format elf64-alpha

Disassembly of section .text:

0000000000000000 <foo>:
0: 00 30 00 46 and a0,0x1,v0
4: 00 38 00 44 xor v0,0x1,v0
8: 01 80 fa 6b ret zero,(ra),0x1
[b1:~/tmp:1921] gcc -v
....
gcc version 2.95.2 19991024 (release)

Ok, that looks optimal to me.

Quote:
Since that happens to be valid syntax, I'd be sorely tempted to
write exactly that and I'd expect the compiler to sort it out.

Sometimes compilers surprise me by how good they are, and sometimes by
how bad they are. If I want performance, I have learned that trying
to get the compiler to optimize higher-level code leads to much
wasting of time and to brittle performance (i.e., the next compiler or
even a different version of the same compiler could fail to optimize
what worked well on the version I tried).

Of course, that has to be balanced against cases where doing an
optimization by hand blocks other optimizations by the compiler, but
I don't think that this problem arises in the case of x%2 vs. x&1.

- anton
--
M. Anton Ertl Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html
Back to top
Del Cecchi
Guest





Posted: Thu Aug 18, 2005 9:59 pm    Post subject: Re: ISA-independent programming language Reply with quote

Hank Oredson wrote:
Quote:
"Andrew Reilly" <andrew-newspost@areilly.bpc-users.org> wrote in message
news:pan.2005.08.16.23.17.23.275987@areilly.bpc-users.org...

On Tue, 16 Aug 2005 15:35:18 +0000, Hank Oredson wrote:


"Anton Ertl" <anton@mips.complang.tuwien.ac.at> wrote in message
news:2005Aug16.075744@mips.complang.tuwien.ac.at...

"Hank Oredson" <horedson@earthlink.net> writes:

It doesn't matter, the compiler takes care of it.
A number is a number.
It must have a defined range, whether there are one
or two representations for zero should not matter to me.

It does, if the language supports bitwise operations on integers.

The language needs the correct data types for the operations
it supports. If a bitset is needed, the language should provide it.

This is a foolish position to hold, in my opinion. Bitwise operators are
fundamentally mathematical, and sensibly operate on integers (mostly
unsigned, but there are uses on signed integers, if you can assume the
representation, 2-s complement being the most common.)


Um ... what is foolish about suggesting the language provide
the features needed? How else would they be provided?


Do you suggest that evenness be tested by actual division and
multiplication, rather than masking off the LSB?


I suggested no such thing. I suggested the language provide the
features needed. If you need the ability to know if a given number
is even or odd, the language must provide such a construct.


Sure, lots of the sorts of operations that result in "arithmetic" and
"logical" operations being mixed in expressions can alternatively be
written in terms of multiplication, division and modulo operations. You
even get to use arbitrary length buffers and intervals. However in real
systems efficiency matters. One can recognise that by making one's
modulo arithmetic based on powers of two, many of these operations
simplify to bit-wise operations, and a dramatic reduction in execution
cost can be achieved, in some circumstances.


Thus the language must provide what you need.
How else would they be provided?


It is concievable that many of the common patterns of use could be
recognised by compilers as peep-hole optimisations, and the efficient
bit-wise operations made where arithmetic operations are specified.
Frankly, I don't want to have to rely on that sort of algorithm selection
behind my back. If the language advocates are going to rely on that sort
of thing, then those transformations must be part of the language
specification so that they can be relied on by programmers.


Like I said above.


Or, more simply, just allow intermixing of arithmetic and logical
operations.


How have I suggested these things might be NOT allowed?


Of course my tongue is in my cheek as usual, and I personally
would find such a language useless. But I'm willing to write the
underlying "stuff" like FP operations and ISRs for each hardware
I encounter, and do that in assembler. But I'm a hardware person
first and a software person second (smile).

I wonder whether it is indeed possible to design a language that is
simultaneously "safe", or "portable", or whatever the original poster was
looking for, and also useful. I'll choose sharp and useful, myself, as a
general rule, but I do find myself mixing Matlab, Python, Scheme and Java
into my C and assembler these days. Safe and easy are useful benefits in
situations where speed isn't important. Many things that wait for a human
come into that category.


The original poster was looking for a language that had pointers,
and was also ISA indepenent. This is really pretty simple. Just a
small matter of language definition and compiler construction.

The question is really about compilers and libraries, nothing more.

The other questions, such as efficiency, speed of execution,
complexity of writing programs, are just obfuscation.

The answer to his question is an unqualified "yes".
All the rest is implementation detail.

He can just buy a s/38 or follow on. MI is machine independent

language. With pointers and all that.

del

--
Del Cecchi
"This post is my own and doesn’t necessarily represent IBM’s positions,
strategies or opinions.”
Back to top
Terje Mathisen
Guest





Posted: Thu Aug 18, 2005 11:24 pm    Post subject: Re: ISA-independent programming language Reply with quote

Hank Oredson wrote:

Quote:
"Ken Hagan" <K.Hagan@thermoteknix.co.uk> wrote in message
I also have an irrational hatred of "unsigned integers", which I
regard as an oxymoron. (I say irrational, since even if others
believe that they can justify their venom, and they do, I don't
believe that I can justify mine.)

Would it help if they were called "counting number" or "indices"?

Modula-2 CARDINAL anyone?

Terje

--
- <Terje.Mathisen@hda.hydro.com>
"almost all programming can be viewed as an exercise in caching"
Back to top
Nick Maclaren
Guest





Posted: Thu Aug 18, 2005 11:51 pm    Post subject: Re: ISA-independent programming language Reply with quote

In article <de2jnh$94f$1@osl016lin.hda.hydro.com>,
Terje Mathisen <terje.mathisen@hda.hydro.com> wrote:
Quote:
Hank Oredson wrote:

"Ken Hagan" <K.Hagan@thermoteknix.co.uk> wrote in message
I also have an irrational hatred of "unsigned integers", which I
regard as an oxymoron. (I say irrational, since even if others
believe that they can justify their venom, and they do, I don't
believe that I can justify mine.)

Would it help if they were called "counting number" or "indices"?

Modula-2 CARDINAL anyone?

Well, since I never found a specification of any of the Modulas that
was even as precise as that of Fortran II, I have no idea whether
that is an adequate idea or a disaster. Wirth didn't believe in
specifications and his followers, er, followed :-(

The reasons that modern 'unsigned integers' are a disaster are that
they mix up various mathematical concepts and omit all checking of
when one breaks down and turns into another.

Addition, subtraction and multiplication are performed modulo N,
and left shifting is analogous.

Division and remaindering are performed as if in Z, with truncation,
and right shifting is analogous.


Logical operations are performed as if in Z, with the number represented
in binary.

Ordering is also performed as if in Z.

That's a mess, and the mess leads to errors. Undetectable errors.


Regards,
Nick Maclaren.
Back to top
Peter \"Firefly\" Lund
Guest





Posted: Fri Aug 19, 2005 12:01 am    Post subject: Re: ISA-independent programming language Reply with quote

On Thu, 18 Aug 2005, Hank Oredson wrote:

Quote:
I also have an irrational hatred of "unsigned integers", which I
regard as an oxymoron. (I say irrational, since even if others
believe that they can justify their venom, and they do, I don't
believe that I can justify mine.)

Would it help if they were called "counting number" or "indices"?

Or "cardinal"?

Modula-2 really is a nice language.

-Peter
Back to top
Guest






Posted: Fri Aug 19, 2005 12:14 am    Post subject: Re: ISA-independent programming language Reply with quote

Nick Maclaren wrote:
Quote:
snip

Well, since I never found a specification of any of the Modulas that
was even as precise as that of Fortran II, I have no idea whether
that is an adequate idea or a disaster. Wirth didn't believe in
specifications and his followers, er, followed :-(
snip
Then you never looked at the ISO standard for Modula 2? The standard

uses VDM to provide a very detailed specification. However, the use of
VDM and the definition of a (overly large) library resulted in a
standard an order of magnitude larger than what Wirth considered
necessary. It was a shock to followers of Wirth when his ~50 page
description expanded to 700+ pages when standardized. It was a
disappointment to them that standardization took so long that Modula 2
was no longer in significant use upon completion (94?).
Back to top
Nick Maclaren
Guest





Posted: Fri Aug 19, 2005 12:15 am    Post subject: Re: ISA-independent programming language Reply with quote

In article <1124392489.091561.53190@z14g2000cwz.googlegroups.com>,
<wclodius@lanl.gov> wrote:
Quote:
Nick Maclaren wrote:

Well, since I never found a specification of any of the Modulas that
was even as precise as that of Fortran II, I have no idea whether
that is an adequate idea or a disaster. Wirth didn't believe in
specifications and his followers, er, followed :-(

Then you never looked at the ISO standard for Modula 2?

No. For reasons that you describe.

Quote:
The standard
uses VDM to provide a very detailed specification. However, the use of
VDM and the definition of a (overly large) library resulted in a
standard an order of magnitude larger than what Wirth considered
necessary. It was a shock to followers of Wirth when his ~50 page
description expanded to 700+ pages when standardized. It was a
disappointment to them that standardization took so long that Modula 2
was no longer in significant use upon completion (94?).

As with Pascal!

And how compatible was the standard with the Modula 2 that Wirth
exposed to the world?

Fortran and C++ managed to steer between the Scylla of a hopelessly
ambiguous and incomplete language and the Charybdis of missing the
boat, but most attempts to standardise a hacked-together language
have foundered on one or the other. There is no substitute for
starting with a clean design.


Regards,
Nick Maclaren.
Back to top
Peter \"Firefly\" Lund
Guest





Posted: Fri Aug 19, 2005 5:44 am    Post subject: Re: ISA-independent programming language Reply with quote

On Thu, 18 Aug 2005, Nick Maclaren wrote:

Quote:
have foundered on one or the other. There is no substitute for
starting with a clean design.

I guess that's why Perl works so well.

-Peter
Back to top
mihai cartoaje
Guest





Posted: Fri Aug 19, 2005 8:15 am    Post subject: Re: ISA-independent programming language Reply with quote

checked the matrox millenium driver and it's unsigned long.
Back to top
Nick Maclaren
Guest





Posted: Fri Aug 19, 2005 8:15 am    Post subject: Re: ISA-independent programming language Reply with quote

In article <Pine.LNX.4.61.0508190243100.23274@ask.diku.dk>,
Peter \"Firefly\" Lund <firefly@diku.dk> wrote:
Quote:
On Thu, 18 Aug 2005, Nick Maclaren wrote:

have foundered on one or the other. There is no substitute for
starting with a clean design.

I guess that's why Perl works so well.

Never confuse popularity with technical quality.


Regards,
Nick Maclaren.
Back to top
Torben Ægidius Mogensen
Guest





Posted: Fri Aug 19, 2005 2:13 pm    Post subject: Re: ISA-independent programming language Reply with quote

nmm1@cus.cam.ac.uk (Nick Maclaren) writes:


Quote:
Fortran and C++ managed to steer between the Scylla of a hopelessly
ambiguous and incomplete language and the Charybdis of missing the
boat,

I'm not sure C++ has avoided being ambiguous and incomplete. I'm
willing to accept that it avoided incompleteness, but it is voefully
ambiguous.

Quote:
but most attempts to standardise a hacked-together language have
foundered on one or the other.

Including that of C++.

Quote:
There is no substitute for starting with a clean design.

Very true, but C++ didn't.

Torben
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> Computer Architecture All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 3 of 6

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB