[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 5c95bb: CogVM source as per VMMaker.oscog-eem.1914

GitHub noreply at github.com
Fri Aug 5 16:39:53 UTC 2016

  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 5c95bbc4c12cc01ebc0ad1fbc2b4f450867ea931
  Author: Eliot Miranda <eliot.miranda at gmail.com>
  Date:   2016-08-05 (Fri, 05 Aug 2016)

  Changed paths:
    M nsspur64src/vm/cogit.h
    M nsspur64src/vm/cogitX64.c
    M nsspur64src/vm/cointerp.c
    M nsspur64src/vm/cointerp.h
    M nsspur64src/vm/gcc3x-cointerp.c
    M nsspursrc/vm/cogit.h
    M nsspursrc/vm/cogitARMv5.c
    M nsspursrc/vm/cogitIA32.c
    M nsspursrc/vm/cogitMIPSEL.c
    M nsspursrc/vm/cointerp.c
    M nsspursrc/vm/cointerp.h
    M nsspursrc/vm/gcc3x-cointerp.c
    M nsspurstack64src/vm/gcc3x-interp.c
    M nsspurstack64src/vm/interp.c
    M nsspurstacksrc/vm/gcc3x-interp.c
    M nsspurstacksrc/vm/interp.c
    M spur64src/vm/cogit.h
    M spur64src/vm/cogitX64.c
    M spur64src/vm/cointerp.c
    M spur64src/vm/cointerp.h
    M spur64src/vm/gcc3x-cointerp.c
    M spursistasrc/vm/cogit.h
    M spursistasrc/vm/cogitARMv5.c
    M spursistasrc/vm/cogitIA32.c
    M spursistasrc/vm/cogitMIPSEL.c
    M spursistasrc/vm/cointerp.c
    M spursistasrc/vm/cointerp.h
    M spursistasrc/vm/gcc3x-cointerp.c
    M spursrc/vm/cogit.h
    M spursrc/vm/cogitARMv5.c
    M spursrc/vm/cogitIA32.c
    M spursrc/vm/cogitMIPSEL.c
    M spursrc/vm/cointerp.c
    M spursrc/vm/cointerp.h
    M spursrc/vm/gcc3x-cointerp.c
    M spurstack64src/vm/gcc3x-interp.c
    M spurstack64src/vm/interp.c
    M spurstacksrc/vm/gcc3x-interp.c
    M spurstacksrc/vm/interp.c
    M src/plugins/BitBltPlugin/BitBltPlugin.c
    M src/plugins/Squeak3D/Squeak3D.c
    M src/vm/cogit.h
    M src/vm/cogitARMv5.c
    M src/vm/cogitIA32.c
    M src/vm/cogitMIPSEL.c
    M src/vm/cointerp.c
    M src/vm/cointerp.h
    M src/vm/cointerpmt.c
    M src/vm/cointerpmt.h
    M src/vm/gcc3x-cointerp.c
    M src/vm/gcc3x-cointerpmt.c
    M stacksrc/vm/gcc3x-interp.c
    M stacksrc/vm/interp.c

  Log Message:
  CogVM source as per VMMaker.oscog-eem.1914

Improve method cache printing to include hex hashes and totals of
printed items.

When using intel inlining syntax, use correct one

Fix bad performance regression with open PICs and fix slip in generated
perform primitive.  The regression, when the open PIC compilation code
was refactored to eliminate duplication of the probe generation, was to
misorder the probes, so that when a new method was entered into the
cache at a clashing line, which zeros the two entries following the
first, the open PIC would search for the last entry, hence always

The perform code had two copies of the second probe and no third probe.

Remember to nil out the last uncoggable method variables on code
compaction, become, GC

JIT blocks more agressively in the value primitive; always try and JIT
(unless noted in lastUncoggableInterpretedBlockMethod) if reached from
the machine code primitive.

Change traceFlags so that traceFlag 2 prints only interpreted sends,
and trace flags 258 print both interpreted and machine code sends.

Correct the prototype of genDoubleFailIfZeroArgRcvr:arg:
It's used as a function taking int, not #sqInt
See #genDoubleArithmetic:preOpCheck: and #genDoubleArithmetic:preOpCheck:boxed: for 64bits

Fixed a register spill for remote inst var access.
Improved error code returns

Fixed minor bug in noMustBeBoolean flag and added a comment.

Fixed twoPath compilation both with and without immutability.
I (Clement) changed the test from "isInstVarStore" to "is1ByteInstVarStore"
because other instVarStore may happen on context objects, requiring a
frame. The compilation of Context>>setSender:receiver:method:closure:startpc:
requires a frame for example. Without immutability, the two path is
done for methods with multiple inst var stores and branch on the
receiver's age. With immutability, all setters are compiled with two
paths and branch on the receiver mutability and age. That's very funny
because now the VM with immutability is clearly faster on binary tree
than the VM before the two paths compilation (obviously we backported
that to the non-immutability VM, so the VM without immutability is
still faster).  (Eliot: Woo hoo!!)

Added extB 3rd bit flag to mark if the store requires the immutability
check or not in multiple store instructions (LitVar, instVar,
RemoteInstVar). Fixed a zip (flag was inverted for no store check).

Now that immutability is rock stable, I made two generic store methods,
one for stores into maybe context objects, one for stores into non
context objects. Both methods require multiple parameters such as
"requireImmutabilityCheck" and "requireStoreCheck". The generic methods
test for the IMMUTABILITY flag to know if they need to generate the
test or not in addition to the parameter. Every heap store calls one
of these two methods, so there's no code duplication.

Fixed some methods to return error codes instead of 0.

Sista Cogit:

- Fixed inlined multiply primitive.
- disabled jitting of full block temporarily (to have the VM stable).

Improve method cache locality in Spur, which uses class indices and tag
patterns as class tags.  Shift up the class tag by 2 bits so that the
least significant two bits are included in the hash.

Make sure retryPrimitiveOnFailure is option: #SpurObjectMemory.

Fix declaration of tenuringProportion in SpurGenerationScavenger: it
is expected to be a double (between 0.0 and 1.0), not a sqInt.

Correct, but not fix, ceTraceStoreOf:into: for Spur (use isImmediate:, but not fixed cuz stores may not be into ReceiverResultReg any more).

MSVC has a problem with the macro-expansion trickery involving assert
(vis ||), GIV and macro indirections. Using the getter (And the
translated code from that) works fine, tho.

64-bit Spur:
Remove Undefined Behavior that prevents correct SmallFloat handling

The following symptoms were experienced with Squeak stack spur 64 bits
VM and gcc 4.9.2 with -O2 optimization (mvm -f).

2.0 = 3.0 -> true.
2.0 * 3.0 -> 4.0.

For solving that it's necessary to remove undefined behavior related
to left shifting a signed integer.

Instead of generating something like:
    ((sqLong) rcvr) << arg
It's better to generate it like this:
    (sqLong)(((usqLong) rcvr) << arg)

This way we preserve signedness and Behavior is well defined.
Since the formulation is rather heavy, I've (Nicolas) also added tricks
to avoid some casts if variable is long enough and unsigned already. If
we later switch longAt and some others as unsigned as already discussed
here, the generated C might almost be readable.

I've also replaced pointer aliasing used to get/set SmallFloat value, like:
    doubleResult = (double *)( & rawBitsInteger )[0];
by memcpy:
    memcpy( &doubleResult  , &rawBitsInteger , sizeof(doubleResult) );

Why is memcpy less evil than pointer aliasing?
With pointer aliasing any other write into a long integer could modify
doubleResult.  This completely defeat optimization - the holy grail of
C people, they can't bother that FORTRAN compilers are faster than
theirs ;).  With this greatly biased wisdom, they declared this
construct as undefined behavior, giving priority to optimization rather
than backward compatibility or programmers' intentions...
memcpy is less evil because it's localized (one shot).
memcpy is heavily optimized (no function call generated, just about the
same instructions as pointer aliasing), so there's no reason to not
abide by the standard.

BitBlt/Squeak3D plugins:
BitBltSimulation>>primitivePixelValueAtX:y: needs to be modified to
allow the optimization mentioned in VMMaker.oscog-eem.1888's message.
This modification is similar to those in that same commit.

  Commit: 7c1f294f1642d5def909516b26bd508a52c44ea7
  Author: Eliot Miranda <eliot.miranda at gmail.com>
  Date:   2016-08-05 (Fri, 05 Aug 2016)

  Changed paths:
    M build.linux32ARMv6/newspeak.stack.spur/build.assert/mvm
    M build.linux32ARMv6/newspeak.stack.spur/build.debug/mvm
    M build.linux32ARMv6/newspeak.stack.spur/build/mvm
    M build.linux32ARMv6/squeak.stack.spur/build.assert/mvm
    M build.linux32ARMv6/squeak.stack.spur/build.debug/mvm
    M build.linux32ARMv6/squeak.stack.spur/build/mvm
    M build.linux32ARMv6/squeak.stack.v3/build.assert/mvm
    M build.linux32ARMv6/squeak.stack.v3/build.debug/mvm
    M build.linux32ARMv6/squeak.stack.v3/build/mvm
    M build.linux32ARMv7/newspeak.stack.spur/build.assert/mvm
    M build.linux32ARMv7/newspeak.stack.spur/build.debug/mvm
    M build.linux32ARMv7/newspeak.stack.spur/build/mvm
    M build.linux32x86/newspeak.cog.spur/build.assert.itimerheartbeat/mvm
    M build.linux32x86/newspeak.cog.spur/build.assert/mvm
    M build.linux32x86/newspeak.cog.spur/build.debug.itimerheartbeat/mvm
    M build.linux32x86/newspeak.cog.spur/build.debug/mvm
    M build.linux32x86/newspeak.cog.spur/build.itimerheartbeat/mvm
    M build.linux32x86/newspeak.cog.spur/build/mvm
    M build.linux32x86/newspeak.stack.spur/build.assert/mvm
    M build.linux32x86/newspeak.stack.spur/build.debug/mvm
    M build.linux32x86/newspeak.stack.spur/build/mvm
    M build.linux32x86/nsnac.cog.spur/build.assert.itimerheartbeat/mvm
    M build.linux32x86/nsnac.cog.spur/build.assert/mvm
    M build.linux32x86/nsnac.cog.spur/build.debug.itimerheartbeat/mvm
    M build.linux32x86/nsnac.cog.spur/build.debug/mvm
    M build.linux32x86/nsnac.cog.spur/build.itimerheartbeat/mvm
    M build.linux32x86/nsnac.cog.spur/build/mvm
    M build.linux32x86/squeak.stack.spur/build.assert/mvm
    M build.linux32x86/squeak.stack.spur/build.debug/mvm
    M build.linux32x86/squeak.stack.spur/build/mvm
    M build.linux32x86/squeak.stack.v3/build.assert/mvm
    M build.linux32x86/squeak.stack.v3/build.debug/mvm
    M build.linux32x86/squeak.stack.v3/build/mvm
    M build.linux64x64/newspeak.cog.spur/build.assert.itimerheartbeat/mvm
    M build.linux64x64/newspeak.cog.spur/build.assert/mvm
    M build.linux64x64/newspeak.cog.spur/build.debug.itimerheartbeat/mvm
    M build.linux64x64/newspeak.cog.spur/build.debug/mvm
    M build.linux64x64/newspeak.cog.spur/build.itimerheartbeat/mvm
    M build.linux64x64/newspeak.cog.spur/build/mvm
    M build.linux64x64/newspeak.stack.spur/build.assert/mvm
    M build.linux64x64/newspeak.stack.spur/build.debug/mvm
    M build.linux64x64/newspeak.stack.spur/build/mvm

  Log Message:
  Merge branch 'Cog' of http://github.com/OpenSmalltalk/opensmalltalk-vm into Cog

Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/1f82cbdeec1d...7c1f294f1642

More information about the Vm-dev mailing list