[Vm-dev] VMBIGENDIAN question (was: A proposal to split VMMaker into subpackages)

David T. Lewis lewis at mail.msen.com
Fri Mar 22 04:43:42 UTC 2013


On Thu, Mar 21, 2013 at 11:23:34PM +0100, Nicolas Cellier wrote:
> 
> 2013/3/21 Eliot Miranda <eliot.miranda at gmail.com>:
> >
> > On Wed, Mar 20, 2013 at 5:14 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> >>
> >> On Tue, Mar 19, 2013 at 09:29:53PM +0100, Nicolas Cellier wrote:
> >> >
> >> > Trying to backport the LargeInteger v2 plugins, I saw that there is an
> >> > important difference in the shared variables, notably class variables
> >> > vs poolDictionary, for example VMBIGENDIAN is not accessible in
> >> > Interpreter plugins. So it would probably be the first job.
> >>
> >> Can you give me a pointer to the code for which this was a problem? I'd like
> >> to understand the issue better.
> >>
> >> The VMBIGENDIAN macro was eliminated long ago in favor of a static variable
> >> initialized at runtime:
> >
> > Not in Cog.  I don't see the point of using other than a macro for something that definitely *won't* change at runtime.
> >
> 
> Of course, I need this information for accessing bytes of native-order
> 32 bits digit LargeIntegers.
> Otherwise, I use it in BIG ENDIAN case to fail a few primitives that
> intrusively presume what LargeInteger internal format should be.
> All code is at http://smalltalkhub.com/#!/~nice/NiceVMExperiments

Thanks Nicolas, I will look at this.


> Like Eliot, if there is a macro, I prefer the macro.
> It's not only about speed, it's also about space, I don't see why to
> embed dead code that should never ever be executed.
> I know, I know, slow memory is cheap, but not the one in my processor cache.
> Et les petits ruisseaux font les grandes rivi?res.

"It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so."
-- Mark Twain

An interpreter VM compiled with the normal C macros in sqMemoryAccess.h (for "performance"):

0 tinyBenchmarks. '417277913 bytecodes/sec; 14395420 sends/sec'
0 tinyBenchmarks. '414239482 bytecodes/sec; 14646769 sends/sec'
0 tinyBenchmarks. '417277913 bytecodes/sec; 14406658 sends/sec'

The same interpreter VM with C macros replaced by Smalltalk slang (class MemoryAccess):

0 tinyBenchmarks. '455111111 bytecodes/sec; 14217973 sends/sec'
0 tinyBenchmarks. '451897616 bytecodes/sec; 14485815 sends/sec'
0 tinyBenchmarks. '453900709 bytecodes/sec; 14497194 sends/sec'

Dave



More information about the Vm-dev mailing list