VM integer return values

Tim Rowledge tim at sumeru.stanford.edu
Wed Oct 10 04:51:46 UTC 2001


Eric Scharff <Eric.Scharff at Colorado.EDU> is widely believed to have written:

> First of all, I finally successfully built a Mac VM using VMMaker complete
> with AppleScript and OpenGL support.  I'm happy!  Thanks for a great tool!
> Are there still badges around? :)  (Still need to work on building a
> Carbon VM, though.)
Congratulations! You may now download the VM builder's certificate; if
you're at OOPSLA next week I'll even sign it for you  :-)
I'm afraid the last badges were sold earlier this year.

> 
> Anyway, during that build I noticed as I do during every build - there are
> lots of generated C files that declare int return types, but they don't
> actually return anything.
Yup, i's annoyed me for ages but never quite enough to get me to do
anything about it.
> 
> There seems to be a distinction between primitive return types (a return
> object pushed on to the stack) and the C (integer) return type (which
> seems to be ignored.)  Is this correct?
Definitely. Many of the generated C functions have no meaningful return
value and when they do they are not often anything much to do with the
Smalltalk stack. Only pushing an object onto the ST stack will get a
value back to Smalltalk-land. (Well, aside from places where we stuff a
value into an object we've just got _off_ the stack)
> 
> If so, how difficult would it be to change the C code generator to emit
> functions that return void?  This would eliminate the warning messages,
> and a smart compiler could potentially be a tiny bit faster (because it
> doesn't have to generate a function return value).
I don't think it would be terribly hard. From a quick look I think that
something along the lines of changing the default in
testTMethod>setSelector:args:locals:block:primitive: to be 'void'
instead of 'int' might even be near enough. It looks like we would then
want to jiggle the places where a TReturnNode is added so that we make
sure the returnType is 'int' unless it is already something non-void. Or
sometihng like that.

Oh dear, just looking at this I can see a dozen or more places needing
fixing. Sigh.

tim

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
"How many Kzin does it take to change a lightbulb?" "None. You can
scream and leap in the dark."





More information about the Squeak-dev mailing list