[OT] Gosling on the object/primitive gap

George Bosworth georgeb at microsoft.com
Wed Aug 13 00:39:30 UTC 2003


Not really that hard, here it is in C# (with the expansion for the
expression a=b+c shown, and some manipulations on it. 

using System;
class Class1{
	static void Main(string[] args)
	{
		string s = System.Console.ReadLine();

//to fool the optimizer so it doesn't completely optimize things away

		int b = Math.Max(3, int.Parse(args[0]));
		int c = Math.Max(4, int.Parse(args[1]));

//here is the addition
		int a = b+c;

//0000006e  lea ebp,[edi+ebx] ; Here is the one generated instruction

//some operations on it 
		Object[] array = new Object[4];
		array[0] = b;
		array[1] = c;
		array[2] = a;
            int d = (int) array[2];
		array[3] = d;
		System.Console.WriteLine("{0}+{1}={2} {3} really",
array);
	}
}


-----Original Message-----
From: squeak-dev-bounces at lists.squeakfoundation.org
[mailto:squeak-dev-bounces at lists.squeakfoundation.org] On Behalf Of
Torsten.Bergmann at phaidros.com
Sent: Tuesday, August 12, 2003 4:05 PM
To: squeak-dev at lists.squeakfoundation.org
Subject: [OT] Gosling on the object/primitive gap

James Gosling (Java creator) on the object/primitive gap: 
>From http://fishbowl.pastiche.org/archives/001452.html

Depends on your performance goals. Uniform type systems are easy if your
performance goals aren't real strict. In the java case, I wanted to be
able
to compile "a=b+c" into one instruction on almost all architectures with
a
reasonable compiler. The closest thing I've seen to accomplishing this
is
"Self" which gets close, except that the compiler is very complex and
expensive, and it doesn't get nearly all the cases. I haven't read any
of
the squeak papers, so I can't comment on it.

Found on James Robertsons Weblog
http://www.cincomsmalltalk.com/blog/blogView#3238140088



More information about the Squeak-dev mailing list