read.struct-field.inc

Переключить прокрутку окна
Загрузить этот исходный код

;
  ; Реализация среды исполнения языка программирования
  ; Объектно-ориентированный продвинутый векторный транслятор
  ;
  ; Copyright © 2021, 2024 Малик Разработчик
  ;
  ; Это свободная программа: вы можете перераспространять ее и/или изменять
  ; ее на условиях Меньшей Стандартной общественной лицензии GNU в том виде,
  ; в каком она была опубликована Фондом свободного программного обеспечения;
  ; либо версии 3 лицензии, либо (по вашему выбору) любой более поздней версии.
  ;
  ; Эта программа распространяется в надежде, что она будет полезной,
  ; но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
  ; или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробнее см. в Меньшей Стандартной
  ; общественной лицензии GNU.
  ;
  ; Вы должны были получить копию Меньшей Стандартной общественной лицензии GNU
  ; вместе с этой программой. Если это не так, см.
  ; <https://www.gnu.org/licenses/>.
;

; <fold чтение полей структур>
    ; <fold приватные макросы — должны использоваться только этим текстом исходного кода>
        macro _rdsf {
                        _chknull    r00q
                        lea         r02q, [r00+$00]
                        __structp   r01q, r02q
        }

        macro _rdsf_l localvarName* {
                        _loadw_l    r01q, localvarName
                        __structp   r01q, r01q
        }

        macro _rdsf_g globalmember* {
                        mov         r01q, globalmember
                        _chknull    r01q
                        __structp   r01q, r01q
        }
    ; </fold>

    ; <fold объектная ссылка на аккумуляторе>
        macro rdsfc fieldFullName* {
                        _rdsf
                        movzx       dsc0, word  [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfe fieldFullName* {
                        _rdsf
                        fld         tbyte [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfd fieldFullName* {
                        _rdsf
                        vmovq       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfd2 fieldFullName* {
                        _rdsf
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfd4 fieldFullName* {
                        _rdsf
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfd8 fieldFullName* {
                        _rdsf
                        vmovdqu64   zmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsff fieldFullName* {
                        _rdsf
                        vmovd       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsff2 fieldFullName* {
                        _rdsf
                        vmovq       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsff4 fieldFullName* {
                        _rdsf
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsff8 fieldFullName* {
                        _rdsf
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfb fieldFullName* {
                        _rdsf
                        movsx       dsc0, byte  [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfb2 fieldFullName* {
                        _rdsf
                        movzx       dsc0, word  [r01+fieldFullName#.struct]
                        vmovd       xmm0, dsc0
                        decrcoth    r02q
        }

        macro rdsfb4 fieldFullName* {
                        _rdsf
                        vmovd       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfb8 fieldFullName* {
                        _rdsf
                        vmovq       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfs fieldFullName* {
                        _rdsf
                        movsx       dsc0, word  [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfs2 fieldFullName* {
                        _rdsf
                        vmovd       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfs4 fieldFullName* {
                        _rdsf
                        vmovq       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfs8 fieldFullName* {
                        _rdsf
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfi fieldFullName* {
                        _rdsf
                        mov         dsc0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfi2 fieldFullName* {
                        _rdsf
                        vmovq       xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfi4 fieldFullName* {
                        _rdsf
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfi8 fieldFullName* {
                        _rdsf
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfl fieldFullName* {
                        _rdsf
                        mov         qsc0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfl2 fieldFullName* {
                        _rdsf
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfl4 fieldFullName* {
                        _rdsf
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }

        macro rdsfl8 fieldFullName* {
                        _rdsf
                        vmovdqu64   zmm0, [r01+fieldFullName#.struct]
                        decrcoth    r02q
        }
    ; </fold>

    ; <fold объектная ссылка в локальной переменной>
        macro rdsfc_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        movzx       dsc0, word  [r01+fieldFullName#.struct]
        }

        macro rdsfe_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        fld         tbyte [r01+fieldFullName#.struct]
        }

        macro rdsfd_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovq       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfd2_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfd4_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
        }

        macro rdsfd8_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu64   zmm0, [r01+fieldFullName#.struct]
        }

        macro rdsff_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovd       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsff2_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovq       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsff4_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsff8_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
        }

        macro rdsfb_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        movsx       dsc0, byte  [r01+fieldFullName#.struct]
        }

        macro rdsfb2_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        movzx       dsc0, word  [r01+fieldFullName#.struct]
                        vmovd       xmm0, dsc0
        }

        macro rdsfb4_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovd       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfb8_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovq       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfs_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        movsx       dsc0, word  [r01+fieldFullName#.struct]
        }

        macro rdsfs2_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovd       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfs4_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovq       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfs8_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfi_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        mov         dsc0, [r01+fieldFullName#.struct]
        }

        macro rdsfi2_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovq       xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfi4_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfi8_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
        }

        macro rdsfl_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        mov         qsc0, [r01+fieldFullName#.struct]
        }

        macro rdsfl2_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     xmm0, [r01+fieldFullName#.struct]
        }

        macro rdsfl4_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu     ymm0, [r01+fieldFullName#.struct]
        }

        macro rdsfl8_l fieldFullName*, localvarName* {
                        _rdsf_l     localvarName
                        vmovdqu64   zmm0, [r01+fieldFullName#.struct]
        }
    ; </fold>

    ; <fold объектная ссылка в глобальном члене>
        macro rdsfc_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            movzx       dsc0, word  [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfe_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            fld         tbyte [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfd_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovq       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfd2_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfd4_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     ymm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfd8_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu64   zmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsff_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovd       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsff2_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovq       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsff4_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsff8_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     ymm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfb_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            movsx       dsc0, byte  [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfb2_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            movzx       dsc0, word  [r01+fieldFullName#.struct]
                            vmovd       xmm0, dsc0
            end if
        }

        macro rdsfb4_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovd       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfb8_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovq       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfs_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            movsx       dsc0, word  [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfs2_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovd       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfs4_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovq       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfs8_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfi_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            mov         dsc0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfi2_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovq       xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfi4_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfi8_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     ymm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfl_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            mov         qsc0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfl2_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     xmm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfl4_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu     ymm0, [r01+fieldFullName#.struct]
            end if
        }

        macro rdsfl8_g fieldFullName*, globalmember* {
            if(globalmember eq null)
                            _throw      NullPointerException
            else
                            _rdsf_g     globalmember
                            vmovdqu64   zmm0, [r01+fieldFullName#.struct]
            end if
        }
    ; </fold>
; </fold>