[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 30d527: CogVM source as per VMMaker.oscog-eem.2984

Eliot Miranda noreply at github.com
Sat Jul 10 00:14:50 UTC 2021


  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 30d52787f7013aab83b6b811ee0ae94b004fa487
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/30d52787f7013aab83b6b811ee0ae94b004fa487
  Author: Eliot Miranda <eliot.miranda at gmail.com>
  Date:   2021-07-09 (Fri, 09 Jul 2021)

  Changed paths:
    M build.macos64ARMv8/HowToBuild
    M build.macos64ARMv8/common/Makefile.rules
    M build.macos64ARMv8/common/Makefile.vm
    A spur64src/vm/_variable_order
    M spur64src/vm/cogit.h
    M spur64src/vm/cogitARMv8.c
    M spur64src/vm/cogitX64SysV.c
    M spur64src/vm/cogitX64WIN64.c
    M spur64src/vm/cointerp.c
    M spur64src/vm/cointerp.h
    M spur64src/vm/cointerpmt.c
    M spur64src/vm/cointerpmt.h
    M spur64src/vm/gcc3x-cointerp.c
    M spur64src/vm/gcc3x-cointerpmt.c
    A spur64src/vm/variable_order
    A spurlowcode64src/vm/_variable_order
    M spurlowcode64src/vm/cogit.h
    M spurlowcode64src/vm/cogitARMv8.c
    M spurlowcode64src/vm/cogitX64SysV.c
    M spurlowcode64src/vm/cogitX64WIN64.c
    M spurlowcode64src/vm/cointerp.c
    M spurlowcode64src/vm/cointerp.h
    M spurlowcode64src/vm/gcc3x-cointerp.c
    A spurlowcode64src/vm/variable_order
    A spurlowcodesrc/vm/_variable_order
    M spurlowcodesrc/vm/cogit.h
    M spurlowcodesrc/vm/cogitARMv5.c
    M spurlowcodesrc/vm/cogitIA32.c
    M spurlowcodesrc/vm/cogitMIPSEL.c
    M spurlowcodesrc/vm/cointerp.c
    M spurlowcodesrc/vm/cointerp.h
    M spurlowcodesrc/vm/gcc3x-cointerp.c
    A spurlowcodesrc/vm/variable_order
    M spurlowcodestack64src/vm/gcc3x-interp.c
    M spurlowcodestack64src/vm/interp.c
    M spurlowcodestacksrc/vm/gcc3x-interp.c
    M spurlowcodestacksrc/vm/interp.c
    A spursista64src/vm/_variable_order
    M spursista64src/vm/cogit.h
    M spursista64src/vm/cogitARMv8.c
    M spursista64src/vm/cogitX64SysV.c
    M spursista64src/vm/cogitX64WIN64.c
    M spursista64src/vm/cointerp.c
    M spursista64src/vm/cointerp.h
    M spursista64src/vm/gcc3x-cointerp.c
    A spursista64src/vm/variable_order
    A spursistasrc/vm/_variable_order
    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
    A spursistasrc/vm/variable_order
    A spursrc/vm/_variable_order
    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/cointerpmt.c
    M spursrc/vm/cointerpmt.h
    M spursrc/vm/gcc3x-cointerp.c
    M spursrc/vm/gcc3x-cointerpmt.c
    A spursrc/vm/variable_order
    M spurstack64src/vm/gcc3x-interp.c
    M spurstack64src/vm/interp.c
    M spurstack64src/vm/validImage.c
    M spurstacksrc/vm/gcc3x-interp.c
    M spurstacksrc/vm/interp.c
    M spurstacksrc/vm/validImage.c
    A src/vm/_variable_order
    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/gcc3x-cointerp.c
    A src/vm/variable_order
    M stacksrc/vm/gcc3x-interp.c
    M stacksrc/vm/interp.c

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

Apple M1 ARMv8 good enough to recompile the Compiler package and update an 8
month old trunk image (October 29th 2020).  The major weakness right now is
that this uses the Apple cache flush code, not the JITted code, which as yet
does not work.  I'll investigate soon.

Abstract setting codeModified & conditionally sending makeCodeZoneWritable/
pthread_jit_write_protect_np into setCodeModified, invoked from the relevant
places.  Not all places can rely on flushICacheFrom:to: to flip back into
executability.  Do so explicitly in these places.

CogARMv8Compiler: provide two ways to detect features (determine cache
parameters and atomic instruction availability), one via direct access to
system registers, the other hard-wired, but to be done via sysctl(3).

Make provision for Apple M1 using pthread_jit_write_protect_np. Experiments
show that DUAL_MAPPED_CODE_ZONE will not work, but pthread_jit_write_protect_np
does. The zone is switched into writability explicitly in relevant entry points
(see senders of ensureWritableCodeZone).  The zone is switched into
executability as part of the compiler class's flushICacheFrom:to:, and
explicitly when flushICacheFrom:to: is either conditional or unused.

Have CogARMv8Compiler>>detectFeatures introduce a noop before accessing a
system register so an illegal instruction can easily be distinguished from
lack of execute permission.

Nuke dead code (addAllToYoungReferrers sqMakeMemoryNotExecutableFrom:To: etc).
Make a few methods static that don't need to be exported but do need to be
retained (ceCPICMiss:receiver: et al).

Make kosherYoungReferrers more robust so it works mid method generation.

Slang:

Do a better job eliding dead code by including casts in sends that are effect
free and broadening the range of arithmetic and conditional sends that are
considered for being effect free, and in argument passing.
Slang fixes (noMask et al shouldn't use bit and directly).

Generate a variable order file of variables accessed by the JIT (potentially
via VarBaseReg) to guide linkers in clustering these variables (close to the
var base).  Use the variable_order file in the Apple M1 build.




More information about the Vm-dev mailing list