diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index db8de0236f..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,198 +0,0 @@ -environment: - matrix: - # Main VM variants - - FLAVOR: squeak.cog.spur - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: squeak.cog.spur - ARCH: win64x64 - CYG_ROOT: C:\cygwin64 - MINGW_ARCH: x86_64 - - FLAVOR: pharo.cog.spur - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: pharo.cog.spur - ARCH: win64x64 - CYG_ROOT: C:\cygwin64 - MINGW_ARCH: x86_64 - - # Main minheadless VM variants. - - FLAVOR: squeak.cog.spur.minheadless - ARCH: win32x86 - CPU_ARCH: x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - BUILD_WITH_CMAKE: yes - # - FLAVOR: squeak.cog.spur - # ARCH: win64x64 - # CPU_ARCH: x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - # BUILD_WITH_CMAKE: yes - - FLAVOR: pharo.cog.spur.minheadless - ARCH: win32x86 - CPU_ARCH: x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - BUILD_WITH_CMAKE: yes - # - FLAVOR: pharo.cog.spur - # ARCH: win64x64 - # CPU_ARCH: x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - # BUILD_WITH_CMAKE: yes - - # Minheadless VM variants with SDL2 based support for traditional display. - # - FLAVOR: squeak.cog.spur+sdl2 - # ARCH: win32x86 - # CPU_ARCH: x86 - # CYG_ROOT: C:\cygwin - # MINGW_ARCH: i686 - # BUILD_WITH_CMAKE: yes - # - FLAVOR: squeak.cog.spur+sdl2 - # ARCH: win64x64 - # CPU_ARCH: x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - # BUILD_WITH_CMAKE: yes - # - FLAVOR: pharo.cog.spur+sdl2 - # ARCH: win32x86 - # CPU_ARCH: x86 - # CYG_ROOT: C:\cygwin - # MINGW_ARCH: i686 - # BUILD_WITH_CMAKE: yes - # - FLAVOR: pharo.cog.spur+sdl2 - # ARCH: win64x64 - # CPU_ARCH: x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - # BUILD_WITH_CMAKE: yes - - # Other VM variants - - FLAVOR: squeak.sista.spur - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: squeak.cog.spur.lowcode - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: squeak.cog.v3 - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: squeak.stack.spur - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: squeak.stack.v3 - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: pharo.sista.spur - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - - FLAVOR: pharo.cog.spur.lowcode - ARCH: win32x86 - CYG_ROOT: C:\cygwin - MINGW_ARCH: i686 - # - FLAVOR: newspeak.cog.spur - # ARCH: win32x86 - # CYG_ROOT: C:\cygwin - # MINGW_ARCH: i686 - # - FLAVOR: newspeak.stack.spur - # ARCH: win32x86 - # CYG_ROOT: C:\cygwin - # MINGW_ARCH: i686 - # - FLAVOR: pharo.sista.spur - # ARCH: win64x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - # - FLAVOR: newspeak.cog.spur - # ARCH: win64x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - - FLAVOR: squeak.stack.spur - ARCH: win64x64 - CYG_ROOT: C:\cygwin64 - MINGW_ARCH: x86_64 - # - FLAVOR: pharo.stack.spur - # ARCH: win64x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - # - FLAVOR: newspeak.stack.spur - # ARCH: win64x64 - # CYG_ROOT: C:\cygwin64 - # MINGW_ARCH: x86_64 - - -matrix: - fast_finish: true - allow_failures: - - FLAVOR: squeak.cog.spur.minheadless - - FLAVOR: pharo.cog.spur.minheadless - - FLAVOR: squeak.sista.spur - - FLAVOR: pharo.sista.spur - - FLAVOR: squeak.cog.spur.lowcode - - FLAVOR: pharo.cog.spur.lowcode - -notifications: - - provider: Email - to: - - vm-dev@lists.squeakfoundation.org - on_build_success: false - -platform: - - x86 - -clone_depth: 5 - -cache: - - .thirdparty-cache - -install: - # Search for [appveyor skip], [skip appveyor], [skip ci] or [ci skip] and exit if found in full commit message - - ps: $commit=$env:APPVEYOR_REPO_COMMIT_MESSAGE + $env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED - - ps: If ($commit.Contains("[skip appveyor]") -Or $commit.Contains("[appveyor skip]")) { Exit-AppVeyorBuild } - - ps: $commit=$env:APPVEYOR_REPO_COMMIT_MESSAGE + $env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED - - ps: If ($commit.Contains("[skip ci]") -Or $commit.Contains("[ci skip]")) { Exit-AppVeyorBuild } - - 'curl -fsSL --retry 4 -m 600 -o "setup-x86.exe" "http://cygwin.com/setup-x86.exe" ' - - 'curl -fsSL --retry 4 -m 600 -o "setup-x86_64.exe" "http://cygwin.com/setup-x86_64.exe" ' - - 'call scripts/installCygwin.bat %MINGW_ARCH% "%CYG_ROOT%"' - -# Cygwin build script -# -# NOTES: -# -# The stdin/stdout file descriptor appears not to be valid for the Appveyor -# build which causes failures as certain functions attempt to redirect -# default file handles. Ensure a dummy file descriptor is opened with 'exec'. -build_script: - - '%CYG_ROOT%\bin\bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0> $GITHUB_ENV + echo "ASSET_NAME=${{ steps.build-vm.outputs.ASSET_NAME }}" >> $GITHUB_ENV + echo "PRODUCTS_PATH=${{ steps.build-vm.outputs.PRODUCTS_PATH }}" >> $GITHUB_ENV + echo "APP_NAME=${{ steps.build-vm.outputs.APP_NAME }}" >> $GITHUB_ENV + + - name: Sign VM (not implemented) + if: false + run: ./deploy/sign-vm.sh + + - name: Pack VM + run: ./deploy/pack-vm.sh + + - name: Store artifact w/ revision + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ASSET_NAME }}_${{ env.ASSET_REVISION }} + path: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + + - name: Update artifact in latest-release + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'schedule' || (github.event_name == 'push' && endsWith( github.ref , 'Cog' )) + with: + prerelease: true + allowUpdates: true + replacesArtifacts: true + artifacts: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ matrix.mode == 'debug' && 'latest-debug-build' || matrix.mode == 'assert' && 'latest-assert-build' || 'latest-build' }} + body: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/extra.yml b/.github/workflows/extra.yml new file mode 100644 index 0000000000..18f05c86ab --- /dev/null +++ b/.github/workflows/extra.yml @@ -0,0 +1,105 @@ +name: Extra Monthly Builds + +on: + schedule: + - cron: '0 0 1 * *' # Build on the 1st of every month at midnight + workflow_dispatch: + inputs: + should-deploy: + description: 'Deploy on success' + required: true + default: "true" # No boolean support at the moment + + +jobs: + build: + strategy: + fail-fast: false # let them finish bc. different platforms + matrix: + arch: + - { name: win64x64, os: windows-latest } + - { name: win32x86, os: windows-latest } + - { name: linux64x64, os: ubuntu-latest } + - { name: linux32x86, os: ubuntu-latest } + - { name: macos64x64, os: macos-latest } + # - { name: macos32x86, os: macos-latest } + + flavor: + # Only newsqueak.* builds are fully prepared for all platforms + - newspeak.cog.spur + - newspeak.stack.spur + + include: + - arch: { name: win32x86, os: windows-latest } + flavor: squeak.cog.v3 + - arch: { name: win32x86, os: windows-latest } + flavor: squeak.stack.v3 + - arch: { name: win32x86, os: windows-latest } + flavor: squeak.cog.spur.lowcode + # - arch: { name: win32x86, os: windows-latest } + # flavor: pharo.cog.spur.lowcode + + - arch: { name: linux32x86, os: ubuntu-latest } + flavor: squeak.cog.v3 + - arch: { name: linux32x86, os: ubuntu-latest } + flavor: squeak.stack.v3 + - arch: { name: linux32x86, os: ubuntu-latest } + flavor: pharo.cog.spur.lowcode + - arch: { name: linux32x86, os: ubuntu-latest } + flavor: pharo.stack.spur.lowcode + + # - arch: { name: macos64x64, os: macos-latest } + # flavor: pharo.cog.spur.lowcode # impl. decl. getThisSessionID + - arch: { name: macos64x64, os: macos-latest } + flavor: pharo.stack.spur.lowcode + + runs-on: ${{ matrix.arch.os }} + name: ${{ matrix.flavor }} for ${{ matrix.arch.name }} + env: + ARCH: ${{ matrix.arch.name }} + FLAVOR: ${{ matrix.flavor }} + MODE: fast # no assert or debug here + HEARTBEAT: threaded # linux only; no itimer here + MSYS_SYS: ${{ matrix.arch.name == 'win64x64' && 'mingw64' || 'mingw32' }} + MSYS_ENV: ${{ matrix.arch.name == 'win64x64' && 'x86_64' || 'i686' }} + steps: + - name: Checkout files + uses: actions/checkout@v2 + # with: + # ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || 'refs/heads/Cog'}} + + - name: Restore build cache + uses: actions/cache@v2 + with: + path: .thirdparty-cache + key: ${{ startsWith(matrix.arch.name, 'win') && 'thirdparty-cache-win' || startsWith(matrix.arch.name, 'linux') && 'thirdparty-cache-linux' || 'thirdparty-cache-macos' }} + + - name: Prepare environment + if: startsWith(matrix.arch.name, 'linux') + run: ./scripts/ci/actions_prepare_linux_x86.sh + + - name: Build VM + shell: bash + run: ./scripts/ci/actions_build.sh + + - name: Pack VM + shell: bash + run: ./deploy/pack-vm.sh + + - name: Store artifact w/ revision + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ASSET_NAME }}_${{ env.ASSET_REVISION }} + path: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + + - name: Update artifact in latest-build + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'schedule' || (github.event.inputs.should-deploy == 'true' && endsWith( github.ref , 'Cog' )) + with: + prerelease: true + allowUpdates: true + replacesArtifacts: true + artifacts: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ matrix.mode == 'debug' && 'latest-debug-build' || matrix.mode == 'assert' && 'latest-assert-build' || 'latest-build' }} + body: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/linux-arm.yml b/.github/workflows/linux-arm.yml new file mode 100644 index 0000000000..0a008eabf7 --- /dev/null +++ b/.github/workflows/linux-arm.yml @@ -0,0 +1,142 @@ +name: Build for Linux (ARM) + +on: + push: # All branches, but appropriate paths only. + paths: + # This workflow spec and its support scripts + - '.github/workflows/linux-arm.yml' + - 'scripts/ci/*linux_arm.sh' + - 'scripts/ci/*build.sh' + - 'deploy/**' + # Relevant sources for this platform + - 'build.linux*/**' # Makefile-based build scripts + - '*src/**' # Generated VMMaker sources (incl. plugins) + - 'platforms/Cross/**' + - 'platforms/unix/**' + # Skip changes in documentation artifacts + - '!**.md' + - '!**HowToBuild' + pull_request: + branches: + - Cog + paths-ignore: + - '**.md' + - '**HowToBuild' + workflow_dispatch: + inputs: + tag: + description: "Build new release candidate for tag" + required: true + default: YYYYMMDDHHMM + +jobs: + build: + strategy: + fail-fast: false # let them finish bc. mixed platforms + matrix: + arch: + - linux32ARMv6 + # - linux32ARMv7 # Newspeak only, see "extra-arm" workflow + - linux64ARMv8 + flavor: + - squeak.cog.spur + - squeak.stack.spur + mode: + - fast + - debug + - assert + + runs-on: ubuntu-latest + name: ${{ matrix.flavor }} for ${{ matrix.arch }}${{ matrix.mode == 'debug' && ' (DEBUG)' || matrix.mode == 'assert' && ' (ASSERT)' || '' }} + env: + ARCH: ${{ matrix.arch }} + ARCH_ARM: ${{ matrix.arch == 'linux32ARMv6' && 'armv6' || matrix.arch == 'linux32ARMv7' && 'armv7' || 'aarch64' }} + FLAVOR: ${{ matrix.flavor }} + MODE: ${{ matrix.mode }} + HEARTBEAT: threaded # itimer not supported + steps: + - name: Checkout files + if: github.event_name != 'workflow_dispatch' + uses: actions/checkout@v2 + + - name: Checkout files for new release candidate + if: github.event_name == 'workflow_dispatch' + uses: actions/checkout@v2 + with: + ref: refs/tags/${{ github.event.inputs.tag }} + + # TODO: Can we use the same thirdparty cache for armv6, armv7, and aarch64? Are pre-compiled binaries compatible or organized differently? + - name: Restore build cache + uses: actions/cache@v2 + with: + path: .thirdparty-cache + key: thirdparty-cache-linux-${{ env.ARCH_ARM }} + + # https://github.com/marketplace/actions/run-on-architecture + - name: Build VM + uses: uraimo/run-on-arch-action@v2.1.1 + id: build-vm + with: + arch: ${{ env.ARCH_ARM }} + distro: buster + + #TODO: Somehow use ./scripts/ci/actions_prepare_linux_arm.sh + #SEE: https://github.com/uraimo/run-on-arch-action/issues/54 + install: | + apt update -y + apt install -yq --no-install-suggests --no-install-recommends build-essential git devscripts uuid-dev libcairo2-dev libpango1.0-dev libgl1-mesa-dev libgl1-mesa-glx libssl-dev libevdev-dev m4 libpulse-dev libasound2-dev libfreetype6-dev libx11-dev libxrender-dev libtool automake autoconf libltdl-dev + + env: | # Copy the entire environment for the docker container + ARCH: ${{ env.ARCH }} + ARCH_ARM: ${{ env.ARCH_ARM }} + FLAVOR: ${{ env.FLAVOR }} + MODE: ${{ env.MODE }} + HEARTBEAT: ${{ env.HEARTBEAT }} + + run: ./scripts/ci/actions_build.sh + + - name: Post Build VM + #TODO: https://github.com/uraimo/run-on-arch-action/issues/52 + run: | + sudo chown -R runner ${{ steps.build-vm.outputs.PRODUCTS_PATH }} + echo "ASSET_REVISION=${{ steps.build-vm.outputs.ASSET_REVISION }}" >> $GITHUB_ENV + echo "ASSET_NAME=${{ steps.build-vm.outputs.ASSET_NAME }}" >> $GITHUB_ENV + echo "PRODUCTS_PATH=${{ steps.build-vm.outputs.PRODUCTS_PATH }}" >> $GITHUB_ENV + echo "APP_NAME=${{ steps.build-vm.outputs.APP_NAME }}" >> $GITHUB_ENV + + - name: Sign VM (not implemented) + if: false + run: ./deploy/sign-vm.sh + + - name: Pack VM + run: ./deploy/pack-vm.sh + + - name: Store artifact w/ revision + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ASSET_NAME }}_${{ env.ASSET_REVISION }} + path: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + + - name: Update artifact in latest-release + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'push' && endsWith( github.ref , 'Cog' ) + with: + prerelease: true + allowUpdates: true + replacesArtifacts: true + artifacts: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ matrix.mode == 'debug' && 'latest-debug-build' || matrix.mode == 'assert' && 'latest-assert-build' || 'latest-build' }} + body: ${{ github.event.head_commit.message }} + + - name: Deploy artifact as new release candidate + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'workflow_dispatch' + with: + prerelease: true # release candidate + allowUpdates: true + replacesArtifacts: true + artifacts: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.inputs.tag }} + body: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000000..3b76ec2f4b --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,137 @@ +name: Build for Linux (x86) + +on: + push: # All branches, but appropriate paths only. + paths: + # This workflow spec and its support scripts + - '.github/workflows/linux.yml' + - 'scripts/ci/*linux_x86.sh' + - 'scripts/ci/*build.sh' + - 'deploy/**' + # Relevant sources for this platform + - 'build.linux*/**' # Makefile-based build scripts + - '*src/**' # Generated VMMaker sources (incl. plugins) + - 'platforms/Cross/**' + - 'platforms/unix/**' + # Skip changes in documentation artifacts + - '!**.md' + - '!**HowToBuild' + pull_request: + branches: + - Cog + paths-ignore: + - '**.md' + - '**HowToBuild' + workflow_dispatch: + inputs: + tag: + description: "Build new release candidate for tag" + required: true + default: YYYYMMDDHHMM + +jobs: + build: + strategy: + fail-fast: true + matrix: + arch: + - linux64x64 + - linux32x86 + flavor: + - squeak.cog.spur + - pharo.cog.spur + # - pharo.stack.spur # build not prepared + heartbeat: + - threaded + - itimer + mode: + - fast + - debug + - assert + include: + # sista build not fully prepared for linux64x64, so only choose selected configurations for linux32x86 + - arch: linux32x86 + flavor: squeak.sista.spur + heartbeat: threaded + mode: fast + - arch: linux32x86 + flavor: pharo.sista.spur + heartbeat: threaded + mode: fast + # squeak.stack.spur builds are not prepared for itimer + - arch: linux64x64 + flavor: squeak.stack.spur + heartbeat: threaded + mode: fast + - arch: linux32x86 + flavor: squeak.stack.spur + heartbeat: threaded + mode: fast + + runs-on: ubuntu-latest + name: ${{ matrix.flavor }}${{ matrix.heartbeat == 'itimer' && ' (itimer)' || '' }} for ${{ matrix.arch }}${{ matrix.mode == 'debug' && ' (DEBUG)' || matrix.mode == 'assert' && ' (ASSERT)' || '' }} + env: + ARCH: ${{ matrix.arch }} + FLAVOR: ${{ matrix.flavor }} + MODE: ${{ matrix.mode }} + steps: + - name: Checkout files + if: github.event_name != 'workflow_dispatch' + uses: actions/checkout@v2 + + - name: Checkout files for new release candidate + if: github.event_name == 'workflow_dispatch' + uses: actions/checkout@v2 + with: + ref: refs/tags/${{ github.event.inputs.tag }} + + - name: Restore build cache + uses: actions/cache@v2 + with: + path: .thirdparty-cache + key: thirdparty-cache-linux + + - name: Prepare environment + run: ./scripts/ci/actions_prepare_linux_x86.sh + + - name: Build VM + run: ./scripts/ci/actions_build.sh + env: + HEARTBEAT: ${{ matrix.heartbeat }} + + - name: Sign VM (not implemented) + if: false + run: ./deploy/sign-vm.sh + + - name: Pack VM + run: ./deploy/pack-vm.sh + + - name: Store artifact w/ revision + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ASSET_NAME }}_${{ env.ASSET_REVISION }} + path: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + + - name: Update artifact in latest-build + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'push' && endsWith( github.ref , 'Cog' ) + with: + prerelease: true + allowUpdates: true + replacesArtifacts: true + artifacts: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ matrix.mode == 'debug' && 'latest-debug-build' || matrix.mode == 'assert' && 'latest-assert-build' || 'latest-build' }} + body: ${{ github.event.head_commit.message }} + + - name: Deploy artifact as new release candidate + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'workflow_dispatch' + with: + prerelease: true # release candidate + allowUpdates: true + replacesArtifacts: true + artifacts: ${{ env.PRODUCTS_PATH }}/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.inputs.tag }} + body: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000000..da41310de7 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,122 @@ +name: Build for macOS + +on: + push: # All branches, but appropriate paths only. + paths: + # This workflow spec and its support scripts + - '.github/workflows/macos.yml' + - 'scripts/ci/*build.sh' + - 'deploy/**' + # Relevant sources for this platform + - 'build.macos*/**' # Makefile-based build scripts + - '*src/**' # Generated VMMaker sources (incl. plugins) + - 'platforms/Cross/**' + - 'platforms/iOS/**' # Note that 'platforms/Mac OS' is deprecated + # Skip changes in documentation artifacts + - '!**.md' + - '!**HowToBuild' + pull_request: + branches: + - Cog + paths-ignore: + - '**.md' + - '**HowToBuild' + workflow_dispatch: + inputs: + tag: + description: "Build new release candidate for tag" + required: true + default: YYYYMMDDHHMM + +jobs: + build: + strategy: + fail-fast: true + matrix: + arch: + - macos64x64 + # - macos32x86 # Might be deprecated in general + flavor: + - squeak.cog.spur + # - squeak.sista.spur # -Werror bc. decl. missing + - squeak.stack.spur + - pharo.cog.spur + # - pharo.sista.spur # -Werror bc. decl. missing + - pharo.stack.spur + mode: + - fast + - debug + - assert + + runs-on: macos-latest + name: ${{ matrix.flavor }} for ${{ matrix.arch }}${{ matrix.mode == 'debug' && ' (DEBUG)' || matrix.mode == 'assert' && ' (ASSERT)' || '' }} + env: + ARCH: ${{ matrix.arch }} + FLAVOR: ${{ matrix.flavor }} + MODE: ${{ matrix.mode }} + steps: + - name: Checkout files + if: github.event_name != 'workflow_dispatch' + uses: actions/checkout@v2 + + - name: Checkout files for new release candidate + if: github.event_name == 'workflow_dispatch' + uses: actions/checkout@v2 + with: + ref: refs/tags/${{ github.event.inputs.tag }} + + - name: Restore build cache + uses: actions/cache@v2 + with: + path: .thirdparty-cache + key: thirdparty-cache-macos + + - name: Build VM + run: ./scripts/ci/actions_build.sh + + - name: Sign VM + continue-on-error: true # Save unsigned build artifacts + run: ./deploy/sign-vm.sh + env: + SQUEAK_SIGN_PASSWORD: ${{ secrets.SQUEAK_SIGN_PASSWORD }} + SQUEAK_CERT_PASSWORD: ${{ secrets.SQUEAK_CERT_PASSWORD }} + SQUEAK_SIGN_IDENTITY: ${{ secrets.SQUEAK_SIGN_IDENTITY }} + PHARO_SIGN_PASSWORD: ${{ secrets.PHARO_SIGN_PASSWORD }} + PHARO_CERT_PASSWORD: ${{ secrets.PHARO_CERT_PASSWORD }} + PHARO_SIGN_IDENTITY: ${{ secrets.PHARO_SIGN_IDENTITY }} + NEWSPEAK_SIGN_PASSWORD: ${{ secrets.NEWSPEAK_SIGN_PASSWORD }} + NEWSPEAK_CERT_PASSWORD: ${{ secrets.NEWSPEAK_CERT_PASSWORD }} + NEWSPEAK_SIGN_IDENTITY: ${{ secrets.NEWSPEAK_SIGN_IDENTITY }} + + - name: Pack VM + run: ./deploy/pack-vm.sh + + - name: Store artifact w/ revision + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ASSET_NAME }}_${{ env.ASSET_REVISION }} + path: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + + - name: Update artifact in latest-build + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'push' && endsWith( github.ref , 'Cog' ) + with: + prerelease: true + allowUpdates: true + replacesArtifacts: true + artifacts: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ matrix.mode == 'debug' && 'latest-debug-build' || matrix.mode == 'assert' && 'latest-assert-build' || 'latest-build' }} + body: ${{ github.event.head_commit.message }} + + - name: Deploy artifact as new release candidate + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'workflow_dispatch' + with: + prerelease: true # release candidate + allowUpdates: true + replacesArtifacts: true + artifacts: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.inputs.tag }} + body: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml new file mode 100644 index 0000000000..f8eee3144b --- /dev/null +++ b/.github/workflows/win.yml @@ -0,0 +1,129 @@ +name: Build for Windows + +on: + push: # All branches, but appropriate paths only. + paths: + # This workflow spec and its support scripts + - '.github/workflows/win.yml' + - 'scripts/ci/*msys.sh' + - 'scripts/ci/*build.sh' + - 'deploy/**' + # Relevant sources for this platform + - 'build.win*/**' # Makefile-based build scripts + - '*src/**' # Generated VMMaker sources (incl. plugins) + - 'platforms/Cross/**' + - 'platforms/win32/**' + # Skip changes in documentation artifacts + - '!**.md' + - '!**HowToBuild' + pull_request: + branches: + - Cog + paths-ignore: + - '**.md' + - '**HowToBuild' + workflow_dispatch: + inputs: + tag: + description: "Build new release candidate for tag" + required: true + default: YYYYMMDDHHMM + + +jobs: + build: + strategy: + fail-fast: true + matrix: + arch: + - win64x64 + - win32x86 + flavor: + - squeak.cog.spur + - squeak.stack.spur + # - pharo.cog.spur # third-party not yet working + # - pharo.stack.spur # third-party not yet working + mode: + - fast + - debug + - assert + include: + # sista build not fully prepared for win64x64, so only your selected configurations for win32x86 + - arch: win32x86 + flavor: squeak.sista.spur + mode: fast + # - arch: win32x86 + # flavor: pharo.sista.spur + # mode: fast + + runs-on: windows-latest + name: ${{ matrix.flavor }} for ${{ matrix.arch }}${{ matrix.mode == 'debug' && ' (DEBUG)' || matrix.mode == 'assert' && ' (ASSERT)' || '' }} + env: + ARCH: ${{ matrix.arch }} + FLAVOR: ${{ matrix.flavor }} + MODE: ${{ matrix.mode }} + steps: + - name: Checkout files + if: github.event_name != 'workflow_dispatch' + uses: actions/checkout@v2 + + - name: Checkout files for new release candidate + if: github.event_name == 'workflow_dispatch' + uses: actions/checkout@v2 + with: + ref: refs/tags/${{ github.event.inputs.tag }} + + - name: Restore build cache + uses: actions/cache@v2 + with: + path: .thirdparty-cache + key: thirdparty-cache-win + + # - name: Setup tmate debugging session + # uses: mxschmitt/action-tmate@v3 + + - name: Build VM + shell: bash + run: ./scripts/ci/actions_build.sh + # run: C:\msys64\usr\bin\bash -lc "cd $(pwd); exec ./scripts/ci/actions_build.sh" + env: + MSYS_SYS: ${{ matrix.arch == 'win64x64' && 'mingw64' || 'mingw32' }} + MSYS_ENV: ${{ matrix.arch == 'win64x64' && 'x86_64' || 'i686' }} + + - name: Sign VM (not implemented) + if: false + run: ./deploy/sign-vm.sh + + - name: Pack VM + shell: bash + run: ./deploy/pack-vm.sh + + - name: Store artifact w/ revision + uses: actions/upload-artifact@v2 + with: + name: ${{ env.ASSET_NAME }}_${{ env.ASSET_REVISION }} + path: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + + - name: Update artifact in latest-build + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'push' && endsWith(github.ref, 'Cog') + with: + prerelease: true + allowUpdates: true + replacesArtifacts: true + artifacts: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ matrix.mode == 'debug' && 'latest-debug-build' || matrix.mode == 'assert' && 'latest-assert-build' || 'latest-build' }} + body: ${{ github.event.head_commit.message }} + + - name: Deploy artifact as new release candidate + uses: ncipollo/release-action@v1.8.6 + if: github.event_name == 'workflow_dispatch' + with: + prerelease: true # release candidate + allowUpdates: true + replacesArtifacts: true + artifacts: products/${{ env.ASSET_NAME }}.${{ env.ASSET_EXTENSION }} + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.event.inputs.tag }} + body: ${{ github.event.head_commit.message }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 721ae997b8..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,225 +0,0 @@ -language: c - -sudo: required - -addons: - apt: - update: true - -cache: - directories: - - armchroot - - .thirdparty-cache - -notifications: - slack: - secure: gyekIJqPdx7SxqpugvtpY5mZSg54oFkFJ+DKBPILtjyI/sDhcSwT9GwY/zoHoYkoHrPLepDxyPgkAC8JCcTiAcxOazq5zlVva6SoQRjlDnC64oCYvOj/2giuYkXLXnwvj8mIINEgXzEvLdalpHwazsY0fzKNFM1mdrkPolmf2CvaNbKCGkiagsjrxJHEEB4tLcUP4ArqVE6wb+20HXoMKlHccgCFvN67bYJrTXDnuhEgKMooQRFv0yVoimckdRn1amvIgljavPwv2yHX+V1roneyi90e4ri9AT2sROeRprGnaib9Z8p+/mgWIUnTLL7pjbNHhtvZptsj3xjanWy1Bt/4MMewTWN4REE/KKxLp79CQvGNR+Ki7mF2UpgYUtxHYpFNIGNF9VomwnfWAuYdGDAYAGY3S1W12RPo37CC7RP/lPM96L6ypW41FoQKlnhzm+StJV+mlI5C1jQBU2WKoVhaKXJpraX2mUJXyN8ilYDo7PrJe0SRLH6J2WwPM5Z/RdscBDEGAR4RhZnn++1IE7e1gZPJB4NZH/3wLBwDhz8S4kB/GB32/rz3ZaftCf2+XjAZXzF3SroUCZ/MWZPGrwchEkU/3z1Tm8FTbELxZk1rSYpdLwVnXYooo5vggqjgAZvmlTerJuufl5lOkXT44PynZAvE+I+MrD04DpKuH0w= - -aliases: - - &mac-build - os: osx - osx_image: xcode8.3 - -notifications: - email: - - vm-dev@lists.squeakfoundation.org - -jobs: - fast_finish: true - include: - - stage: "Main Squeak and Pharo builds" - env: ARCH="linux32x86" FLAVOR="squeak.cog.spur" - - env: ARCH="macos32x86" FLAVOR="squeak.cog.spur" - <<: *mac-build - - env: ARCH="linux64x64" FLAVOR="squeak.cog.spur" - - env: ARCH="macos64x64" FLAVOR="squeak.cog.spur" - <<: *mac-build - - env: ARCH="linux32x86" FLAVOR="pharo.cog.spur" HEARTBEAT="threaded" - # - env: ARCH="macos32x86" FLAVOR="pharo.cog.spur" - # <<: *mac-build - - env: ARCH="linux64x64" FLAVOR="pharo.cog.spur" HEARTBEAT="threaded" - # - env: ARCH="macos64x64" FLAVOR="pharo.cog.spur" - # <<: *mac-build - - - stage: "Minheadless CMake builds" - env: ARCH="linux32x86" FLAVOR="squeak.cog.spur" CPU_ARCH="x86" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos32x86" FLAVOR="squeak.cog.spur" CPU_ARCH="x86" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - env: ARCH="linux64x64" FLAVOR="squeak.cog.spur" CPU_ARCH="x64" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos64x64" FLAVOR="squeak.cog.spur" CPU_ARCH="x64" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - env: ARCH="linux32x86" FLAVOR="pharo.cog.spur" CPU_ARCH="x86" HEARTBEAT="threaded" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos32x86" FLAVOR="pharo.cog.spur" CPU_ARCH="x86" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - env: ARCH="linux64x64" FLAVOR="pharo.cog.spur" CPU_ARCH="x64" HEARTBEAT="threaded" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos64x64" FLAVOR="pharo.cog.spur" CPU_ARCH="x64" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - # Minheadless CMake builds with SDL2 traditional display - - env: ARCH="linux32x86" FLAVOR="squeak.cog.spur+sdl2" CPU_ARCH="x86" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos32x86" FLAVOR="squeak.cog.spur+sdl2" CPU_ARCH="x86" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - env: ARCH="linux64x64" FLAVOR="squeak.cog.spur+sdl2" CPU_ARCH="x64" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos64x64" FLAVOR="squeak.cog.spur+sdl2" CPU_ARCH="x64" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - env: ARCH="linux32x86" FLAVOR="pharo.cog.spur+sdl2" CPU_ARCH="x86" HEARTBEAT="threaded" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos32x86" FLAVOR="pharo.cog.spur+sdl2" CPU_ARCH="x86" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - env: ARCH="linux64x64" FLAVOR="pharo.cog.spur+sdl2" CPU_ARCH="x64" HEARTBEAT="threaded" BUILD_WITH_CMAKE="yes" - - env: ARCH="macos64x64" FLAVOR="pharo.cog.spur+sdl2" CPU_ARCH="x64" BUILD_WITH_CMAKE="yes" - <<: *mac-build - - - stage: "Other Linux builds" - # env: ARCH="linux64x64" FLAVOR="newspeak.cog.spur" - - env: ARCH="linux64x64" FLAVOR="pharo.cog.spur" HEARTBEAT="itimer" - # - env: ARCH="linux64x64" FLAVOR="pharo.sista.spur" HEARTBEAT="threaded" - # - env: ARCH="linux32x86" FLAVOR="newspeak.cog.spur" - - env: ARCH="linux32x86" FLAVOR="squeak.cog.v3" - - env: ARCH="linux32x86" FLAVOR="squeak.sista.spur" - - env: ARCH="linux32x86" FLAVOR="pharo.cog.spur" HEARTBEAT="itimer" - - env: ARCH="linux32x86" FLAVOR="pharo.sista.spur" HEARTBEAT="threaded" - compiler: clang - - env: ARCH="linux32x86" FLAVOR="pharo.sista.spur" HEARTBEAT="itimer" - compiler: clang - - - stage: "Other Mac builds" - # env: ARCH="macos64x64" FLAVOR="newspeak.cog.spur" - # <<: *mac-build - # - env: ARCH="macos64x64" FLAVOR="pharo.sista.spur" - # <<: *mac-build - env: ARCH="macos64x64" FLAVOR="pharo.cog.spur.lowcode" - <<: *mac-build - # - env: ARCH="macos32x86" FLAVOR="newspeak.cog.spur" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="pharo.sista.spur" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="pharo.cog.spur.lowcode" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="squeak.cog.v3" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="squeak.sista.spur" - <<: *mac-build - - - stage: "Stack builds" - env: ARCH="linux64x64" FLAVOR="squeak.stack.spur" - # - env: ARCH="linux64x64" FLAVOR="newspeak.stack.spur" - # - env: ARCH="linux32x86" FLAVOR="newspeak.stack.spur" - - env: ARCH="linux32x86" FLAVOR="squeak.stack.spur" - - env: ARCH="linux32x86" FLAVOR="squeak.stack.v3" - - env: ARCH="macos64x64" FLAVOR="pharo.stack.spur" - <<: *mac-build - - env: ARCH="macos64x64" FLAVOR="pharo.stack.spur.lowcode" - <<: *mac-build - - env: ARCH="macos64x64" FLAVOR="squeak.stack.spur" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="newspeak.stack.spur" - <<: *mac-build - # - env: ARCH="macos64x64" FLAVOR="newspeak.stack.spur" - # <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="pharo.stack.spur" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="pharo.stack.spur.lowcode" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="squeak.stack.spur" - <<: *mac-build - - env: ARCH="macos32x86" FLAVOR="squeak.stack.v3" - <<: *mac-build - - - stage: "linux32ARMv6 builds" - # env: ARCH="linux32ARMv6" FLAVOR="newspeak.cog.spur" CHROOT="schroot -p -c rpi - # -- bash -c " - # dist: trusty - # group: edge - # - env: ARCH="linux32ARMv6" FLAVOR="newspeak.stack.spur" CHROOT="schroot -p -c rpi - # -- bash -c " - # dist: trusty - # group: edge - env: ARCH="linux32ARMv6" FLAVOR="squeak.cog.spur" CHROOT="schroot -p -c rpi -- - bash -c " - dist: trusty - group: edge - - env: ARCH="linux32ARMv6" FLAVOR="pharo.cog.spur" CHROOT="schroot -p -c rpi -- - bash -c " - dist: trusty - group: edge - - env: ARCH="linux32ARMv6" FLAVOR="squeak.stack.spur" CHROOT="schroot -p -c rpi - -- bash -c " - dist: trusty - group: edge - - env: ARCH="linux32ARMv6" FLAVOR="squeak.stack.v3" CHROOT="schroot -p -c rpi -- - bash -c " - dist: trusty - group: edge - allow_failures: - - env: FLAVOR="squeak.sista.spur" - - env: FLAVOR="pharo.sista.spur" - - env: FLAVOR="squeak.cog.spur.lowcode" - - env: FLAVOR="pharo.cog.spur.lowcode" - - env: ARCH="linux64x64" FLAVOR="newspeak.cog.spur" - - env: ARCH="linux32x86" FLAVOR="newspeak.cog.spur" - - env: ARCH="macos64x64" FLAVOR="newspeak.cog.spur" - - env: ARCH="macos32x86" FLAVOR="newspeak.cog.spur" - - env: ARCH="linux64x64" FLAVOR="newspeak.stack.spur" - - env: ARCH="linux32x86" FLAVOR="newspeak.stack.spur" - - env: ARCH="macos64x64" FLAVOR="newspeak.stack.spur" - - env: ARCH="macos32x86" FLAVOR="newspeak.stack.spur" - - env: ARCH="linux32ARMv6" FLAVOR="newspeak.cog.spur" - - env: ARCH="linux32ARMv6" FLAVOR="newspeak.stack.spur" - - env: ARCH="linux64x64" FLAVOR="pharo.cog.spur" HEARTBEAT="threaded" - - env: ARCH="linux32x86" FLAVOR="pharo.cog.spur" HEARTBEAT="threaded" - - env: ARCH="linux64x64" FLAVOR="pharo.cog.spur" HEARTBEAT="itimer" - - env: ARCH="linux32x86" FLAVOR="pharo.cog.spur" HEARTBEAT="itimer" - - env: ARCH="macos64x64" FLAVOR="pharo.cog.spur" - - env: ARCH="macos32x86" FLAVOR="pharo.cog.spur" - - env: ARCH="macos64x64" FLAVOR="pharo.cog.spur.lowcode" - - env: ARCH="macos32x86" FLAVOR="pharo.cog.spur.lowcode" - - env: ARCH="linux64x64" FLAVOR="pharo.sista.spur" HEARTBEAT="threaded" - - env: ARCH="linux32x86" FLAVOR="pharo.sista.spur" HEARTBEAT="threaded" - - env: ARCH="linux64x64" FLAVOR="pharo.sista.spur" HEARTBEAT="itimer" - - env: ARCH="linux32x86" FLAVOR="pharo.sista.spur" HEARTBEAT="itimer" - - env: ARCH="macos64x64" FLAVOR="pharo.sista.spur" - - env: ARCH="macos32x86" FLAVOR="pharo.sista.spur" - - env: ARCH="linux64x64" FLAVOR="pharo.stack.spur" - - env: ARCH="linux32x86" FLAVOR="pharo.stack.spur" - - env: ARCH="macos64x64" FLAVOR="pharo.stack.spur" - - env: ARCH="macos32x86" FLAVOR="pharo.stack.spur" - - env: ARCH="linux64x64" FLAVOR="pharo.stack.spur.lowcode" - - env: ARCH="linux32x86" FLAVOR="pharo.stack.spur.lowcode" - - env: ARCH="macos64x64" FLAVOR="pharo.stack.spur.lowcode" - - env: ARCH="macos32x86" FLAVOR="pharo.stack.spur.lowcode" - - env: ARCH="linux32ARMv6" FLAVOR="pharo.cog.spur" - - env: ARCH="linux32ARMv6" FLAVOR="pharo.stack.spur" - -install: ./scripts/ci/travis_install.sh - -before_script: $CHROOT ./scripts/ci/travis_build.sh - -script: ./scripts/ci/travis_test.sh - -after_success: (cd deploy && ./filter-exec.sh pack-vm.sh) - -deploy: - - provider: script # Deploy bleeding edge to Bintray - script: (cd deploy && ./filter-exec.sh ./bintray.sh) - skip_cleanup: true - on: - repo: OpenSmalltalk/opensmalltalk-vm - branch: Cog - - provider: script # Deploy to files.pharo.org - script: (cd deploy/pharo && ./filter-exec.sh ./deploy.sh) - skip_cleanup: true - on: - repo: OpenSmalltalk/opensmalltalk-vm - branch: Cog - condition: $FLAVOR == pharo* - - provider: releases # Deploy stable tags to GitHub releases - api_key: - secure: ASzbVm1ootfvzfAYm50rWCfIvwp/O+6N1NMv2lymvswj/sGW7MxmYGHj2UNtLg9OAD+lL9YyElyy94MCpSK496+pD7GrOdRAitilMreWR6jGab0D92pPcujMAsDDSRTPNZsui1kvK1skWGMCN41mXLlwtCxSqWdhQ1viMmjXeK29TJbHykFEdfgZc6RcB97NdMyz6Pp9uqbxXSA656UxeLJzsKX88mXFcd5983pVt1ME8dfeUC9dwTihG5IAEg3Uz6HDxcR3uero0alLXycer5zI1kHLede03aNNvcRcUnVjBa5rNY8ON884DblDC+lcc+8b104MQTAGKWbyibjpm+9b0oWJV/tB20VdJUxZ2MpuktLzUrFBjVFjSrB5NmkITtJ1o+eYmjJOzWZNqFueNIsEkbGItDQJkKhNySBnUZ3/gyxnTBwmulUF2i8dimdwAuZlMiTN5mqpSLzLCE9ZrGWz9zuuCCombvpNIAc2IMsaTlpj391TjQfqGvu+Z88hmJOmDwpdUsGwNHo+Cz1N+KivAfySgj1T+CfE4xnuKOQzVbUK1Aqv/uGl1ieS1MfgyrqfgvRWEcGQh7/35n6yxG5s2z1qrs9Vl0e0rN261GQuK5ElNsQSLVRNH13+PdDwTCEZ/APzo+0uGRGTmGKJtzAofmkeAsrwmgGJPAuip/0= - file_glob: true - file: "./products/*.{dmg,gz,zip}" - skip_cleanup: true - on: - repo: OpenSmalltalk/opensmalltalk-vm - tags: true - -after_deploy: (cd deploy && ./filter-exec.sh bintray-cleanup.sh) diff --git a/README.md b/README.md index c7e2ecc018..720a624d36 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,27 @@ This is the README for the Cog Git source tree: https://github.com/OpenSmalltalk/opensmalltalk-vm [![Download stable](https://img.shields.io/badge/download-stable-green.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/latest) -[![Download bleedingEdge](https://img.shields.io/badge/download-bleeding%20edge-blue.svg)](https://bintray.com/opensmalltalk/vm/cog/_latestVersion#files) -[![Unix Build Status](https://travis-ci.com/OpenSmalltalk/opensmalltalk-vm.svg?branch=Cog)](https://travis-ci.com/OpenSmalltalk/opensmalltalk-vm) -[![Windows Build status](https://ci.appveyor.com/api/projects/status/ecrpcrqt844n8lkm/branch/Cog?svg=true)](https://ci.appveyor.com/project/OpenSmalltalk/vm/branch/Cog) +[![Download latestBuild](https://img.shields.io/badge/download-latest%20build-blue.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/latest-build) +[![Download latestAssertBuild](https://img.shields.io/badge/download-latest%20assert%20build-lightgrey.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/latest-assert-build) +[![Download latestDebugBuild](https://img.shields.io/badge/download-latest%20debug%20build-lightgrey.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/latest-debug-build) + +[![Build for macOS](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/macos.yml/badge.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/macos.yml) +[![Build for Windows](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/win.yml/badge.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/win.yml) +[![Build for Linux (x86)](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/linux.yml/badge.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/linux.yml) +[![Build for Linux (ARM)](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/linux-arm.yml/badge.svg)](https://github.com/OpenSmalltalk/opensmalltalk-vm/actions/workflows/linux-arm.yml) [![DOI](https://zenodo.org/badge/59481716.svg)](https://zenodo.org/badge/latestdoi/59481716) -Builds are tested automatically on each commit on Travis and Appveyor, for -Windows 32, Mac OS X 32 and 64, and on Linux 32, 64, and ARM. Squeak, and Pharo -VMs are built with and without JIT, with and without Spur, and with and -without Sista, as available per platform. All build artifacts are uploaded to -Bintray. If you wish to commit *without* triggering a build, for example if you -were to only edit this documentation, then if you add **[ci skip]** somewhere in -your commit message, Travis and Appveyor will *not* build that commit. +Builds are tested automatically on each commit, for Windows, macOS, and Linux. +Windows and Linux also have 32-bit targets. Squeak and Pharo VMs are built with +and without JIT, with and without Spur, and with and without Sista, as available +per platform. All build artifacts remain accessible for 90 days for each +workflow run; the latest artifacts are uploaded to a dedicated release tag +(e.g., "latest-build"), overwritten with each successful run. If you wish to +commit *without* triggering a build, for example if you were to only edit this +documentation, then if you add **[ci skip]** somewhere in your commit message, +no workflow run will be started for that commit. ### Important notice for Developers: We rely on source file substitutions in the src tree, specifically, diff --git a/building/linux32ARMv6/pharo.cog.spur/plugins.ext b/building/linux32ARMv6/pharo.cog.spur/plugins.ext index 7256d539d1..bf92aeada6 100644 --- a/building/linux32ARMv6/pharo.cog.spur/plugins.ext +++ b/building/linux32ARMv6/pharo.cog.spur/plugins.ext @@ -15,4 +15,5 @@ FileAttributesPlugin \ BochsIA32Plugin \ BochsX64Plugin \ GdbARMPlugin \ -#SDL2DisplayPlugin +VectorEnginePlugin \ +#SDL2DisplayPlugin \ diff --git a/building/linux32ARMv6/squeak.cog.spur/plugins.ext b/building/linux32ARMv6/squeak.cog.spur/plugins.ext index 254bda4d94..7fbdb1f7c7 100644 --- a/building/linux32ARMv6/squeak.cog.spur/plugins.ext +++ b/building/linux32ARMv6/squeak.cog.spur/plugins.ext @@ -16,6 +16,7 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ #BochsIA32Plugin \ #BochsX64Plugin \ -#GdbARMPlugin +#GdbARMPlugin \ diff --git a/building/linux32ARMv6/squeak.cog.v3/plugins.ext b/building/linux32ARMv6/squeak.cog.v3/plugins.ext index 254bda4d94..7fbdb1f7c7 100644 --- a/building/linux32ARMv6/squeak.cog.v3/plugins.ext +++ b/building/linux32ARMv6/squeak.cog.v3/plugins.ext @@ -16,6 +16,7 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ #BochsIA32Plugin \ #BochsX64Plugin \ -#GdbARMPlugin +#GdbARMPlugin \ diff --git a/building/linux32ARMv6/squeak.stack.spur/plugins.ext b/building/linux32ARMv6/squeak.stack.spur/plugins.ext index d832ee6dde..3c73ab6a00 100644 --- a/building/linux32ARMv6/squeak.stack.spur/plugins.ext +++ b/building/linux32ARMv6/squeak.stack.spur/plugins.ext @@ -14,3 +14,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux32ARMv6/squeak.stack.v3/plugins.ext b/building/linux32ARMv6/squeak.stack.v3/plugins.ext index d832ee6dde..3c73ab6a00 100644 --- a/building/linux32ARMv6/squeak.stack.v3/plugins.ext +++ b/building/linux32ARMv6/squeak.stack.v3/plugins.ext @@ -14,3 +14,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux32ARMv7/newspeak.cog.spur/plugins.ext b/building/linux32ARMv7/newspeak.cog.spur/plugins.ext new file mode 100644 index 0000000000..f97d8b6cdd --- /dev/null +++ b/building/linux32ARMv7/newspeak.cog.spur/plugins.ext @@ -0,0 +1,3 @@ +# Copied, perhaps edited, from ../../../nscogsrc/examplePlugins.ext +EXTERNAL_PLUGINS = \ +SqueakSSL diff --git a/building/linux32ARMv7/newspeak.cog.spur/plugins.int b/building/linux32ARMv7/newspeak.cog.spur/plugins.int new file mode 100644 index 0000000000..cfd6f4c2c0 --- /dev/null +++ b/building/linux32ARMv7/newspeak.cog.spur/plugins.int @@ -0,0 +1,29 @@ +# Copied, perhaps edited, from ../../../nscogsrc/examplePlugins.int +INTERNAL_PLUGINS = \ +AioPlugin \ +AsynchFilePlugin \ +BMPReadWriterPlugin \ +B2DPlugin \ +BitBltPlugin \ +DSAPrims \ +DropPlugin \ +FileCopyPlugin \ +FilePlugin \ +Float64ArrayPlugin \ +FloatArrayPlugin \ +FloatMathPlugin \ +HostWindowPlugin \ +ZipPlugin \ +JPEGReadWriter2Plugin \ +JPEGReaderPlugin \ +LargeIntegers \ +Matrix2x3Plugin \ +MiscPrimitivePlugin \ +IA32ABI \ +RePlugin \ +SecurityPlugin \ +SocketPlugin \ +SurfacePlugin \ +UUIDPlugin \ +UnixOSProcessPlugin \ +VMProfileLinuxSupportPlugin diff --git a/building/linux32ARMv7/newspeak.stack.spur/plugins.ext b/building/linux32ARMv7/newspeak.stack.spur/plugins.ext new file mode 100644 index 0000000000..f97d8b6cdd --- /dev/null +++ b/building/linux32ARMv7/newspeak.stack.spur/plugins.ext @@ -0,0 +1,3 @@ +# Copied, perhaps edited, from ../../../nscogsrc/examplePlugins.ext +EXTERNAL_PLUGINS = \ +SqueakSSL diff --git a/building/linux32ARMv7/newspeak.stack.spur/plugins.int b/building/linux32ARMv7/newspeak.stack.spur/plugins.int new file mode 100644 index 0000000000..cfd6f4c2c0 --- /dev/null +++ b/building/linux32ARMv7/newspeak.stack.spur/plugins.int @@ -0,0 +1,29 @@ +# Copied, perhaps edited, from ../../../nscogsrc/examplePlugins.int +INTERNAL_PLUGINS = \ +AioPlugin \ +AsynchFilePlugin \ +BMPReadWriterPlugin \ +B2DPlugin \ +BitBltPlugin \ +DSAPrims \ +DropPlugin \ +FileCopyPlugin \ +FilePlugin \ +Float64ArrayPlugin \ +FloatArrayPlugin \ +FloatMathPlugin \ +HostWindowPlugin \ +ZipPlugin \ +JPEGReadWriter2Plugin \ +JPEGReaderPlugin \ +LargeIntegers \ +Matrix2x3Plugin \ +MiscPrimitivePlugin \ +IA32ABI \ +RePlugin \ +SecurityPlugin \ +SocketPlugin \ +SurfacePlugin \ +UUIDPlugin \ +UnixOSProcessPlugin \ +VMProfileLinuxSupportPlugin diff --git a/building/linux32x86/pharo.cog.spur.lowcode/plugins.ext b/building/linux32x86/pharo.cog.spur.lowcode/plugins.ext index a646013ce1..9557485172 100644 --- a/building/linux32x86/pharo.cog.spur.lowcode/plugins.ext +++ b/building/linux32x86/pharo.cog.spur.lowcode/plugins.ext @@ -10,5 +10,6 @@ InternetConfigPlugin \ SurfacePlugin \ EventsHandlerPlugin \ FileAttributesPlugin \ +VectorEnginePlugin \ # SDL2DisplayPlugin \ diff --git a/building/linux32x86/pharo.cog.spur/plugins.ext b/building/linux32x86/pharo.cog.spur/plugins.ext index 699ba65420..291217e8cf 100644 --- a/building/linux32x86/pharo.cog.spur/plugins.ext +++ b/building/linux32x86/pharo.cog.spur/plugins.ext @@ -15,4 +15,5 @@ AioPlugin \ BochsIA32Plugin \ BochsX64Plugin \ GdbARMPlugin \ -# SDL2DisplayPlugin +VectorEnginePlugin \ +# SDL2DisplayPlugin \ diff --git a/building/linux32x86/pharo.sista.spur/plugins.ext b/building/linux32x86/pharo.sista.spur/plugins.ext index 4f1c0ea952..3b64398407 100644 --- a/building/linux32x86/pharo.sista.spur/plugins.ext +++ b/building/linux32x86/pharo.sista.spur/plugins.ext @@ -12,5 +12,6 @@ EventsHandlerPlugin \ SqueakSSL \ FileAttributesPlugin \ AioPlugin \ +VectorEnginePlugin \ # SDL2DisplayPlugin \ diff --git a/building/linux32x86/pharo.stack.spur.lowcode/plugins.ext b/building/linux32x86/pharo.stack.spur.lowcode/plugins.ext index a646013ce1..9557485172 100644 --- a/building/linux32x86/pharo.stack.spur.lowcode/plugins.ext +++ b/building/linux32x86/pharo.stack.spur.lowcode/plugins.ext @@ -10,5 +10,6 @@ InternetConfigPlugin \ SurfacePlugin \ EventsHandlerPlugin \ FileAttributesPlugin \ +VectorEnginePlugin \ # SDL2DisplayPlugin \ diff --git a/building/linux32x86/squeak.cog.spur/plugins.ext b/building/linux32x86/squeak.cog.spur/plugins.ext index cfaaf3c519..029ca11aa9 100644 --- a/building/linux32x86/squeak.cog.spur/plugins.ext +++ b/building/linux32x86/squeak.cog.spur/plugins.ext @@ -18,3 +18,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux32x86/squeak.cog.v3/plugins.ext b/building/linux32x86/squeak.cog.v3/plugins.ext index 94d90fd85a..5be6743400 100644 --- a/building/linux32x86/squeak.cog.v3/plugins.ext +++ b/building/linux32x86/squeak.cog.v3/plugins.ext @@ -16,3 +16,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux32x86/squeak.sista.spur/plugins.ext b/building/linux32x86/squeak.sista.spur/plugins.ext index 94d90fd85a..5be6743400 100644 --- a/building/linux32x86/squeak.sista.spur/plugins.ext +++ b/building/linux32x86/squeak.sista.spur/plugins.ext @@ -16,3 +16,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux32x86/squeak.stack.spur/plugins.ext b/building/linux32x86/squeak.stack.spur/plugins.ext index 390fcc5b46..29506a64ba 100644 --- a/building/linux32x86/squeak.stack.spur/plugins.ext +++ b/building/linux32x86/squeak.stack.spur/plugins.ext @@ -15,3 +15,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux32x86/squeak.stack.v3/plugins.ext b/building/linux32x86/squeak.stack.v3/plugins.ext index 390fcc5b46..29506a64ba 100644 --- a/building/linux32x86/squeak.stack.v3/plugins.ext +++ b/building/linux32x86/squeak.stack.v3/plugins.ext @@ -15,3 +15,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux64ARMv8/bochsx64/conf.COG b/building/linux64ARMv8/bochsx64/conf.COG new file mode 100755 index 0000000000..b263399cb4 --- /dev/null +++ b/building/linux64ARMv8/bochsx64/conf.COG @@ -0,0 +1,56 @@ +#!/bin/sh + +# Bochs x64 simulator for the BochsX64Alien plugin. +# this sets up the x64 compile for Cog on Mac OS X. Disable as much inessential +# stuff as possible leaving only the cpu/fpu & memory interface + +# build cpu/libcpu.a disasm/libdisasm.a fpu/libfpu.a using +# $ ./conf.COG +# $ ../../processors/IA32/bochs/makeem + +set echo +# CFLAGS="-pipe -O3 -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arrays $CFLAGS" +CFLAGS="-Dlongjmp=_longjmp -Dsetjmp=_setjmp $CFLAGS" +CFLAGS="-fPIC -pipe -O3 -fomit-frame-pointer -finline-functions $CFLAGS" +CFLAGS="-g $CFLAGS" +CPPFLAGS="" +CXXFLAGS="$CFLAGS" + +export CFLAGS +export CPATH +export CPPFLAGS +export CXXFLAGS +export LDFLAGS + +../../processors/IA32/bochs/configure \ + --enable-Cog \ + --enable-cpu-level=6 \ + --enable-sse=2 \ + --enable-assert-checks \ + --with-nogui \ + --enable-x86-64 \ + --enable-global-pages \ + --disable-mtrr \ + --disable-sb16 \ + --disable-ne2000 \ + --disable-pci \ + --disable-acpi \ + --disable-apic \ + --disable-clgd54xx \ + --disable-usb \ + --disable-plugins \ + ${CONFIGURE_ARGS} + +# apic == Advanced programmable Interrupt Controller +# acpi == Advanced Configuration and Power Interface +# pci == Peripheral Component Interconnect local bus +# clgd54xx == Cirrus Logic GD54xx video card + +# avoid conflict with squeak unix build's config.h +echo cp config.h bochsconfig.h +cp config.h bochsconfig.h + +rm -f THIS_IS_A_* +echo >THIS_IS_A_FAST_CONFIG + +echo "and don't forget to run ./makeem" diff --git a/building/linux64ARMv8/bochsx64/conf.COG.dbg b/building/linux64ARMv8/bochsx64/conf.COG.dbg new file mode 100755 index 0000000000..3f81c4156d --- /dev/null +++ b/building/linux64ARMv8/bochsx64/conf.COG.dbg @@ -0,0 +1,55 @@ +#!/bin/sh + +# Bochs x64 simulator for the BochsX64Alien plugin. +# this sets up the x64 compile for Cog on Mac OS X. Disable as much inessential +# stuff as possible leaving only the cpu/fpu & memory interface + +# build cpu/libcpu.a disasm/libdisasm.a fpu/libfpu.a using +# $ ./conf.COG.dbg +# $ ../../processors/IA32/bochs/makeem + +set echo +CFLAGS="-Dlongjmp=_longjmp -Dsetjmp=_setjmp $CFLAGS" +CFLAGS="-fPIC -pipe -O0 $CFLAGS" +CFLAGS="-g3 $CFLAGS" +CPPFLAGS="" +CXXFLAGS="$CFLAGS" + +export CFLAGS +export CPATH +export CPPFLAGS +export CXXFLAGS +export LDFLAGS + +../../processors/IA32/bochs/configure \ + --enable-Cog \ + --enable-cpu-level=6 \ + --enable-sse=2 \ + --enable-assert-checks \ + --with-nogui \ + --enable-x86-64 \ + --enable-global-pages \ + --disable-mtrr \ + --disable-sb16 \ + --disable-ne2000 \ + --disable-pci \ + --disable-acpi \ + --disable-apic \ + --disable-clgd54xx \ + --disable-usb \ + --disable-plugins \ + ${CONFIGURE_ARGS} + +# apic == Advanced programmable Interrupt Controller +# acpi == Advanced Configuration and Power Interface +# pci == Peripheral Component Interconnect local bus +# clgd54xx == Cirrus Logic GD54xx video card + +# avoid conflict with squeak unix build's config.h +echo cp config.h bochsconfig.h +cp config.h bochsconfig.h + +rm -f THIS_IS_A_* +echo >THIS_IS_A_DEBUG_CONFIG + +echo "and don't forget to run ./makeem" diff --git a/building/linux64ARMv8/bochsx64/exploration/Makefile b/building/linux64ARMv8/bochsx64/exploration/Makefile new file mode 100644 index 0000000000..e97aa0452e --- /dev/null +++ b/building/linux64ARMv8/bochsx64/exploration/Makefile @@ -0,0 +1,3 @@ +include ../../../processors/IA32/bochs/explorationx64/Makefile.64 + +CFLAGS+=-Wno-invalid-offsetof diff --git a/building/linux64ARMv8/bochsx64/makeclean b/building/linux64ARMv8/bochsx64/makeclean new file mode 100755 index 0000000000..d08ee176ed --- /dev/null +++ b/building/linux64ARMv8/bochsx64/makeclean @@ -0,0 +1,7 @@ +#!/bin/sh +for t in *; do + case $t in + conf.COG*|makeclean|makeem) ;; + *) rm -rf $t + esac +done diff --git a/building/linux64ARMv8/bochsx64/makeem b/building/linux64ARMv8/bochsx64/makeem new file mode 100755 index 0000000000..986abf15d6 --- /dev/null +++ b/building/linux64ARMv8/bochsx64/makeem @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -e +test -f config.h || ./conf.COG +exec ../../processors/IA32/bochs/makeem diff --git a/building/linux64ARMv8/bochsx86/conf.COG b/building/linux64ARMv8/bochsx86/conf.COG new file mode 100755 index 0000000000..8fe51ae2dd --- /dev/null +++ b/building/linux64ARMv8/bochsx86/conf.COG @@ -0,0 +1,58 @@ +#!/bin/sh + +# Bochs x86 simulator for the BochsIA32Alien plugin. +# this sets up the x86 compile for Cog on Mac OS X. Disable as much inessential +# stuff as possible leaving only the cpu/fpu & memory interface + +# build cpu/libcpu.a disasm/libdisasm.a fpu/libfpu.a using +# $ ./conf.COG +# $ ../../processors/IA32/bochs/makeem + +set echo +# CFLAGS="-pipe -O3 -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arrays $CFLAGS" +CFLAGS="-Dlongjmp=_longjmp -Dsetjmp=_setjmp $CFLAGS" +CFLAGS="-fPIC -pipe -O3 -fomit-frame-pointer -finline-functions $CFLAGS" +CFLAGS="-g $CFLAGS" +CPPFLAGS="" +CXXFLAGS="$CFLAGS" + +export CFLAGS +export CPATH +export CPPFLAGS +export CXXFLAGS +export LDFLAGS + +../../processors/IA32/bochs/configure \ + --enable-Cog \ + --enable-cpu-level=6 \ + --enable-sse=2 \ + --enable-assert-checks \ + --with-nogui \ + --disable-x86-64 \ + --disable-pae \ + --disable-large-pages \ + --disable-global-pages \ + --disable-mtrr \ + --disable-sb16 \ + --disable-ne2000 \ + --disable-pci \ + --disable-acpi \ + --disable-apic \ + --disable-clgd54xx \ + --disable-usb \ + --disable-plugins \ + ${CONFIGURE_ARGS} + +# apic == Advanced programmable Interrupt Controller +# acpi == Advanced Configuration and Power Interface +# pci == Peripheral Component Interconnect local bus +# clgd54xx == Cirrus Logic GD54xx video card + +# avoid conflict with squeak unix build's config.h +echo cp config.h bochsconfig.h +cp config.h bochsconfig.h + +rm -f THIS_IS_A_* +echo >THIS_IS_A_FAST_CONFIG + +echo "and don't forget to run ./makeem" diff --git a/building/linux64ARMv8/bochsx86/conf.COG.dbg b/building/linux64ARMv8/bochsx86/conf.COG.dbg new file mode 100755 index 0000000000..dfa57ad6dc --- /dev/null +++ b/building/linux64ARMv8/bochsx86/conf.COG.dbg @@ -0,0 +1,58 @@ +#!/bin/sh + +# Bochs x86 simulator for the BochsIA32Alien plugin. +# this sets up the x86 compile for Cog on Mac OS X. Disable as much inessential +# stuff as possible leaving only the cpu/fpu & memory interface + +# build cpu/libcpu.a disasm/libdisasm.a fpu/libfpu.a using +# $ ./conf.COG +# $ ../../processors/IA32/bochs/makeem + +set echo +# CFLAGS="-pipe -O3 -fomit-frame-pointer -finline-functions -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-labels=16 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -fprefetch-loop-arrays $CFLAGS" +CFLAGS="-Dlongjmp=_longjmp -Dsetjmp=_setjmp $CFLAGS" +CFLAGS="-fPIC -pipe -O0 $CFLAGS" +CFLAGS="-g3 $CFLAGS" +CPPFLAGS="" +CXXFLAGS="$CFLAGS" + +export CFLAGS +export CPATH +export CPPFLAGS +export CXXFLAGS +export LDFLAGS + +../../processors/IA32/bochs/configure \ + --enable-Cog \ + --enable-cpu-level=6 \ + --enable-sse=2 \ + --enable-assert-checks \ + --with-nogui \ + --disable-x86-64 \ + --disable-pae \ + --disable-large-pages \ + --disable-global-pages \ + --disable-mtrr \ + --disable-sb16 \ + --disable-ne2000 \ + --disable-pci \ + --disable-acpi \ + --disable-apic \ + --disable-clgd54xx \ + --disable-usb \ + --disable-plugins \ + ${CONFIGURE_ARGS} + +# apic == Advanced programmable Interrupt Controller +# acpi == Advanced Configuration and Power Interface +# pci == Peripheral Component Interconnect local bus +# clgd54xx == Cirrus Logic GD54xx video card + +# avoid conflict with squeak unix build's config.h +echo cp config.h bochsconfig.h +cp config.h bochsconfig.h + +rm -f THIS_IS_A_* +echo >THIS_IS_A_DEBUG_CONFIG + +echo "and don't forget to run ./makeem" diff --git a/building/linux64ARMv8/bochsx86/exploration/Makefile b/building/linux64ARMv8/bochsx86/exploration/Makefile new file mode 100644 index 0000000000..b60de8f99c --- /dev/null +++ b/building/linux64ARMv8/bochsx86/exploration/Makefile @@ -0,0 +1 @@ +include ../../../processors/IA32/bochs/exploration/Makefile.64 diff --git a/building/linux64ARMv8/bochsx86/makeclean b/building/linux64ARMv8/bochsx86/makeclean new file mode 100755 index 0000000000..d08ee176ed --- /dev/null +++ b/building/linux64ARMv8/bochsx86/makeclean @@ -0,0 +1,7 @@ +#!/bin/sh +for t in *; do + case $t in + conf.COG*|makeclean|makeem) ;; + *) rm -rf $t + esac +done diff --git a/building/linux64ARMv8/bochsx86/makeem b/building/linux64ARMv8/bochsx86/makeem new file mode 100755 index 0000000000..986abf15d6 --- /dev/null +++ b/building/linux64ARMv8/bochsx86/makeem @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -e +test -f config.h || ./conf.COG +exec ../../processors/IA32/bochs/makeem diff --git a/building/linux64ARMv8/gdbarm32/clean b/building/linux64ARMv8/gdbarm32/clean new file mode 100755 index 0000000000..c6d6b5d681 --- /dev/null +++ b/building/linux64ARMv8/gdbarm32/clean @@ -0,0 +1,4 @@ +#!/bin/sh +rm -rf bfd gdb libiberty opcodes sim +rm exploration/print*64 +rm -i exploration/*.st diff --git a/building/linux64ARMv8/gdbarm32/conf.COG b/building/linux64ARMv8/gdbarm32/conf.COG new file mode 100755 index 0000000000..8c66b1f577 --- /dev/null +++ b/building/linux64ARMv8/gdbarm32/conf.COG @@ -0,0 +1,13 @@ +#!/bin/sh +S=../../../processors/ARM/gdb-8.3.1 +export CFLAGS="-g -Os -m64 -DCOG=1 -DWORDS_BIGENDIAN=0" +export CFLAGS="-g3 -O0 -m64 -DCOG=1 -DWORDS_BIGENDIAN=0" +CONFFLAGS='--target=arm-apple-darwin CC=clang CXX=clang++ --with-system-zlib=yes' +mkdir -p bfd libiberty opcodes sim/common sim/arm +for d in bfd libiberty opcodes; do + (cd $d; $S/$d/configure COG=1 CFLAGS="$CFLAGS" $CONFFLAGS) +done +for d in sim/common sim/arm; do + (cd $d; + ../$S/$d/configure COG=1 CFLAGS="$CFLAGS" $CONFFLAGS) +done diff --git a/building/linux64ARMv8/gdbarm32/makeem b/building/linux64ARMv8/gdbarm32/makeem new file mode 100755 index 0000000000..d3c8d53412 --- /dev/null +++ b/building/linux64ARMv8/gdbarm32/makeem @@ -0,0 +1,6 @@ +#!/bin/sh -e +test -d bfd || ./conf.COG +for d in bfd libiberty opcodes; do + (cd ./$d; make SUBDIRS="" COG=1) +done +(cd ./sim/arm; make version.c; test -f version.c-tmp && mv version.c-tmp version.c; make COG=1 libsim.a) diff --git a/building/linux64ARMv8/gdbarm64/clean b/building/linux64ARMv8/gdbarm64/clean new file mode 100755 index 0000000000..c6d6b5d681 --- /dev/null +++ b/building/linux64ARMv8/gdbarm64/clean @@ -0,0 +1,4 @@ +#!/bin/sh +rm -rf bfd gdb libiberty opcodes sim +rm exploration/print*64 +rm -i exploration/*.st diff --git a/building/linux64ARMv8/gdbarm64/conf.COG b/building/linux64ARMv8/gdbarm64/conf.COG new file mode 100755 index 0000000000..664f148fc6 --- /dev/null +++ b/building/linux64ARMv8/gdbarm64/conf.COG @@ -0,0 +1,14 @@ +#!/bin/sh +S=../../../processors/ARM/gdb-8.3.1 +export CFLAGS="-g -O2 -m64 -DCOG=1 -DWORDS_BIGENDIAN=0" +#export CFLAGS="-g3 -O0 -m64 -DCOG=1 -DWORDS_BIGENDIAN=0" +CONFFLAGS='--target=aarch64-apple-darwin CC=clang CXX=clang++ --with-system-zlib=yes' +mkdir -p bfd gdb libiberty opcodes sim/common sim/aarch64 +for d in bfd gdb libiberty opcodes; do + (cd $d; $S/$d/configure COG=1 CFLAGS="$CFLAGS" $CONFFLAGS) +done +for d in sim/common sim/aarch64; do + (cd $d; + ../$S/$d/configure COG=1 CFLAGS="$CFLAGS" $CONFFLAGS \ + --disable-sim-trace) +done diff --git a/building/linux64ARMv8/gdbarm64/makeem b/building/linux64ARMv8/gdbarm64/makeem new file mode 100755 index 0000000000..286ae9727f --- /dev/null +++ b/building/linux64ARMv8/gdbarm64/makeem @@ -0,0 +1,6 @@ +#!/bin/sh -e +test -d bfd || ./conf.COG +(cd ./bfd; make COG=1 bfdver.h targmatch.h libbfd.a) +(cd ./libiberty; make COG=1 libiberty.a) +(cd ./opcodes; make COG=1 libopcodes.a) +(cd ./sim/aarch64; make version.c; test -f version.c-tmp && mv version.c-tmp version.c; make COG=1 libsim.a) diff --git a/building/linux64ARMv8/pharo.stack.spur/plugins.ext b/building/linux64ARMv8/pharo.stack.spur/plugins.ext index 883ed81938..eb8af47d82 100644 --- a/building/linux64ARMv8/pharo.stack.spur/plugins.ext +++ b/building/linux64ARMv8/pharo.stack.spur/plugins.ext @@ -14,5 +14,6 @@ AioPlugin \ FileAttributesPlugin \ BochsIA32Plugin \ BochsX64Plugin \ +VectorEnginePlugin \ #GdbARMPlugin \ -#SDL2DisplayPlugin +#SDL2DisplayPlugin \ diff --git a/building/linux64ARMv8/squeak.cog.spur/plugins.ext b/building/linux64ARMv8/squeak.cog.spur/plugins.ext index f3a5b09943..812774c97d 100644 --- a/building/linux64ARMv8/squeak.cog.spur/plugins.ext +++ b/building/linux64ARMv8/squeak.cog.spur/plugins.ext @@ -17,4 +17,5 @@ ImmX11Plugin \ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ -SHA2Plugin +SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux64ARMv8/squeak.cogmt.spur/plugins.ext b/building/linux64ARMv8/squeak.cogmt.spur/plugins.ext index f3a5b09943..812774c97d 100644 --- a/building/linux64ARMv8/squeak.cogmt.spur/plugins.ext +++ b/building/linux64ARMv8/squeak.cogmt.spur/plugins.ext @@ -17,4 +17,5 @@ ImmX11Plugin \ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ -SHA2Plugin +SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux64ARMv8/squeak.stack.spur/plugins.ext b/building/linux64ARMv8/squeak.stack.spur/plugins.ext index 390fcc5b46..29506a64ba 100644 --- a/building/linux64ARMv8/squeak.stack.spur/plugins.ext +++ b/building/linux64ARMv8/squeak.stack.spur/plugins.ext @@ -15,3 +15,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/linux64x64/pharo.cog.spur/plugins.ext b/building/linux64x64/pharo.cog.spur/plugins.ext index eef2be45da..9d9e6b7216 100644 --- a/building/linux64x64/pharo.cog.spur/plugins.ext +++ b/building/linux64x64/pharo.cog.spur/plugins.ext @@ -15,4 +15,5 @@ AioPlugin \ BochsIA32Plugin \ BochsX64Plugin \ GdbARMPlugin \ -#SDL2DisplayPlugin +VectorEnginePlugin \ +#SDL2DisplayPlugin \ diff --git a/building/linux64x64/squeak.stack.spur/plugins.ext b/building/linux64x64/squeak.stack.spur/plugins.ext index 390fcc5b46..29506a64ba 100644 --- a/building/linux64x64/squeak.stack.spur/plugins.ext +++ b/building/linux64x64/squeak.stack.spur/plugins.ext @@ -15,3 +15,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/macos32x86/common/Makefile.vm b/building/macos32x86/common/Makefile.vm index c701d6ff3f..0efeb86b7f 100644 --- a/building/macos32x86/common/Makefile.vm +++ b/building/macos32x86/common/Makefile.vm @@ -21,6 +21,8 @@ # The name of the VM to build, e.g. Squeak or "Newspeak Virtual Machine" # and its short name, e.g. Squeak or Newspeak, used to choose app icon files. +export COGDEFS + VM?=Squeak export VM SYSTEM?=$(VM) @@ -152,8 +154,9 @@ include ../common/Makefile.rules svnver: @-echo $(SVNREV) +# N.B. getversion is *not* cross compiled; it must run here and now getversion: $(OSXCOMMONDIR)/version.c deps/version.d $(CROSSDIR)/sqSCCSVersion.h - $(CC) -x c -DVERSION_PROGRAM=1 $(ALLFLAGS) $(INCLUDES) $< -o $@ + $(CC) -x c -DVERSION_PROGRAM=1 $(INCLUDES) $< -o $@ $(POSTCOMPILE) -include deps/version.d diff --git a/building/macos64ARMv8/common/Makefile.vm b/building/macos64ARMv8/common/Makefile.vm index bd84c22495..931c6e985b 100644 --- a/building/macos64ARMv8/common/Makefile.vm +++ b/building/macos64ARMv8/common/Makefile.vm @@ -21,6 +21,8 @@ # The name of the VM to build, e.g. Squeak or "Newspeak Virtual Machine" # and its short name, e.g. Squeak or Newspeak, used to choose app icon files. +export COGDEFS + VM?=Squeak export VM SYSTEM?=$(VM) @@ -155,8 +157,9 @@ include ../common/Makefile.rules svnver: @-echo $(SVNREV) +# N.B. getversion is *not* cross compiled; it must run here and now getversion: $(OSXCOMMONDIR)/version.c deps/version.d $(CROSSDIR)/sqSCCSVersion.h - $(CC) -x c -DVERSION_PROGRAM=1 $(ALLFLAGS) $(INCLUDES) $< -o $@ + $(CC) -x c -DVERSION_PROGRAM=1 $(INCLUDES) $< -o $@ $(POSTCOMPILE) -include deps/version.d diff --git a/building/macos64x64/common/Makefile.vm b/building/macos64x64/common/Makefile.vm index bd84c22495..931c6e985b 100644 --- a/building/macos64x64/common/Makefile.vm +++ b/building/macos64x64/common/Makefile.vm @@ -21,6 +21,8 @@ # The name of the VM to build, e.g. Squeak or "Newspeak Virtual Machine" # and its short name, e.g. Squeak or Newspeak, used to choose app icon files. +export COGDEFS + VM?=Squeak export VM SYSTEM?=$(VM) @@ -155,8 +157,9 @@ include ../common/Makefile.rules svnver: @-echo $(SVNREV) +# N.B. getversion is *not* cross compiled; it must run here and now getversion: $(OSXCOMMONDIR)/version.c deps/version.d $(CROSSDIR)/sqSCCSVersion.h - $(CC) -x c -DVERSION_PROGRAM=1 $(ALLFLAGS) $(INCLUDES) $< -o $@ + $(CC) -x c -DVERSION_PROGRAM=1 $(INCLUDES) $< -o $@ $(POSTCOMPILE) -include deps/version.d diff --git a/building/sunos32x86/squeak.cog.spur/plugins.ext b/building/sunos32x86/squeak.cog.spur/plugins.ext index cfaaf3c519..029ca11aa9 100644 --- a/building/sunos32x86/squeak.cog.spur/plugins.ext +++ b/building/sunos32x86/squeak.cog.spur/plugins.ext @@ -18,3 +18,4 @@ XDisplayControlPlugin \ DESPlugin \ MD5Plugin \ SHA2Plugin \ +VectorEnginePlugin \ diff --git a/building/win32x86/common/Makefile b/building/win32x86/common/Makefile index 9ff56c5202..a03f812d9d 100644 --- a/building/win32x86/common/Makefile +++ b/building/win32x86/common/Makefile @@ -10,6 +10,7 @@ # VMSRCDIR the directory containing the interpreter, optional cogit and interp.h # CONFIGURATION configuration of VM to build from product, assert & debug # THREADING whether to build a multi-threaded FFI VM +# COGDEFS supply any command-line defines to use, and may be null. .PHONY: all all: default @@ -18,7 +19,7 @@ VM?=Squeak VM_NAME?=$(VM) CONFIGURATION=product THREADING=single -export VM VM_NAME CONFIGURATION +export VM VM_NAME CONFIGURATION COGDEFS # Is this a Croquet VM (defaults to OGL instead of D3D)? CROQUET:=-DCROQUET diff --git a/building/win32x86/common/Makefile.msvc b/building/win32x86/common/Makefile.msvc index b73ef5c5ab..6335a5f2bc 100644 --- a/building/win32x86/common/Makefile.msvc +++ b/building/win32x86/common/Makefile.msvc @@ -12,6 +12,7 @@ # VMSRCDIR the directory containing the interpreter, optional cogit and interp.h # CONFIGURATION configuration of VM to build from product, assert & debug # THREADING whether to build a multi-threaded FFI VM +# COGDEFS supply any command-line defines to use, and may be null. .PHONY: all all: default @@ -20,7 +21,7 @@ VM?=Squeak VM_NAME?=$(VM) CONFIGURATION=product THREADING=single -export VM VM_NAME CONFIGURATION +export VM VM_NAME CONFIGURATION COGDEFS # Is this a Croquet VM (defaults to OGL instead of D3D)? CROQUET:=-DCROQUET diff --git a/building/win32x86/common/Makefile.msvc.flags b/building/win32x86/common/Makefile.msvc.flags index 3fe5c4cb62..77777f2882 100644 --- a/building/win32x86/common/Makefile.msvc.flags +++ b/building/win32x86/common/Makefile.msvc.flags @@ -76,7 +76,7 @@ DASH_O:=-Fo OFLAGS= -Ot CFLAGS= -MD -DLP32=1 -DWIN32=1 -Z7 $(OFLAGS) \ -Dalloca=_alloca -Dhuge=my_huge \ - -EHsc $(NOBUILTIN) $(WARNINGS) + -EHsc $(XCFLAGS) $(NOBUILTIN) $(WARNINGS) else ifdef ClangC2 PRODUCTION_OFLAGS:=-Os ASSERT_OFLAGS:=-Od @@ -85,7 +85,7 @@ DASH_O:=-o OFLAGS=-O3 CFLAGS= -m32 -MD -DLP32=1 -DWIN32=1 -gcodeview $(OFLAGS) \ -Dalloca=_alloca -Dhuge=my_huge \ - $(NOBUILTIN) $(WARNINGS) + $(XCFLAGS) $(NOBUILTIN) $(WARNINGS) endif # Do _not_ define NDEBUG. One key point of the msvc build is to debug with diff --git a/building/win32x86/common/SETPATH.BAT b/building/win32x86/common/SETPATH.BAT index 59acf3f9e0..57218a0a8c 100644 --- a/building/win32x86/common/SETPATH.BAT +++ b/building/win32x86/common/SETPATH.BAT @@ -1 +1,3 @@ -set PATH=%PATH%;c:\cygwin64\bin +REM It is best to install LLVM/clang in /c/LLVM because the space in +REM Program Files can confuse configure programs (e.g. x264's) +set PATH=%PATH%;c:\cygwin64\bin;c:\LLVM\bin;c:\Program Files\LLVM\bin diff --git a/building/win32x86/squeak.cog.spur.lowcode/mvm b/building/win32x86/squeak.cog.spur.lowcode/mvm index 68ab738cee..55d88db096 100755 --- a/building/win32x86/squeak.cog.spur.lowcode/mvm +++ b/building/win32x86/squeak.cog.spur.lowcode/mvm @@ -23,13 +23,13 @@ fi if ../../../scripts/checkSCCSversion ; then exit 1; fi if [ -n "$D" ]; then rm -rf builddbg/vm/*.exe - make $@ debug 2>&1 | tee LOGD + make $@ debug 2>&1 | tee LOGD ; test ${PIPESTATUS[0]} -eq 0 fi if [ -n "$A" ]; then rm -rf buildast/vm/*.exe - make $@ assert 2>&1 | tee LOGA + make $@ assert 2>&1 | tee LOGA ; test ${PIPESTATUS[0]} -eq 0 fi if [ -n "$F" ]; then rm -rf build/vm/*.exe - make $@ 2>&1 | tee LOGF + make $@ 2>&1 | tee LOGF ; test ${PIPESTATUS[0]} -eq 0 fi diff --git a/building/win32x86/squeak.cog.spur/mvm b/building/win32x86/squeak.cog.spur/mvm index 68ab738cee..55d88db096 100755 --- a/building/win32x86/squeak.cog.spur/mvm +++ b/building/win32x86/squeak.cog.spur/mvm @@ -23,13 +23,13 @@ fi if ../../../scripts/checkSCCSversion ; then exit 1; fi if [ -n "$D" ]; then rm -rf builddbg/vm/*.exe - make $@ debug 2>&1 | tee LOGD + make $@ debug 2>&1 | tee LOGD ; test ${PIPESTATUS[0]} -eq 0 fi if [ -n "$A" ]; then rm -rf buildast/vm/*.exe - make $@ assert 2>&1 | tee LOGA + make $@ assert 2>&1 | tee LOGA ; test ${PIPESTATUS[0]} -eq 0 fi if [ -n "$F" ]; then rm -rf build/vm/*.exe - make $@ 2>&1 | tee LOGF + make $@ 2>&1 | tee LOGF ; test ${PIPESTATUS[0]} -eq 0 fi diff --git a/building/win32x86/squeak.sista.spur/mvm b/building/win32x86/squeak.sista.spur/mvm index 68ab738cee..55d88db096 100755 --- a/building/win32x86/squeak.sista.spur/mvm +++ b/building/win32x86/squeak.sista.spur/mvm @@ -23,13 +23,13 @@ fi if ../../../scripts/checkSCCSversion ; then exit 1; fi if [ -n "$D" ]; then rm -rf builddbg/vm/*.exe - make $@ debug 2>&1 | tee LOGD + make $@ debug 2>&1 | tee LOGD ; test ${PIPESTATUS[0]} -eq 0 fi if [ -n "$A" ]; then rm -rf buildast/vm/*.exe - make $@ assert 2>&1 | tee LOGA + make $@ assert 2>&1 | tee LOGA ; test ${PIPESTATUS[0]} -eq 0 fi if [ -n "$F" ]; then rm -rf build/vm/*.exe - make $@ 2>&1 | tee LOGF + make $@ 2>&1 | tee LOGF ; test ${PIPESTATUS[0]} -eq 0 fi diff --git a/building/win64x64/common/Makefile b/building/win64x64/common/Makefile index 740b65fb6d..49b555c641 100644 --- a/building/win64x64/common/Makefile +++ b/building/win64x64/common/Makefile @@ -10,6 +10,7 @@ # VMSRCDIR the directory containing the interpreter, optional cogit and interp.h # CONFIGURATION configuration of VM to build from product, assert & debug # THREADING whether to build a multi-threaded FFI VM +# COGDEFS supply any command-line defines to use, and may be null. .PHONY: all all: default @@ -18,7 +19,7 @@ VM?=Squeak VM_NAME?=$(VM) CONFIGURATION=product THREADING=single -export VM VM_NAME CONFIGURATION +export VM VM_NAME CONFIGURATION COGDEFS # Is this a Croquet VM (defaults to OGL instead of D3D)? CROQUET:=-DCROQUET diff --git a/building/win64x64/common/Makefile.msvc b/building/win64x64/common/Makefile.msvc index 89006dedb1..980c266e0b 100644 --- a/building/win64x64/common/Makefile.msvc +++ b/building/win64x64/common/Makefile.msvc @@ -12,6 +12,7 @@ # VMSRCDIR the directory containing the interpreter, optional cogit and interp.h # CONFIGURATION configuration of VM to build from product, assert & debug # THREADING whether to build a multi-threaded FFI VM +# COGDEFS supply any command-line defines to use, and may be null. .PHONY: all all: default @@ -20,7 +21,7 @@ VM?=Squeak VM_NAME?=$(VM) CONFIGURATION=product THREADING=single -export VM VM_NAME CONFIGURATION +export VM VM_NAME CONFIGURATION COGDEFS # Is this a Croquet VM (defaults to OGL instead of D3D)? CROQUET:=-DCROQUET diff --git a/building/win64x64/common/Makefile.msvc.flags b/building/win64x64/common/Makefile.msvc.flags index 25551835b3..4290340a45 100644 --- a/building/win64x64/common/Makefile.msvc.flags +++ b/building/win64x64/common/Makefile.msvc.flags @@ -31,16 +31,19 @@ override VCINSTALLDIRSH:=$(shell echo "$(VCINSTALLDIR)" | sed 's/[()]/\\&/g') # C compiler settings assuming Visual C++ 2017 Community Edition # # Try and choose a compiler. In order try: -# If LLVM is installed in C:\Program FIles\LLVM use clang-cl.exe from there. -# Otherwise use MSVC +# If LLVM is installed in C:\Program Files\LLVM or C:\LLVM then +# use clang-cl.exe from there. Otherwise use MSVC # $(info VCINSTALLDIR=$(VCINSTALLDIR)) $(info VCINSTALLDIRSH=$(VCINSTALLDIRSH)) -#$(info wildcard VCINSTALLDIR $(wildcard $(VCINSTALLDIR)/.*)) -$(info wildcard C:/Program\ Files/LLVM/bin/.* $(wildcard C:/Program\ Files/LLVM/bin/.*)) -ifneq ($(wildcard C:/Program\ Files/LLVM/bin/.*),) +ifneq ($(wildcard C:/LLVM/bin/.*),) +$(info LLVM/Clang detected) +CC:="C:/LLVM/bin/clang-cl.exe" +Clang:=Clang +undefine MSVC +else ifneq ($(wildcard C:/Program\ Files/LLVM/bin/.*),) $(info LLVM/Clang detected) CC:="C:/Program Files/LLVM/bin/clang-cl.exe" Clang:=Clang @@ -88,7 +91,7 @@ DASH_O:=-Fo OFLAGS= -Ot $(BUFFER_SECURITY) CFLAGS= -MD -DLLP64=1 -DWIN64=1 -Z7 $(OFLAGS) \ -Dalloca=_alloca -Dhuge=my_huge \ - -EHsc $(NOBUILTIN) $(WARNINGS) + -EHsc $(XCFLAGS) $(NOBUILTIN) $(WARNINGS) else ifdef Clang PRODUCTION_OFLAGS:=-Ox -Ob1 -Oi -Oy $(BUFFER_SECURITY) ASSERT_OFLAGS:=-Os -Oi- -Oy- $(BUFFER_SECURITY) @@ -97,7 +100,7 @@ DASH_O:=-o OFLAGS= -Ot $(BUFFER_SECURITY) CFLAGS= -MD -DLLP64=1 -DWIN64=1 -Z7 $(OFLAGS) \ -Dalloca=_alloca -Dhuge=my_huge \ - -EHsc $(NOBUILTIN) $(WARNINGS) + -EHsc $(XCFLAGS) $(NOBUILTIN) $(WARNINGS) endif # Make all setjmp/longjmp varieties to our _setjmp/_longjmp in _setjmp-x86.asm JMPDEFS:=-Dsetjmp=_setjmp -Dlongjmp=_longjmp -D_siglongjmp=_longjmp diff --git a/building/win64x64/common/Makefile.msvc.plugin b/building/win64x64/common/Makefile.msvc.plugin index 2835138ec7..3c1881cf38 100644 --- a/building/win64x64/common/Makefile.msvc.plugin +++ b/building/win64x64/common/Makefile.msvc.plugin @@ -11,6 +11,11 @@ # # EXCLUDESRC defines patterns of source files to not compile, e.g. %/dump.c # +# The following variables can be defined to extend the compilation flags. +# +# XCFLAGS adds additional compilation flags after all other C preprocessor define flags +# XINC adds additional include flags after all other INCLUDE flags +# # The following are the three key locations (set via invocation): # BUILDDIR: Where is the root of the build tree? # PLATDIR: Where is the root of the platforms tree? diff --git a/building/win64x64/common/SETPATH.BAT b/building/win64x64/common/SETPATH.BAT index 23db421fc8..57218a0a8c 100644 --- a/building/win64x64/common/SETPATH.BAT +++ b/building/win64x64/common/SETPATH.BAT @@ -1 +1,3 @@ -set PATH=%PATH%;c:\cygwin64\bin;c:\Program Files\LLVM\bin +REM It is best to install LLVM/clang in /c/LLVM because the space in +REM Program Files can confuse configure programs (e.g. x264's) +set PATH=%PATH%;c:\cygwin64\bin;c:\LLVM\bin;c:\Program Files\LLVM\bin diff --git a/deploy/bintray-cleanup.sh b/deploy/bintray-cleanup.sh deleted file mode 100755 index 6bb724b361..0000000000 --- a/deploy/bintray-cleanup.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -set -e - -# Remove old versions from bintray, leaving only the last version per month -if [[ "${TRAVIS_OS_NAME}" == "linux" ]] && [[ "${ARCH}" == "linux64x64" ]] && [[ "${FLAVOR}" == "squeak.cog.spur" ]]; then - ruby -rdate -rnet/http -rjson -e "lastver=DateTime.now; - user='osvm'; - pass='${BINTRAYAPIKEY}'; - url='https://api.bintray.com/packages/opensmalltalk/vm/cog'; - uri=URI(url); - json=nil; - http=Net::HTTP.new(uri.host,uri.port); - http.use_ssl=true; - http.start { - req=Net::HTTP::Get.new(uri.request_uri); - req.basic_auth(user,pass); - resp=http.request(req); - json=JSON.parse(resp.body) - }; - (json['versions'][10..-1] || []).each { |v| - ver=DateTime.parse(v); - if ver.month != lastver.month then - lastver=ver; next - else - lastver=ver - end; - uri=URI(url+'/versions/'+v); - http=Net::HTTP.new(uri.host,uri.port); - http.use_ssl=true; - http.start { - req=Net::HTTP::Delete.new(uri.request_uri); - req.basic_auth(user,pass); - resp=http.request(req); - puts 'Deleted ' + v + ' ' + resp.body - } - }" -fi diff --git a/deploy/bintray.json b/deploy/bintray.json deleted file mode 100644 index 52ccf92350..0000000000 --- a/deploy/bintray.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "package": { - "name": "cog", - "repo": "vm", - "subject": "opensmalltalk" - }, - "version": { - "name": "$Rev$", - "desc": "Automatic build" - }, - "files": [ - {"includePattern": "../products/((newspeak|pharo|squeak).*\\.(?:gz|zip|dmg))", "uploadPattern": "$1"} - ], - "publish": true -} diff --git a/deploy/bintray.sh b/deploy/bintray.sh deleted file mode 100755 index 976cc86fcd..0000000000 --- a/deploy/bintray.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -e - -if [[ -n "${TRAVIS_TAG:-${APPVEYOR_REPO_TAG_NAME}}" ]]; then - echo "Skipping a deployment to Bintray because build was pushed by a tag." - exit -fi - -echo "$(cat bintray.json | ../.git_filters/RevDateURL.smudge)" > bintray.json -sed -i.bak 's/$Rev: \([0-9][0-9]*\) \$/\1/' bintray.json -sed -i.bak 's/$Date: \(.*\) \$/\1/' bintray.json -rm -f bintray.json.bak - -if [[ "${APPVEYOR}" ]]; then - appveyor DownloadFile https://curl.haxx.se/ca/cacert.pem - export SSL_CERT_FILE=cacert.pem - export PATH="C:\\Ruby23\\bin:$PATH" - export CMDSHELL="cmd /C " -fi - -$CMDSHELL gem install dpl -$CMDSHELL dpl --provider=bintray --user=osvm --key=$BINTRAYAPIKEY --file=bintray.json --skip_cleanup=true diff --git a/deploy/filter-exec.sh b/deploy/filter-exec.sh deleted file mode 100755 index bec92a41d5..0000000000 --- a/deploy/filter-exec.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Deployment filter (compatible with Travis and AppVeyor) -# -# execute script if: -# - $BINTRAYAPIKEY is set -# - REPOSITORY=OpenSmalltalk/opensmalltalk-vm -# - Build is not triggered by a pull request -# - BRANCH=Cog or TAG_NAME is not empty - -readonly REPO_NAME="${TRAVIS_REPO_SLUG:-${APPVEYOR_REPO_NAME}}" -readonly PR_SHA="${TRAVIS_PULL_REQUEST_SHA:-${APPVEYOR_PULL_REQUEST_HEAD_COMMIT}}" -readonly BRANCH_NAME="${TRAVIS_BRANCH:-${APPVEYOR_REPO_BRANCH}}" -readonly TAG_NAME="${TRAVIS_TAG:-${APPVEYOR_REPO_TAG_NAME}}" - -if [[ -z "${BINTRAYAPIKEY}" ]]; then - echo 'Skipping a deployment because $BINTRAYAPIKEY was not provided.' - exit -fi - -if [[ "${REPO_NAME}" != "OpenSmalltalk/opensmalltalk-vm" ]]; then - echo "Trying to deploy in repository: ${REPO_NAME}. Skipping." - exit -fi - -if [[ -n "${PR_SHA}" ]]; then - echo "Skipping a deployment with the script provider because PRs are not permitted." - exit -fi - -if [[ "${BRANCH_NAME}" != "Cog" ]] && [[ -z "${TAG_NAME}" ]]; then - echo "Skipping a deployment with the script provider because this branch is not permitted." - exit -fi - -`dirname $0`/$1 diff --git a/deploy/pack-vm.sh b/deploy/pack-vm.sh index b9c7f233d3..de5a26388b 100755 --- a/deploy/pack-vm.sh +++ b/deploy/pack-vm.sh @@ -1,108 +1,62 @@ #!/bin/bash -set -e - -readonly BUILD_DIR="${TRAVIS_BUILD_DIR:-$(cygpath ${APPVEYOR_BUILD_FOLDER})}" -readonly PRODUCTS_DIR="${BUILD_DIR}/products" -if [[ ! -d "${PRODUCTS_DIR}" ]]; then - echo "No products directory found." - exit 10 -fi +# Pack the VM into platform-specific container. All packing functions are +# evaluated in the ${PRODUCTS_PATH}. All binaries are expected to be there, +# already signed if required. +# +# Uses: +# - APP_NAME +# - PRODUCTS_PATH +# - ASSET_NAME +# +# Provides: +# - ASSET_EXTENSION (e.g., "tar.gz", "dmg", "zip") -BUILD_SYSTEM_SUFFIX="" -if [ "${BUILD_WITH_CMAKE}" = "yes" ]; then - BUILD_SYSTEM_SUFFIX="-cmake-minhdls" -fi -readonly BUILD_SYSTEM_SUFFIX -readonly REV=$(grep -m1 "SvnRawRevisionString" "${BUILD_DIR}/platforms/Cross/vm/sqSCCSVersion.h" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/') -readonly IDENTIFIER="${FLAVOR}${BUILD_SYSTEM_SUFFIX}_${ARCH}_${REV}" -readonly IDENTIFIER_ITIMER="${FLAVOR}${BUILD_SYSTEM_SUFFIX}_${ARCH}_itimer_${REV}" -readonly KEY_CHAIN=macos-build.keychain +set -e -macos_codesign() { - local app_dir=$1 - local path_cer=$2 - local path_p12=$3 - local cert_pass=$4 - local sign_identity=$5 +[[ ! -d "${PRODUCTS_PATH}/${APP_NAME}" ]] && exit 31 +[[ -z "${ASSET_NAME}" ]] && exit 32 - echo "Signing app bundle..." - # Set up keychain - security create-keychain -p travis "${KEY_CHAIN}" - security default-keychain -s "${KEY_CHAIN}" - security unlock-keychain -p travis "${KEY_CHAIN}" - security set-keychain-settings -t 3600 -u "${KEY_CHAIN}" - security import "${path_cer}" -k ~/Library/Keychains/"${KEY_CHAIN}" -T /usr/bin/codesign - security import "${path_p12}" -k ~/Library/Keychains/"${KEY_CHAIN}" -P "${cert_pass}" -T /usr/bin/codesign - security set-key-partition-list -S apple-tool:,apple: -s -k travis "${KEY_CHAIN}" - # Invoke codesign - if [[ -d "${app_dir}/Contents/MacOS/Plugins" ]]; then # Pharo.app does not (yet) have its plugins in Resources dir - codesign -s "${sign_identity}" --force --deep "${app_dir}/Contents/MacOS/Plugins/"* - fi - codesign -s "${sign_identity}" --force --deep "${app_dir}" - # Remove sensitive files again - rm -rf "${path_cer}" "${path_p12}" - security delete-keychain "${KEY_CHAIN}" +# Pack the Linux build as .tar.gz archive +pack_Linux() { + readonly ASSET_EXTENSION="tar.gz" + tar czf "${PRODUCTS_PATH}/${ASSET_NAME}.${ASSET_EXTENSION}" "${APP_NAME}" } -pushd "${PRODUCTS_DIR}" -if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - counter=0 - for dir in */; do - if [[ "${ARCH}" == *"ARM"* || "${dir}" == *"ht/" ]]; then - name="${IDENTIFIER}" - else - name="${IDENTIFIER_ITIMER}" - fi - tar czf "${name}.tar.gz" "${dir}" - counter=$((counter+1)) - if [[ "${counter}" -gt 2 ]]; then - echo "No more than two directories expected (threaded and/or itimer)" - exit 20 - fi - done -elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - APP_DIR=$(find "${PRODUCTS_DIR}" -type d -path "*.app" | head -n 1) - if [[ -z "${APP_DIR}" ]]; then - echo "Unable to locate app bundle." - exit 30 - fi - readonly DEPLOY_DIR="${TRAVIS_BUILD_DIR}/deploy" - if [[ "${FLAVOR}" == "squeak"* ]]; then - path_cer="${DEPLOY_DIR}/squeak/sign.cer" - path_p12="${DEPLOY_DIR}/squeak/sign.p12" - openssl aes-256-cbc -k "${SQUEAK_SIGN_PASSWORD}" -in "${path_cer}.enc" -out "${path_cer}" -d - openssl aes-256-cbc -k "${SQUEAK_SIGN_PASSWORD}" -in "${path_p12}.enc" -out "${path_p12}" -d - macos_codesign "${APP_DIR}" "${path_cer}" "${path_p12}" "${SQUEAK_CERT_PASSWORD}" "${SQUEAK_SIGN_IDENTITY}" - elif [[ "${FLAVOR}" == "pharo"* ]]; then - path_cer="${DEPLOY_DIR}/pharo/pharo.cer" - path_p12="${DEPLOY_DIR}/pharo/pharo.p12" - openssl aes-256-cbc -k "${PHARO_SIGN_PASSWORD}" -in "${path_cer}.enc" -out "${path_cer}" -d - openssl aes-256-cbc -k "${PHARO_SIGN_PASSWORD}" -in "${path_p12}.enc" -out "${path_p12}" -d - macos_codesign "${APP_DIR}" "${path_cer}" "${path_p12}" "${PHARO_CERT_PASSWORD}" "${PHARO_SIGN_IDENTITY}" - elif [[ "${FLAVOR}" == "newspeak"* ]]; then - NEW_APP_DIR="${PRODUCTS_DIR}/Newspeak.app" - mv "${APP_DIR}" "${NEW_APP_DIR}" - APP_DIR="${NEW_APP_DIR}" - path_cer="${DEPLOY_DIR}/newspeak/sign.cer" - path_p12="${DEPLOY_DIR}/newspeak/sign.p12" - openssl aes-256-cbc -k "${NEWSPEAK_SIGN_PASSWORD}" -in "${path_cer}.enc" -out "${path_cer}" -d - openssl aes-256-cbc -k "${NEWSPEAK_SIGN_PASSWORD}" -in "${path_p12}.enc" -out "${path_p12}" -d - macos_codesign "${APP_DIR}" "${path_cer}" "${path_p12}" "${NEWSPEAK_CERT_PASSWORD}" "${NEWSPEAK_SIGN_IDENTITY}" - fi - TMP_DMG="temp.dmg" - hdiutil create -size 64m -volname "${IDENTIFIER}" -srcfolder "${APP_DIR}" \ +# Pack the macOS .app as .dmg container +pack_macOS() { + readonly ASSET_EXTENSION="dmg" + readonly APP_PATH="${PRODUCTS_PATH}/${APP_NAME}" + TMP_DMG="temp.${ASSET_EXTENSION}" + hdiutil create -size 64m -volname "${ASSET_NAME}" -srcfolder "${APP_PATH}" \ -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -nospotlight "${TMP_DMG}" DEVICE="$(hdiutil attach -readwrite -noautoopen -nobrowse "${TMP_DMG}" | awk 'NR==1{print$1}')" VOLUME="$(mount | grep "$DEVICE" | sed 's/^[^ ]* on //;s/ ([^)]*)$//')" hdiutil detach "$DEVICE" - hdiutil convert "${TMP_DMG}" -format UDBZ -imagekey bzip2-level=9 -o "${IDENTIFIER}.dmg" + hdiutil convert "${TMP_DMG}" -format UDBZ -imagekey bzip2-level=9 -o "${ASSET_NAME}.${ASSET_EXTENSION}" rm -f "${TMP_DMG}" -elif [[ "${APPVEYOR}" ]]; then - cd "./vm" - rm -f *.def *.exp *.lib *.map *.o *.res *Unstripped* # remove temporary build files - zip -r "${PRODUCTS_DIR}/${IDENTIFIER}.zip" "./" -else - echo "Unsupported platform '$(uname -s)'." 1>&2 - exit 90 +} + +# Pack the Windows build as .zip archive +pack_Windows() { + readonly ASSET_EXTENSION="zip" + cd "${APP_NAME}" + rm -f *.def *.exp *.lib *.map *.o *.res *Unstripped* *.ignore # remove temporary build files + 7z a -tzip -r "${PRODUCTS_PATH}/${ASSET_NAME}.${ASSET_EXTENSION}" "./" +} + +if [[ ! -d "${PRODUCTS_PATH}" ]]; then + echo "No products directory found." + exit 10 fi + +if [[ ! $(type -t pack_$RUNNER_OS) ]]; then + echo "Unsupported runner OS ${RUNNER_OS}." + exit 99 +fi + +pushd "${PRODUCTS_PATH}" +pack_$RUNNER_OS popd + +[[ -z "${ASSET_EXTENSION}" ]] && exit 95 +echo "ASSET_EXTENSION=${ASSET_EXTENSION}" >> $GITHUB_ENV diff --git a/deploy/sign-vm.sh b/deploy/sign-vm.sh new file mode 100755 index 0000000000..4d97705b5b --- /dev/null +++ b/deploy/sign-vm.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# Uses: +# - PRODUCTS_PATH +# - APP_NAME +# - *_SIGN_PASSWORD (secret) +# - *_CERT_PASSWORD (secret) +# - *_SIGN_IDENTITY (secret) +set -e + +[[ ! -d "${PRODUCTS_PATH}/${APP_NAME}" ]] && exit 30 + +readonly APP_PATH="${PRODUCTS_PATH}/${APP_NAME}" +readonly KEY_CHAIN=macos-build.keychain + +sign_Linux() { + echo "Not implemented." + exit 999 +} + +sign_macOS() { + local -r cert_path="deploy" + + if [[ "${FLAVOR}" == "squeak"* ]]; then + cert_filepath_cer="${cert_path}/squeak/sign.cer" + cert_filepath_p12="${cert_path}/squeak/sign.p12" + sign_password="${SQUEAK_SIGN_PASSWORD}" + cert_password="${SQUEAK_CERT_PASSWORD}" + sign_identity="${SQUEAK_SIGN_IDENTITY}" + elif [[ "${FLAVOR}" == "pharo"* ]]; then + cert_filepath_cer="${cert_path}/pharo/pharo.cer" + cert_filepath_p12="${cert_path}/pharo/pharo.p12" + sign_password="${PHARO_SIGN_PASSWORD}" + cert_password="${PHARO_CERT_PASSWORD}" + sign_identity="${PHARO_SIGN_IDENTITY}" + elif [[ "${FLAVOR}" == "newspeak"* ]]; then + cert_filepath_cer="${cert_path}/newspeak/sign.cer" + cert_filepath_p12="${cert_path}/newspeak/sign.p12" + sign_password="${NEWSPEAK_SIGN_PASSWORD}" + cert_password="${NEWSPEAK_CERT_PASSWORD}" + sign_identity="${NEWSPEAK_SIGN_IDENTITY}" + else + echo "Unsupported VM flavor ${FLAVOR}." + exit 35 + fi + + if [[ -z "${sign_password}" ]]; then + echo "[Error] No password given to decrypt certificates for ${FLAVOR}. Cannot sign." + exit 234 + fi + + echo "::group::Decrypt certificate files..." + openssl aes-256-cbc \ + -k "${sign_password}" \ + -in "${cert_filepath_cer}.enc" \ + -out "${cert_filepath_cer}" \ + -d + openssl aes-256-cbc \ + -k "${sign_password}" \ + -in "${cert_filepath_p12}.enc" \ + -out "${cert_filepath_p12}" \ + -d + echo "::endgroup::" + + echo "::group::Signing app bundle..." + # Set up keychain + security create-keychain -p travis "${KEY_CHAIN}" + security default-keychain -s "${KEY_CHAIN}" + security unlock-keychain -p travis "${KEY_CHAIN}" + security set-keychain-settings -t 3600 -u "${KEY_CHAIN}" + security import "${cert_filepath_cer}" -k ~/Library/Keychains/"${KEY_CHAIN}" -T /usr/bin/codesign + security import "${cert_filepath_p12}" -k ~/Library/Keychains/"${KEY_CHAIN}" -P "${cert_password}" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple: -s -k travis "${KEY_CHAIN}" + # Invoke codesign + if [[ -d "${APP_PATH}/Contents/MacOS/Plugins" ]]; then + # Pharo.app does not (yet) have its plugins in Resources dir + codesign -s "${sign_identity}" --force --deep "${APP_PATH}/Contents/MacOS/Plugins/"* + fi + codesign -s "${sign_identity}" --force --deep "${APP_PATH}" + # Remove sensitive files again + rm -rf "${cert_filepath_cer}" "${cert_filepath_p12}" + security delete-keychain "${KEY_CHAIN}" + echo "::endgroup::" +} + +sign_Windows() { + echo "Not implemented." + exit 999 +} + +if [[ ! -d "${PRODUCTS_PATH}" ]]; then + echo "No products directory found." + exit 10 +fi + +if [[ ! $(type -t sign_$RUNNER_OS) ]]; then + echo "Unsupported runner OS ${RUNNER_OS}." + exit 99 +fi + +sign_$RUNNER_OS diff --git a/deploy/squeak/sign.cer.enc b/deploy/squeak/sign.cer.enc index 7a353697c3..8614aad67b 100644 Binary files a/deploy/squeak/sign.cer.enc and b/deploy/squeak/sign.cer.enc differ diff --git a/deploy/squeak/sign.p12.enc b/deploy/squeak/sign.p12.enc index caa3f51415..8b798e459d 100644 Binary files a/deploy/squeak/sign.p12.enc and b/deploy/squeak/sign.p12.enc differ diff --git a/image/BuildPharo6VMMakerImage.st b/image/BuildPharo6VMMakerImage.st index e91e07d212..9f2b647fff 100644 --- a/image/BuildPharo6VMMakerImage.st +++ b/image/BuildPharo6VMMakerImage.st @@ -1 +1 @@ -| manifest load | manifest := #( "('http://source.squeak.org/FFI' 1 ('FFI-Pools' 'FFI-Kernel')) already in Pharo" ('http://source.squeak.org/VMMaker' 6 ('Balloon-Engine-Pools' 'CogPools-ISAs' 'BytecodeSets.spur' 'VMMaker.oscog' 'VMMakerUI' 'Cog' 'CogTools' 'ImageFormat' 'FileAttributesPlugin.oscog')) ('http://source.squeak.org/VMMaker' 0 ('VMMakerCompatibilityForPharo6')) ('http://ss3.gemstone.com/ss/MethodMassage' 3 ('MethodMassage' 'MethodMassageCompatibility')) ('http://www.squeaksource.com/AioPlugin' 7 ('VMConstruction-Plugins-AioPlugin.oscog')) "('http://www.squeaksource.com/Alien' 0 ('Alien-Core' 'Alien-Tests-Core' 'Alien-Win32')) already in Pharo" "('http://www.squeaksource.com/FreeTypePlus' 5 ('FreeType')) can't load this. it is toxic to Squeak 4.5" "('http://www.squeaksource.com/FreetypePlugin' 8 ('Freetype-Plugin')) hence we can do without this" "('http://www.squeaksource.com/OSProcess' 4 ('OSProcess')) appears to conflict with OSSVMProcess" ('http://www.squeaksource.com/OSProcessPlugin' 9 ('VMConstruction-Plugins-OSProcessPlugin.oscog')) "('http://www.squeaksource.com/rb' 5 ('AST-Core' 'AST-Semantic' 'AST-Tests-Core' 'AST-Tests-Semantic' 'Refactoring-Changes' 'Refactoring-Core' 'Refactoring-Environment' 'Refactoring-Tests-Changes' 'Refactoring-Tests-Core' 'Refactoring-Tests-Environment' 'Refactoring-Squeak-Platform')) already in Pharo" "This for the Klatt speech synthesiser, but seems to be AWOL" ('http://www.squeaksource.com/Speech' 2 ('SharedPool-Speech' )) ('http://www.squeaksource.com/XDCP' 9 ('VMConstruction-Plugins-XDisplayControlPlugin.oscog' )) ('http://www.squeaksource.com/Balloon3D' 9 ('Balloon3D-Constants' 'Balloon3D-Plugins' )) ('http://www.squeaksource.com/Cryptography' 9 ('CryptographyPlugins' )) ('http://ss3.gemstone.com/ss/AndreasSystemProfiler' 9 ('AndreasProfiler')) ('http://www.squeaksource.com/Printf' 5 ('Printf')) ). load := (manifest collect: [:tuple| [:path :order :packages| | repository | repository := MCHttpRepository location: path user: 'squeak' password: 'squeak'. MCRepositoryGroup default addRepository: repository. {repository. order. packages}] valueWithArguments: tuple]) sort: [:a :b| a second <= b second]. #( "'FT2Constants.st'" ) do: [:fileName| (FileLocator cwd / fileName) fileIn]. load do: [:tuple| [:repository :order :packages| packages do: [:package | | packageVersions latestVersion | "We need to filter-out branches of unbranched packages, but can't assume the package list is (reverse) ordered." packageVersions := ((repository retrieveVersionsWithPackageNames: Set new) "e.g. Set with: #('Alien-Core' 'IgorStasenko' 71 'Alien-Core-IgorStasenko.71.mcz')" select: [ :v | v first = package and: [(v last at: package size + 1) = $-]]) asSortedCollection: [ :a :b | a third < b third ]. latestVersion := packageVersions last fourth. [| version | version := (MCCacheRepository default loadVersionFromFileNamed: latestVersion) ifNil: [repository loadVersionFromFileNamed: latestVersion]. version load. version workingCopy repositoryGroup addRepository: repository] on: Warning do: [:ex| ((ex messageText beginsWith: 'This package depends on the following classes') or: [ex messageText beginsWith: 'About to serialize an empty diffy version.']) ifFalse: [ex pass]. ex resume]]] valueWithArguments: tuple]. UIManager default edit: 'PharoWorkspace.text' asFileReference contents label: 'Overview'. #('VM Simulation' 'Source Generation' 'Slang Test' 'In-image Compilation') reverseDo: [ :nickname | GTPlayground openContents: (nickname , ' Workspace.text') asFileReference contents label: nickname, ' Playground']. #('Cog' 'CogTools' 'VMMaker') do: [ :pkg | (RPackageSet named: pkg) definedClasses do: [ :c | c organization sortCategories. c class organization sortCategories]]. "Alas not. (Smalltalk classNamed: #StackInterpreter) withAllSubclasses do: [:sic| sic reorganizeAsISeeFit]." Smalltalk snapshot: true andQuit: true \ No newline at end of file +| manifest load | manifest := #( "('http://source.squeak.org/FFI' 1 ('FFI-Pools' 'FFI-Kernel')) already in Pharo" ('http://source.squeak.org/VMMaker' 6 ('Balloon-Engine-Pools' 'CogPools-ISAs' 'BytecodeSets.spur' 'VMMaker.oscog' 'VMMakerUI' 'Cog' 'CogTools' 'ImageFormat' 'FileAttributesPlugin.oscog')) ('http://source.squeak.org/VMMaker' 0 ('VMMakerCompatibilityForPharo6')) ('http://ss3.gemstone.com/ss/MethodMassage' 3 ('MethodMassage' 'MethodMassageCompatibility')) ('http://www.squeaksource.com/AioPlugin' 7 ('VMConstruction-Plugins-AioPlugin.oscog')) "('http://www.squeaksource.com/Alien' 0 ('Alien-Core' 'Alien-Tests-Core' 'Alien-Win32')) already in Pharo" "('http://www.squeaksource.com/FreeTypePlus' 5 ('FreeType')) can't load this. it is toxic to Squeak 4.5" "('http://www.squeaksource.com/FreetypePlugin' 8 ('Freetype-Plugin')) hence we can do without this" "('http://www.squeaksource.com/OSProcess' 4 ('OSProcess')) appears to conflict with OSSVMProcess" ('http://www.squeaksource.com/OSProcessPlugin' 9 ('VMConstruction-Plugins-OSProcessPlugin.oscog')) "('http://www.squeaksource.com/rb' 5 ('AST-Core' 'AST-Semantic' 'AST-Tests-Core' 'AST-Tests-Semantic' 'Refactoring-Changes' 'Refactoring-Core' 'Refactoring-Environment' 'Refactoring-Tests-Changes' 'Refactoring-Tests-Core' 'Refactoring-Tests-Environment' 'Refactoring-Squeak-Platform')) already in Pharo" "This for the Klatt speech synthesiser, but seems to be AWOL" ('http://www.squeaksource.com/Speech' 2 ('SharedPool-Speech' )) ('http://www.squeaksource.com/XDCP' 9 ('VMConstruction-Plugins-XDisplayControlPlugin.oscog' )) ('http://www.squeaksource.com/Balloon3D' 9 ('Balloon3D-Constants' 'Balloon3D-Plugins' )) ('http://www.squeaksource.com/Cryptography' 9 ('CryptographyPlugins' )) ('http://ss3.gemstone.com/ss/AndreasSystemProfiler' 9 ('AndreasProfiler')) ('http://www.squeaksource.com/Printf' 5 ('Printf')) ('http://www.squeaksource.com/VectorEnginePlugin' 9 ('VectorEnginePlugin')) ). load := (manifest collect: [:tuple| [:path :order :packages| | repository | repository := MCHttpRepository location: path user: 'squeak' password: 'squeak'. MCRepositoryGroup default addRepository: repository. {repository. order. packages}] valueWithArguments: tuple]) sort: [:a :b| a second <= b second]. #( "'FT2Constants.st'" ) do: [:fileName| (FileLocator cwd / fileName) fileIn]. load do: [:tuple| [:repository :order :packages| packages do: [:package | | packageVersions latestVersion | "We need to filter-out branches of unbranched packages, but can't assume the package list is (reverse) ordered." packageVersions := ((repository retrieveVersionsWithPackageNames: Set new) "e.g. Set with: #('Alien-Core' 'IgorStasenko' 71 'Alien-Core-IgorStasenko.71.mcz')" select: [ :v | v first = package and: [(v last at: package size + 1) = $-]]) asSortedCollection: [ :a :b | a third < b third ]. latestVersion := packageVersions last fourth. [| version | version := (MCCacheRepository default loadVersionFromFileNamed: latestVersion) ifNil: [repository loadVersionFromFileNamed: latestVersion]. version load. version workingCopy repositoryGroup addRepository: repository] on: Warning do: [:ex| ((ex messageText beginsWith: 'This package depends on the following classes') or: [ex messageText beginsWith: 'About to serialize an empty diffy version.']) ifFalse: [ex pass]. ex resume]]] valueWithArguments: tuple]. UIManager default edit: 'PharoWorkspace.text' asFileReference contents label: 'Overview'. #('VM Simulation' 'Source Generation' 'Slang Test' 'In-image Compilation') reverseDo: [ :nickname | GTPlayground openContents: (nickname , ' Workspace.text') asFileReference contents label: nickname, ' Playground']. #('Cog' 'CogTools' 'VMMaker') do: [ :pkg | (RPackageSet named: pkg) definedClasses do: [ :c | c organization sortCategories. c class organization sortCategories]]. "Alas not. (Smalltalk classNamed: #StackInterpreter) withAllSubclasses do: [:sic| sic reorganizeAsISeeFit]." Smalltalk snapshot: true andQuit: true \ No newline at end of file diff --git a/image/BuildSqueakSpurTrunkVMMakerImage.st b/image/BuildSqueakSpurTrunkVMMakerImage.st index 9e311fc38d..dea518761e 100644 --- a/image/BuildSqueakSpurTrunkVMMakerImage.st +++ b/image/BuildSqueakSpurTrunkVMMakerImage.st @@ -1 +1 @@ -| manifest load | "Disable underscore as assignment, allowing underscores in method names." Scanner allowUnderscoreAsAssignment: false. manifest := #( ('http://source.squeak.org/FFI' 1 ('FFI-Pools' 'FFI-Kernel')) ('http://source.squeak.org/VMMaker' 6 ('CogPools-ISAs' 'BytecodeSets.spur' 'VMMaker.oscog' 'VMMakerUI' 'Cog' 'CogTools' 'ImageFormat' 'FileAttributesPlugin.oscog')) ('http://ss3.gemstone.com/ss/MethodMassage' 3 ('MethodMassage' 'MethodMassageCompatibility')) ('http://www.squeaksource.com/ClosedVMMaker' 7 ('ClosedVMMaker')) ('http://www.squeaksource.com/AioPlugin' 7 ('VMConstruction-Plugins-AioPlugin.oscog')) ('http://www.squeaksource.com/Alien' 0 ('Alien-Core' 'Alien-Tests-Core' 'Alien-Win32')) "('http://www.squeaksource.com/FreeTypePlus' 5 ('FreeType')) can't load this. it is toxic to Squeak 4.5" "('http://www.squeaksource.com/FreetypePlugin' 8 ('Freetype-Plugin')) hence we can do without this" ('http://www.squeaksource.com/OSProcess' 4 ('OSProcess')) ('http://www.squeaksource.com/OSProcessPlugin' 9 ('VMConstruction-Plugins-OSProcessPlugin.oscog')) ('http://www.squeaksource.com/rb' 5 ('AST-Core' 'AST-Semantic' 'AST-Tests-Core' 'AST-Tests-Semantic' 'Refactoring-Changes' 'Refactoring-Core' 'Refactoring-Environment' 'Refactoring-Tests-Changes' 'Refactoring-Tests-Core' 'Refactoring-Tests-Environment' 'Refactoring-Squeak-Platform')) "This for the Klatt speech synthesiser, but seems to be AWOL" ('http://www.squeaksource.com/Speech' 2 ('SharedPool-Speech' )) ('http://www.squeaksource.com/XDCP' 9 ('VMConstruction-Plugins-XDisplayControlPlugin.oscog' )) ('http://www.squeaksource.com/Balloon3D' 9 ('Balloon3D-Constants' 'Balloon3D-Plugins' )) ('http://www.squeaksource.com/Cryptography' 9 ('CryptographyPlugins' )) ('http://ss3.gemstone.com/ss/AndreasSystemProfiler' 9 ('AndreasProfiler')) ('http://www.squeaksource.com/Printf' 5 ('Printf')) ). load := (manifest collect: [:tuple| [:path :order :packages| | repository | repository := MCHttpRepository location: path user: 'squeak' password: 'squeak'. MCRepositoryGroup default addRepository: repository. {repository. order. packages}] valueWithArguments: tuple]) sort: [:a :b| a second <= b second]. #( "'FT2Constants.st'" ) do: [:fileName| (FileDirectory default fileNamed: fileName) fileIn]. load do: [:tuple| [:repository :order :packages| packages do: [:package | | packageVersions latestVersion | "We need to filter-out branches of unbranched packages, but can't assume the package list is (reverse) ordered." packageVersions := ((repository versionNamesForPackageNamed: package) select: [:versionName| (versionName at: package size + 1) = $-]) asSortedCollection: [ :a :b | a versionNumber < b versionNumber ]. latestVersion := packageVersions last. [| version | version := (MCCacheRepository default versionNamed: latestVersion) ifNil: [repository versionNamed: latestVersion]. version load. version workingCopy repositoryGroup addRepository: repository] on: Warning do: [:ex| ((ex messageText beginsWith: 'This package depends on the following classes') or: [ex messageText beginsWith: 'About to serialize an empty diffy version.']) ifFalse: [ex pass]. ex resume]]] valueWithArguments: tuple]. World findATranscript: nil. UIManager default edit: (FileDirectory default fileNamed: 'Workspace.text') contentsOfEntireFile label: 'Overview'. #('VM Simulation' 'Source Generation' 'Slang Test' 'In-image Compilation') reverseDo: [:nickname| | label workspace | label := nickname, ' Workspace'. workspace := (UIManager default edit: (FileDirectory default fileNamed: label, '.text') contentsOfEntireFile label: label) model. workspace shouldStyle ifFalse: [workspace toggleStyling]]. (Utilities classPool at: #CommonRequestStrings) ifNotNil: [:crs| crs contents: crs contents, '\-\VMMaker generateConfiguration\VMMaker generateAllConfigurationsUnderVersionControl\VMClass openCogMultiWindowBrowser\VMClass openObjectMemoriesInterpretersBrowser\VMClass openSpurMultiWindowBrowser' withCRs]. CodeHolder useMultiWindowBrowsers: true. #('Cog' 'CogTools' 'VMMaker') do: [:pkg| (PackageInfo named: pkg) classes do: [:c| c organization sortCategories. c class organization sortCategories]]. (Smalltalk classNamed: #StackInterpreter) withAllSubclasses do: [:sic| sic reorganizeAsISeeFit]. Smalltalk snapshot: true andQuit: true \ No newline at end of file +| manifest load | "Disable underscore as assignment, allowing underscores in method names." Scanner allowUnderscoreAsAssignment: false. manifest := #( ('http://source.squeak.org/FFI' 1 ('FFI-Pools' 'FFI-Kernel')) ('http://source.squeak.org/VMMaker' 6 ('CogPools-ISAs' 'BytecodeSets.spur' 'VMMaker.oscog' 'VMMakerUI' 'Cog' 'CogTools' 'ImageFormat' 'FileAttributesPlugin.oscog')) ('http://ss3.gemstone.com/ss/MethodMassage' 3 ('MethodMassage' 'MethodMassageCompatibility')) ('http://www.squeaksource.com/AioPlugin' 7 ('VMConstruction-Plugins-AioPlugin.oscog')) ('http://www.squeaksource.com/Alien' 0 ('Alien-Core' 'Alien-Tests-Core' 'Alien-Win32')) "('http://www.squeaksource.com/FreeTypePlus' 5 ('FreeType')) can't load this. it is toxic to Squeak 4.5" "('http://www.squeaksource.com/FreetypePlugin' 8 ('Freetype-Plugin')) hence we can do without this" ('http://www.squeaksource.com/OSProcess' 4 ('OSProcess')) ('http://www.squeaksource.com/OSProcessPlugin' 9 ('VMConstruction-Plugins-OSProcessPlugin.oscog')) ('http://www.squeaksource.com/rb' 5 ('AST-Core' 'AST-Semantic' 'AST-Tests-Core' 'AST-Tests-Semantic' 'Refactoring-Changes' 'Refactoring-Core' 'Refactoring-Environment' 'Refactoring-Tests-Changes' 'Refactoring-Tests-Core' 'Refactoring-Tests-Environment' 'Refactoring-Squeak-Platform')) "This for the Klatt speech synthesiser, but seems to be AWOL" ('http://www.squeaksource.com/Speech' 2 ('SharedPool-Speech' )) ('http://www.squeaksource.com/XDCP' 9 ('VMConstruction-Plugins-XDisplayControlPlugin.oscog' )) ('http://www.squeaksource.com/Balloon3D' 9 ('Balloon3D-Constants' 'Balloon3D-Plugins' )) ('http://www.squeaksource.com/Cryptography' 9 ('CryptographyPlugins' )) ('http://ss3.gemstone.com/ss/AndreasSystemProfiler' 9 ('AndreasProfiler')) ('http://www.squeaksource.com/Printf' 5 ('Printf')) ('http://www.squeaksource.com/VectorEnginePlugin' 9 ('VectorEnginePlugin')) ). load := (manifest collect: [:tuple| [:path :order :packages| | repository | repository := MCHttpRepository location: path user: 'squeak' password: 'squeak'. MCRepositoryGroup default addRepository: repository. {repository. order. packages}] valueWithArguments: tuple]) sort: [:a :b| a second <= b second]. #( "'FT2Constants.st'" ) do: [:fileName| (FileDirectory default fileNamed: fileName) fileIn]. load do: [:tuple| [:repository :order :packages| packages do: [:package | | packageVersions latestVersion | "We need to filter-out branches of unbranched packages, but can't assume the package list is (reverse) ordered." packageVersions := ((repository versionNamesForPackageNamed: package) select: [:versionName| (versionName at: package size + 1) = $-]) asSortedCollection: [ :a :b | a versionNumber < b versionNumber ]. latestVersion := packageVersions last. [| version | version := (MCCacheRepository default versionNamed: latestVersion) ifNil: [repository versionNamed: latestVersion]. version load. version workingCopy repositoryGroup addRepository: repository] on: Warning do: [:ex| ((ex messageText beginsWith: 'This package depends on the following classes') or: [ex messageText beginsWith: 'About to serialize an empty diffy version.']) ifFalse: [ex pass]. ex resume]]] valueWithArguments: tuple]. World findATranscript: nil. UIManager default edit: (FileDirectory default fileNamed: 'Workspace.text') contentsOfEntireFile label: 'Overview'. #('VM Simulation' 'Source Generation' 'Slang Test' 'In-image Compilation') reverseDo: [:nickname| | label workspace | label := nickname, ' Workspace'. workspace := (UIManager default edit: (FileDirectory default fileNamed: label, '.text') contentsOfEntireFile label: label) model. workspace shouldStyle ifFalse: [workspace toggleStyling]]. (Utilities classPool at: #CommonRequestStrings) ifNotNil: [:crs| crs contents: crs contents, '\-\VMMaker generateConfiguration\VMMaker generateAllConfigurationsUnderVersionControl\VMClass openCogMultiWindowBrowser\VMClass openObjectMemoriesInterpretersBrowser\VMClass openSpurMultiWindowBrowser' withCRs]. CodeHolder useMultiWindowBrowsers: true. #('Cog' 'CogTools' 'VMMaker') do: [:pkg| (PackageInfo named: pkg) classes do: [:c| c organization sortCategories. c class organization sortCategories]]. (Smalltalk classNamed: #StackInterpreter) withAllSubclasses do: [:sic| sic reorganizeAsISeeFit]. Smalltalk snapshot: true andQuit: true \ No newline at end of file diff --git a/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c b/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c index b58ed8bb77..2608dff994 100644 --- a/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c +++ b/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c @@ -12,6 +12,9 @@ * * *****************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #ifdef _WIN32 # include # include diff --git a/platforms/Cross/plugins/BitBltPlugin/BitBltArmSimd.c b/platforms/Cross/plugins/BitBltPlugin/BitBltArmSimd.c index 236bcad37f..2d7bc9878d 100644 --- a/platforms/Cross/plugins/BitBltPlugin/BitBltArmSimd.c +++ b/platforms/Cross/plugins/BitBltPlugin/BitBltArmSimd.c @@ -23,10 +23,12 @@ * */ +/* BEO */ +#include "BitBltInternal.h" + #include #include -#include "BitBltInternal.h" enum { HALFTONE_NONE, diff --git a/platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.c b/platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.c index 6065dbab83..a9a64aff3f 100644 --- a/platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.c +++ b/platforms/Cross/plugins/BitBltPlugin/BitBltDispatch.c @@ -23,18 +23,18 @@ * */ -#include -#include -#include -#include -#include -#include - #include "BitBltDispatch.h" +#include #include "BitBltArm.h" #include "BitBltGeneric.h" #include "BitBltInternal.h" +#include +#include +#include +#include +#include + /** Define this to enable profiling */ //#define PROFILING diff --git a/platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c b/platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c index 762ce7780f..a6ce00fcf3 100644 --- a/platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c +++ b/platforms/Cross/plugins/BitBltPlugin/BitBltGeneric.c @@ -23,12 +23,13 @@ * */ +#include "BitBltInternal.h" + #include #include #include #include -#include "BitBltInternal.h" #define ROR(x,s) (((uint32_t)(x))>>(s)|((uint32_t)(x))<<((32-(s)))) diff --git a/platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h b/platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h index a653fb64c1..062d37cb5d 100644 --- a/platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h +++ b/platforms/Cross/plugins/BitBltPlugin/BitBltInternal.h @@ -27,6 +27,8 @@ #define BITBLTINTERNAL_H_ #include "BitBltDispatch.h" +#include +#include #define IGNORE(x) (void)(x) #define CACHELINE_LEN (32) diff --git a/platforms/Cross/plugins/GdbARMv8Plugin/sqGdbARMv8Plugin.c b/platforms/Cross/plugins/GdbARMv8Plugin/sqGdbARMv8Plugin.c index 93cd5b6723..cdb22e0d4f 100755 --- a/platforms/Cross/plugins/GdbARMv8Plugin/sqGdbARMv8Plugin.c +++ b/platforms/Cross/plugins/GdbARMv8Plugin/sqGdbARMv8Plugin.c @@ -59,7 +59,7 @@ newCPU() initialSimState = *(lastCPU->cpu[0]); memset(&initialSimState.gr[0], 0, - (char *)&initialSimState.fr[32] - (char *)&initialSimState.gr[0]); + (char *)&initialSimState.base - (char *)&initialSimState.gr[0]); lastCPU->base.engine.jmpbuf = error_abort; } return lastCPU->cpu[0]; diff --git a/platforms/Cross/plugins/IA32ABI/ia32abi.h b/platforms/Cross/plugins/IA32ABI/ia32abi.h index 7f981d79cf..5774701489 100644 --- a/platforms/Cross/plugins/IA32ABI/ia32abi.h +++ b/platforms/Cross/plugins/IA32ABI/ia32abi.h @@ -101,3 +101,7 @@ extern thunkEntryType thunkEntry (INT_REG_ARGS DBL_REG_ARGS void *,sqIntptr_t * extern void *allocateExecutablePage(sqIntptr_t *pagesize); extern VMCallbackContext *getMostRecentCallbackContext(void); #undef thunkEntryType + +#if NewspeakVM +int ioDrainEventQueue(void); +#endif diff --git a/platforms/Cross/plugins/IA32ABI/xabicc.c b/platforms/Cross/plugins/IA32ABI/xabicc.c index 90f2aa2e29..9d784b3fd8 100644 --- a/platforms/Cross/plugins/IA32ABI/xabicc.c +++ b/platforms/Cross/plugins/IA32ABI/xabicc.c @@ -5,6 +5,11 @@ * The plugin is misnamed. It should be the AlienPlugin, but its history * dictates otherwise. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif + #if defined(_M_I386) || defined(_M_IX86) || defined(_X86_) || defined(i386) || defined(i486) || defined(i586) || defined(i686) || defined(__i386__) || defined(__386__) || defined(X86) || defined(I386) # include "ia32abicc.c" #elif powerpc|ppc diff --git a/platforms/Cross/plugins/ProcessorSimulatorPlugin.h b/platforms/Cross/plugins/ProcessorSimulatorPlugin.h index 87daaeab1e..1fcbdc5232 100644 --- a/platforms/Cross/plugins/ProcessorSimulatorPlugin.h +++ b/platforms/Cross/plugins/ProcessorSimulatorPlugin.h @@ -5,6 +5,7 @@ */ #include +#include #define NoError 0 #define ExecutionError 1 diff --git a/platforms/Cross/plugins/SoundCodecPrims/sqSoundCodecPluginBasicPrims.c b/platforms/Cross/plugins/SoundCodecPrims/sqSoundCodecPluginBasicPrims.c index 8f2a2c4384..fc5c115047 100644 --- a/platforms/Cross/plugins/SoundCodecPrims/sqSoundCodecPluginBasicPrims.c +++ b/platforms/Cross/plugins/SoundCodecPrims/sqSoundCodecPluginBasicPrims.c @@ -8,7 +8,9 @@ and source files from Jutta Degener and Carsten Bormann implementation, patch level 10. This was done to simplify Squeak source code maintenance. */ - +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #include #include #include diff --git a/platforms/Cross/plugins/Squeak3D/b3dInit.c b/platforms/Cross/plugins/Squeak3D/b3dInit.c index 20531bdbd9..0f99b30a8e 100644 --- a/platforms/Cross/plugins/Squeak3D/b3dInit.c +++ b/platforms/Cross/plugins/Squeak3D/b3dInit.c @@ -12,6 +12,9 @@ * * *****************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #include #include #include diff --git a/platforms/Cross/plugins/Squeak3D/b3dMain.c b/platforms/Cross/plugins/Squeak3D/b3dMain.c index 96819243d6..ab728d29f1 100644 --- a/platforms/Cross/plugins/Squeak3D/b3dMain.c +++ b/platforms/Cross/plugins/Squeak3D/b3dMain.c @@ -12,6 +12,9 @@ * * *****************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #include /* printf() */ #include /* exit() */ #include /* INT_MIN INT_MAX */ diff --git a/platforms/Cross/plugins/SqueakFFIPrims/sqFFITestFuncs.c b/platforms/Cross/plugins/SqueakFFIPrims/sqFFITestFuncs.c index 12715fb0cc..9f00eaaaad 100644 --- a/platforms/Cross/plugins/SqueakFFIPrims/sqFFITestFuncs.c +++ b/platforms/Cross/plugins/SqueakFFIPrims/sqFFITestFuncs.c @@ -75,80 +75,204 @@ typedef struct SUfdUdSi2 {union Ufd a; union UdSi2 b;} ffiTestSUfdUdSi2; #pragma export on -EXPORT(ffiTestSd2) ffiTestInitSd2 (double a,double b) { ffiTestSd2 v = {a,b}; return v; } -EXPORT(ffiTestSf2) ffiTestInitSf2 (float a,float b) { ffiTestSf2 v = {a,b}; return v; } -EXPORT(ffiTestSl2) ffiTestInitSl2 (long long a,long long b) { ffiTestSl2 v = {a,b}; return v; } -EXPORT(ffiTestSi2) ffiTestInitSi2 (int a,int b) { ffiTestSi2 v = {a,b}; return v; } -EXPORT(ffiTestSs2) ffiTestInitSs2 (short a,short b) { ffiTestSs2 v = {a,b}; return v; } -EXPORT(ffiTestSsi) ffiTestInitSsi (short a,int b) { ffiTestSsi v = {a,b}; return v; } -EXPORT(ffiTestSfi) ffiTestInitSfi (float a,int b) { ffiTestSfi v = {a,b}; return v; } -EXPORT(ffiTestSfd) ffiTestInitSfd (float a,double b) { ffiTestSfd v = {a,b}; return v; } -EXPORT(ffiTestSdi) ffiTestInitSdi (double a,int b) { ffiTestSdi v = {a,b}; return v; } -EXPORT(ffiTestSsf) ffiTestInitSsf (short a,float b) { ffiTestSsf v = {a,b}; return v; } -EXPORT(ffiTestSsSsi)ffiTestInitSsSsi(short a,struct Ssi b) { ffiTestSsSsi v = {a,b}; return v; } -EXPORT(ffiTestSsSsf)ffiTestInitSsSsf(short a,struct Ssf b) { ffiTestSsSsf v = {a,b}; return v; } -EXPORT(ffiTestSslf) ffiTestInitSslf (short a,long long b, float c) { ffiTestSslf v = {a,b,c}; return v; } -EXPORT(ffiTestSf2d) ffiTestInitSf2d (float a,float b, double c) { ffiTestSf2d v = {a,b,c}; return v; } -EXPORT(ffiTestSfdf) ffiTestInitSfdf (float a,double b, float c) { ffiTestSfdf v = {a,b,c}; return v; } -EXPORT(ffiTestSs2i) ffiTestInitSs2i (short a,short b, int c) { ffiTestSs2i v = {a,b,c}; return v; } -EXPORT(ffiTestSsis) ffiTestInitSsis (short a,int b, short c) { ffiTestSsis v = {a,b,c}; return v; } -EXPORT(ffiTestSsls) ffiTestInitSsls (short a,long long b, short c) { ffiTestSsls v = {a,b,c}; return v; } -EXPORT(ffiTestSf4) ffiTestInitSf4 (float a,float b, float c,float d) { ffiTestSf4 v = {a,b,c,d}; return v; } -EXPORT(ffiTestSs4) ffiTestInitSs4 (short a,short b, short c,short d) { ffiTestSs4 v = {a,b,c,d}; return v; } -EXPORT(ffiTestSSdi5)ffiTestInitSSdi5(struct Sdi a,struct Sdi b,struct Sdi c, struct Sdi d,struct Sdi e) { ffiTestSSdi5 v = {a,b,c,d,e}; return v; } - -EXPORT(ffiTestUfi) ffiTestInitUfi_f(float a) { ffiTestUfi v; v.a=a; return v; } -EXPORT(ffiTestUfi) ffiTestInitUfi_i(int b) { ffiTestUfi v; v.b=b; return v; } -EXPORT(ffiTestUfd) ffiTestInitUfd_f(float a) { ffiTestUfd v; v.a=a; return v; } -EXPORT(ffiTestUfd) ffiTestInitUfd_d(double b) { ffiTestUfd v; v.b=b; return v; } -EXPORT(ffiTestUdSi2) ffiTestInitUdSi2_d(double a) { ffiTestUdSi2 v; v.a=a; return v; } -EXPORT(ffiTestUdSi2) ffiTestInitUdSi2_ii(int a,int b) { ffiTestUdSi2 v; v.b.a=a; v.b.b=b; return v; } -EXPORT(ffiTestSUfdUfi) ffiTestInitSUfdUfi (union Ufd a,union Ufi b) { ffiTestSUfdUfi v = {a,b}; return v; } -EXPORT(ffiTestSUfdUdSi2) ffiTestInitSUfdUdSi2 (union Ufd a,union UdSi2 b) { ffiTestSUfdUdSi2 v = {a,b}; return v; } - -EXPORT(ffiTestSd2) ffiTestReturnSd2 () { return ffiTestInitSd2(1.0 ,2.0 ); } -EXPORT(ffiTestSf2) ffiTestReturnSf2 () { return ffiTestInitSf2(1.0f,2.0f); } -EXPORT(ffiTestSl2) ffiTestReturnSl2 () { return ffiTestInitSl2(1LL,2LL); } -EXPORT(ffiTestSi2) ffiTestReturnSi2 () { return ffiTestInitSi2(1,2); } -EXPORT(ffiTestSs2) ffiTestReturnSs2 () { return ffiTestInitSs2(1,2); } -EXPORT(ffiTestSfi) ffiTestReturnSfi () { return ffiTestInitSfi(1.0f,2); } -EXPORT(ffiTestSfd) ffiTestReturnSfd () { return ffiTestInitSfd(1.0f,2.0); } -EXPORT(ffiTestSdi) ffiTestReturnSdi () { return ffiTestInitSdi(1.0,2); } -EXPORT(ffiTestSsf) ffiTestReturnSsf () { return ffiTestInitSsf(1,2.0); } -EXPORT(ffiTestSsi) ffiTestReturnSsi () { return ffiTestInitSsi(1,2); } -EXPORT(ffiTestSsSsi)ffiTestReturnSsSsi() { return ffiTestInitSsSsi(1,ffiTestInitSsi(2,3)); } -EXPORT(ffiTestSsSsf)ffiTestReturnSsSsf() { return ffiTestInitSsSsf(1,ffiTestInitSsf(2,3.0f)); } -EXPORT(ffiTestSf2d) ffiTestReturnSf2d () { return ffiTestInitSf2d(1.0f,2.0f,3.0); } -EXPORT(ffiTestSfdf) ffiTestReturnSfdf () { return ffiTestInitSfdf(1.0f,2.0,3.0f); } -EXPORT(ffiTestSs2i) ffiTestReturnSs2i () { return ffiTestInitSs2i(1,2,3); } -EXPORT(ffiTestSsis) ffiTestReturnSsis () { return ffiTestInitSsis(1,2,3); } -EXPORT(ffiTestSsls) ffiTestReturnSsls () { return ffiTestInitSsls(1,2LL,3); } -EXPORT(ffiTestSslf) ffiTestReturnSslf () { return ffiTestInitSslf(1,2LL,3.0f); } -EXPORT(ffiTestSf4) ffiTestReturnSf4 () { return ffiTestInitSf4(1.0f,2.0f,3.0f,4.0f); } -EXPORT(ffiTestSs4) ffiTestReturnSs4 () { return ffiTestInitSs4(1,2,3,4); } -EXPORT(ffiTestSSdi5)ffiTestReturnSSdi5() { return ffiTestInitSSdi5( - ffiTestInitSdi(1.0,1),ffiTestInitSdi(2.0,2), - ffiTestInitSdi(3.0,3),ffiTestInitSdi(4.0,4), - ffiTestInitSdi(5.0,5)); } - -EXPORT(double) ffiTestSumSfd(ffiTestSfd x) { return (double) x.a + (double) x.b ; } -EXPORT(double) ffiTestSumSfd_2(ffiTestSfd x,ffiTestSfd y) { return ffiTestSumSfd(x) + ffiTestSumSfd(y); } -EXPORT(double) ffiTestSumSfd_4(ffiTestSfd x,ffiTestSfd y,ffiTestSfd z,ffiTestSfd t) { return ffiTestSumSfd_2(x,y) + ffiTestSumSfd_2(z,t); } -EXPORT(double) ffiTestSumfWithSfd_4(float f,ffiTestSfd x,ffiTestSfd y,ffiTestSfd z,ffiTestSfd t) { return ((double) f) + ffiTestSumSfd_2(x,y) + ffiTestSumSfd_2(z,t); } /* consume 1 float register with first argument */ -EXPORT(double) ffiTestSumSdi(ffiTestSdi x) { return (double) x.a + (double) x.b ; } -EXPORT(double) ffiTestSumSdi_2(ffiTestSdi x,ffiTestSdi y) { return ffiTestSumSdi(x) + ffiTestSumSdi(y); } -EXPORT(double) ffiTestSumSdi_4(ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) { return ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } -EXPORT(double) ffiTestSumdiWithSdi_4(double a,int b,ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) { return a + ((double) b) + ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } /* consume one int and 1 float register with 1st two arguments */ -EXPORT(double) ffiTestSumdWithSdi_4(double a,ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) { return a + ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } /* consume one float register with 1st argument */ -EXPORT(double) ffiTestSumiWithSdi_4(int b,ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) { return ((double) b) + ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } /* consume one int register with 1st argument */ -EXPORT(double) ffiTestSumSSdi5(ffiTestSSdi5 x) { return ffiTestSumSdi_4(x.a,x.b,x.c,x.d) + ffiTestSumSdi(x.e) ; } - -EXPORT(double) ffiTestSumSslf(ffiTestSslf x) { return (double) x.a + (double) x.b + (double) x.c ; } -EXPORT(double) ffiTestSumSslf_2(ffiTestSslf x,ffiTestSslf y) { return ffiTestSumSslf(x) + ffiTestSumSslf(y); } -EXPORT(double) ffiTestSumSslf_4(ffiTestSslf x,ffiTestSslf y,ffiTestSslf z,ffiTestSslf t) { return ffiTestSumSslf_2(x,y) + ffiTestSumSslf_2(z,t); } - -EXPORT(double) ffiTestSumSUfdUfi_f(ffiTestSUfdUfi x) {return (double) x.a.a + (double) x.b.a; }; /* sum the float parts */ -EXPORT(double) ffiTestSumSUfdUdSi2_d(ffiTestSUfdUdSi2 x) {return x.a.b + x.b.a; }; /* sum the double parts */ +EXPORT(ffiTestSd2) ffiTestInitSd2 (double a,double b) +{ ffiTestSd2 v = {a,b}; + return v; +} +EXPORT(ffiTestSf2) ffiTestInitSf2 (float a,float b) +{ ffiTestSf2 v = {a,b}; + return v; +} +EXPORT(ffiTestSl2) ffiTestInitSl2 (long long a,long long b) +{ ffiTestSl2 v = {a,b}; + return v; +} +EXPORT(ffiTestSi2) ffiTestInitSi2 (int a,int b) +{ ffiTestSi2 v = {a,b}; + return v; +} +EXPORT(ffiTestSs2) ffiTestInitSs2 (short a,short b) +{ ffiTestSs2 v = {a,b}; + return v; +} +EXPORT(ffiTestSsi) ffiTestInitSsi (short a,int b) +{ ffiTestSsi v = {a,b}; + return v; +} +EXPORT(ffiTestSfi) ffiTestInitSfi (float a,int b) +{ ffiTestSfi v = {a,b}; + return v; +} +EXPORT(ffiTestSfd) ffiTestInitSfd (float a,double b) +{ ffiTestSfd v = {a,b}; + return v; +} +EXPORT(ffiTestSdi) ffiTestInitSdi (double a,int b) +{ ffiTestSdi v = {a,b}; + return v; +} +EXPORT(ffiTestSsf) ffiTestInitSsf (short a,float b) +{ ffiTestSsf v = {a,b}; + return v; +} +EXPORT(ffiTestSsSsi)ffiTestInitSsSsi(short a,struct Ssi b) +{ ffiTestSsSsi v = {a,b}; + return v; +} +EXPORT(ffiTestSsSsf)ffiTestInitSsSsf(short a,struct Ssf b) +{ ffiTestSsSsf v = {a,b}; + return v; +} +EXPORT(ffiTestSslf) ffiTestInitSslf (short a,long long b, float c) +{ ffiTestSslf v = {a,b,c}; + return v; +} +EXPORT(ffiTestSf2d) ffiTestInitSf2d (float a,float b, double c) +{ ffiTestSf2d v = {a,b,c}; + return v; +} +EXPORT(ffiTestSfdf) ffiTestInitSfdf (float a,double b, float c) +{ ffiTestSfdf v = {a,b,c}; + return v; +} +EXPORT(ffiTestSs2i) ffiTestInitSs2i (short a,short b, int c) +{ ffiTestSs2i v = {a,b,c}; + return v; +} +EXPORT(ffiTestSsis) ffiTestInitSsis (short a,int b, short c) +{ ffiTestSsis v = {a,b,c}; + return v; +} +EXPORT(ffiTestSsls) ffiTestInitSsls (short a,long long b, short c) +{ ffiTestSsls v = {a,b,c}; + return v; +} +EXPORT(ffiTestSf4) ffiTestInitSf4 (float a,float b, float c,float d) +{ ffiTestSf4 v = {a,b,c,d}; + return v; +} +EXPORT(ffiTestSs4) ffiTestInitSs4 (short a,short b, short c,short d) +{ ffiTestSs4 v = {a,b,c,d}; + return v; +} +EXPORT(ffiTestSSdi5)ffiTestInitSSdi5(struct Sdi a,struct Sdi b,struct Sdi c, struct Sdi d,struct Sdi e) +{ ffiTestSSdi5 v = {a,b,c,d,e}; + return v; +} + +EXPORT(ffiTestUfi) ffiTestInitUfi_f(float a) +{ ffiTestUfi v; v.a=a; + return v; +} +EXPORT(ffiTestUfi) ffiTestInitUfi_i(int b) +{ ffiTestUfi v; v.b=b; + return v; +} +EXPORT(ffiTestUfd) ffiTestInitUfd_f(float a) +{ ffiTestUfd v; v.a=a; + return v; +} +EXPORT(ffiTestUfd) ffiTestInitUfd_d(double b) +{ ffiTestUfd v; v.b=b; + return v; +} +EXPORT(ffiTestUdSi2) ffiTestInitUdSi2_d(double a) +{ ffiTestUdSi2 v; v.a=a; + return v; +} +EXPORT(ffiTestUdSi2) ffiTestInitUdSi2_ii(int a,int b) +{ ffiTestUdSi2 v; v.b.a=a; v.b.b=b; + return v; +} +EXPORT(ffiTestSUfdUfi) ffiTestInitSUfdUfi (union Ufd a,union Ufi b) +{ ffiTestSUfdUfi v = {a,b}; + return v; +} +EXPORT(ffiTestSUfdUdSi2) ffiTestInitSUfdUdSi2 (union Ufd a,union UdSi2 b) +{ ffiTestSUfdUdSi2 v = {a,b}; + return v; +} + +EXPORT(ffiTestSd2) ffiTestReturnSd2 () +{ return ffiTestInitSd2(1.0 ,2.0 ); } +EXPORT(ffiTestSf2) ffiTestReturnSf2 () +{ return ffiTestInitSf2(1.0f,2.0f); } +EXPORT(ffiTestSl2) ffiTestReturnSl2 () +{ return ffiTestInitSl2(1LL,2LL); } +EXPORT(ffiTestSi2) ffiTestReturnSi2 () +{ return ffiTestInitSi2(1,2); } +EXPORT(ffiTestSs2) ffiTestReturnSs2 () +{ return ffiTestInitSs2(1,2); } +EXPORT(ffiTestSfi) ffiTestReturnSfi () +{ return ffiTestInitSfi(1.0f,2); } +EXPORT(ffiTestSfd) ffiTestReturnSfd () +{ return ffiTestInitSfd(1.0f,2.0); } +EXPORT(ffiTestSdi) ffiTestReturnSdi () +{ return ffiTestInitSdi(1.0,2); } +EXPORT(ffiTestSsf) ffiTestReturnSsf () +{ return ffiTestInitSsf(1,2.0); } +EXPORT(ffiTestSsi) ffiTestReturnSsi () +{ return ffiTestInitSsi(1,2); } +EXPORT(ffiTestSsSsi)ffiTestReturnSsSsi() +{ return ffiTestInitSsSsi(1,ffiTestInitSsi(2,3)); } +EXPORT(ffiTestSsSsf)ffiTestReturnSsSsf() +{ return ffiTestInitSsSsf(1,ffiTestInitSsf(2,3.0f)); } +EXPORT(ffiTestSf2d) ffiTestReturnSf2d () +{ return ffiTestInitSf2d(1.0f,2.0f,3.0); } +EXPORT(ffiTestSfdf) ffiTestReturnSfdf () +{ return ffiTestInitSfdf(1.0f,2.0,3.0f); } +EXPORT(ffiTestSs2i) ffiTestReturnSs2i () +{ return ffiTestInitSs2i(1,2,3); } +EXPORT(ffiTestSsis) ffiTestReturnSsis () +{ return ffiTestInitSsis(1,2,3); } +EXPORT(ffiTestSsls) ffiTestReturnSsls () +{ return ffiTestInitSsls(1,2LL,3); } +EXPORT(ffiTestSslf) ffiTestReturnSslf () +{ return ffiTestInitSslf(1,2LL,3.0f); } +EXPORT(ffiTestSf4) ffiTestReturnSf4 () +{ return ffiTestInitSf4(1.0f,2.0f,3.0f,4.0f); } +EXPORT(ffiTestSs4) ffiTestReturnSs4 () +{ return ffiTestInitSs4(1,2,3,4); } +EXPORT(ffiTestSSdi5)ffiTestReturnSSdi5() +{ return ffiTestInitSSdi5(ffiTestInitSdi(1.0,1),ffiTestInitSdi(2.0,2), + ffiTestInitSdi(3.0,3),ffiTestInitSdi(4.0,4), + ffiTestInitSdi(5.0,5)); +} + +EXPORT(double) ffiTestSumSfd(ffiTestSfd x) +{ return (double) x.a + (double) x.b ; } +EXPORT(double) ffiTestSumSfd_2(ffiTestSfd x,ffiTestSfd y) +{ return ffiTestSumSfd(x) + ffiTestSumSfd(y); } +EXPORT(double) ffiTestSumSfd_4(ffiTestSfd x,ffiTestSfd y,ffiTestSfd z,ffiTestSfd t) +{ return ffiTestSumSfd_2(x,y) + ffiTestSumSfd_2(z,t); } +EXPORT(double) ffiTestSumfWithSfd_4(float f,ffiTestSfd x,ffiTestSfd y,ffiTestSfd z,ffiTestSfd t) +{ return ((double) f) + ffiTestSumSfd_2(x,y) + ffiTestSumSfd_2(z,t); } /* consume 1 float register with first argument */ +EXPORT(double) ffiTestSumSdi(ffiTestSdi x) +{ return (double) x.a + (double) x.b ; } +EXPORT(double) ffiTestSumSdi_2(ffiTestSdi x,ffiTestSdi y) +{ return ffiTestSumSdi(x) + ffiTestSumSdi(y); } +EXPORT(double) ffiTestSumSdi_4(ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) +{ return ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } +EXPORT(double) ffiTestSumdiWithSdi_4(double a,int b,ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) +{ return a + ((double) b) + ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } /* consume one int and 1 float register with 1st two arguments */ +EXPORT(double) ffiTestSumdWithSdi_4(double a,ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) +{ return a + ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } /* consume one float register with 1st argument */ +EXPORT(double) ffiTestSumiWithSdi_4(int b,ffiTestSdi x,ffiTestSdi y,ffiTestSdi z,ffiTestSdi t) +{ return ((double) b) + ffiTestSumSdi_2(x,y) + ffiTestSumSdi_2(z,t); } /* consume one int register with 1st argument */ +EXPORT(double) ffiTestSumSSdi5(ffiTestSSdi5 x) +{ return ffiTestSumSdi_4(x.a,x.b,x.c,x.d) + ffiTestSumSdi(x.e) ; } + +EXPORT(double) ffiTestSumSslf(ffiTestSslf x) +{ return (double) x.a + (double) x.b + (double) x.c ; } +EXPORT(double) ffiTestSumSslf_2(ffiTestSslf x,ffiTestSslf y) +{ return ffiTestSumSslf(x) + ffiTestSumSslf(y); } +EXPORT(double) ffiTestSumSslf_4(ffiTestSslf x,ffiTestSslf y,ffiTestSslf z,ffiTestSslf t) +{ return ffiTestSumSslf_2(x,y) + ffiTestSumSslf_2(z,t); } + +EXPORT(double) ffiTestSumSUfdUfi_f(ffiTestSUfdUfi x) +{return (double) x.a.a + (double) x.b.a; }; /* sum the float parts */ +EXPORT(double) ffiTestSumSUfdUdSi2_d(ffiTestSUfdUdSi2 x) +{return x.a.b + x.b.a; }; /* sum the double parts */ EXPORT(char) ffiTestChars(char c1, char c2, char c3, char c4); EXPORT(short) ffiTestShorts(short c1, short c2, short c3, short c4); @@ -183,92 +307,110 @@ EXPORT(LONGLONG) ffiTestLongLonga3(char c1, LONGLONG i1, char c2); /* test passing characters */ -EXPORT(char) ffiTestChars(char c1, char c2, char c3, char c4) { +EXPORT(char) ffiTestChars(char c1, char c2, char c3, char c4) +{ printf("4 characters came in as\nc1 = %c (%x)\nc2 = %c (%x)\nc3 = %c (%x)\nc4 = %c (%x)\n", c1, c1, c2, c2, c3, c3, c4, c4); return c1+c2; } /* test passing shorts */ -EXPORT(short) ffiTestShorts(short c1, short c2, short c3, short c4) { +EXPORT(short) ffiTestShorts(short c1, short c2, short c3, short c4) +{ printf("4 shorts came in as\ns1 = %d (%x)\ns2 = %d (%x)\ns3 = %d (%x)\ns4 = %d (%x)\n", c1, c1, c2, c2, c3, c3, c4, c4); return c1+c2; } /* test passing ints */ -EXPORT(int) ffiTestInts(int c1, int c2, int c3, int c4) { +EXPORT(int) ffiTestInts(int c1, int c2, int c3, int c4) +{ printf("4 ints came in as\ni1 = %d (%x)\ni2 = %d (%x)\ni3 = %d (%x)\ni4 = %d (%x)\n", c1, c1, c2, c2, c3, c3, c4, c4); return c1+c2; } -EXPORT(int) ffiTest4IntSum(int c1, int c2, int c3, int c4) { +EXPORT(int) ffiTest4IntSum(int c1, int c2, int c3, int c4) +{ return c1+c2+c3+c4; } -EXPORT(int) ffiTestInts8(int c1, int c2, int c3, int c4, int c5, int c6, int c7, int c8) { +EXPORT(int) ffiTestInts8(int c1, int c2, int c3, int c4, int c5, int c6, int c7, int c8) +{ printf("8 ints came in as\ni1 = %d (%x)\ni2 = %d (%x)\ni3 = %d (%x)\ni4 = %d (%x)\ni5 = %d (%x)\ni6 = %d (%x)\ni7 = %d (%x)\ni8 = %d (%x)\n", c1, c1, c2, c2, c3, c3, c4, c4, c5, c5, c6, c6, c7, c7, c8, c8); return 42; } -EXPORT(int) ffiTest8IntSum(int c1, int c2, int c3, int c4, int c5, int c6, int c7, int c8) { +EXPORT(int) ffiTest8IntSum(int c1, int c2, int c3, int c4, int c5, int c6, int c7, int c8) +{ printf("8 ints came in as\ni1 = %d (%x)\ni2 = %d (%x)\ni3 = %d (%x)\ni4 = %d (%x)\ni5 = %d (%x)\ni6 = %d (%x)\ni7 = %d (%x)\ni8 = %d (%x)\n", c1, c1, c2, c2, c3, c3, c4, c4, c5, c5, c6, c6, c7, c7, c8, c8); return c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8; } -EXPORT(long) ffiTest4LongSum(long c1, long c2, long c3, long c4) { +EXPORT(long) ffiTest4LongSum(long c1, long c2, long c3, long c4) +{ return c1+c2+c3+c4; } -EXPORT(long) ffiTestLongs8(long c1, long c2, long c3, long c4, long c5, long c6, long c7, long c8) { +EXPORT(long) ffiTestLongs8(long c1, long c2, long c3, long c4, long c5, long c6, long c7, long c8) +{ printf("8 longs came in as\ni1 = %ld (%lx)\ni2 = %ld (%lx)\ni3 = %ld (%lx)\ni4 = %ld (%lx)\ni5 = %ld (%lx)\ni6 = %ld (%lx)\ni7 = %ld (%lx)\ni8 = %ld (%lx)\n", c1, c1, c2, c2, c3, c3, c4, c4, c5, c5, c6, c6, c7, c7, c8, c8); return 42; } -EXPORT(long) ffiTest8longSum(long c1, long c2, long c3, long c4, long c5, long c6, long c7, long c8) { +EXPORT(long) ffiTest8longSum(long c1, long c2, long c3, long c4, long c5, long c6, long c7, long c8) +{ printf("8 longs came in as\ni1 = %ld (%lx)\ni2 = %ld (%lx)\ni3 = %ld (%lx)\ni4 = %ld (%lx)\ni5 = %ld (%lx)\ni6 = %ld (%lx)\ni7 = %ld (%lx)\ni8 = %ld (%lx)\n", c1, c1, c2, c2, c3, c3, c4, c4, c5, c5, c6, c6, c7, c7, c8, c8); return c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8; } -EXPORT(long long) ffiTest4LongLongSum(long long c1, long long c2, long long c3, long long c4) { +EXPORT(long long) ffiTest4LongLongSum(long long c1, long long c2, long long c3, long long c4) +{ return c1+c2+c3+c4; } -EXPORT(long long) ffiTestLongLongs8(long long c1, long long c2, long long c3, long long c4, long long c5, long long c6, long long c7, long long c8) { +EXPORT(long long) ffiTestLongLongs8(long long c1, long long c2, long long c3, long long c4, long long c5, long long c6, long long c7, long long c8) +{ printf("8 long longs came in as\ni1 = %lld (%llx)\ni2 = %lld (%llx)\ni3 = %lld (%llx)\ni4 = %lld (%llx)\ni5 = %lld (%llx)\ni6 = %lld (%llx)\ni7 = %lld (%llx)\ni8 = %lld (%llx)\n", c1, c1, c2, c2, c3, c3, c4, c4, c5, c5, c6, c6, c7, c7, c8, c8); return 42; } -EXPORT(long long) ffiTest8LongLongSum(long long c1, long long c2, long long c3, long long c4, long long c5, long long c6, long long c7, long long c8) { +EXPORT(long long) ffiTest8LongLongSum(long long c1, long long c2, long long c3, long long c4, long long c5, long long c6, long long c7, long long c8) +{ printf("8 long longs came in as\ni1 = %lld (%llx)\ni2 = %lld (%llx)\ni3 = %lld (%llx)\ni4 = %lld (%llx)\ni5 = %lld (%llx)\ni6 = %lld (%llx)\ni7 = %lld (%llx)\ni8 = %lld (%llx)\n", c1, c1, c2, c2, c3, c3, c4, c4, c5, c5, c6, c6, c7, c7, c8, c8); return c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8; } /* test passing and returning floats */ -EXPORT(float) ffiTestFloats(float f1, float f2) { +EXPORT(float) ffiTestFloats(float f1, float f2) +{ printf("The two floats are %f and %f\n", f1, f2); return (float) (f1 + f2); } -EXPORT(float) ffiTestFloats7(float f1, float f2, float f3, float f4, float f5, float f6, float f7) { +EXPORT(float) ffiTestFloats7(float f1, float f2, float f3, float f4, float f5, float f6, float f7) +{ printf("The 7 floats are %f %f %f %f %f %f %f\n", f1, f2, f3, f4, f5, f6, f7); return (float) (f1 + f2 + f3 + f4 + f5 + f6 + f7); } -EXPORT(float) ffiTestFloats13(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) { +EXPORT(float) ffiTestFloats13(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) +{ printf("The 13 floats are %f %f %f %f %f %f %f %f %f %f %f %f %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13); return (float) (f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13); } -EXPORT(float) ffiTestFloats14(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13, float f14) { +EXPORT(float) ffiTestFloats14(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13, float f14) +{ printf("The 14 floats are %f %f %f %f %f %f %f %f %f %f %f %f %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13); return (float) (f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14); } -EXPORT(double) ffiTestDoubles9(double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8, double f9) { +EXPORT(double) ffiTestDoubles9(double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8, double f9) +{ printf("The 9 doubles are %f %f %f %f %f %f %f %f %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9); return (double) (f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9); } -EXPORT(double) ffiTestDoubles14(double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8, double f9, double f10, double f11, double f12, double f13, double f14) { +EXPORT(double) ffiTestDoubles14(double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8, double f9, double f10, double f11, double f12, double f13, double f14) +{ printf("The 14 double are %f %f %f %f %f %f %f %f %f %f %f %f %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13); return (double) (f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14); } @@ -287,19 +429,22 @@ EXPORT(double) ffiTestMixedDoublesAndLongs(double d1, long l1, double d2, long l } /* test passing and returning doubles */ -EXPORT(double) ffiTestDoubles(double d1, double d2) { +EXPORT(double) ffiTestDoubles(double d1, double d2) +{ printf("The two floats are %f and %f\n", (float)d1, (float)d2); return d1+d2; } /* test passing and returning strings */ -EXPORT(char*) ffiPrintString(char *string) { +EXPORT(char*) ffiPrintString(char *string) +{ printf("%s\n", string); return string; } /* test passing and returning 64bit structures */ -EXPORT(ffiTestPoint2) ffiTestStruct64(ffiTestPoint2 pt1, ffiTestPoint2 pt2) { +EXPORT(ffiTestPoint2) ffiTestStruct64(ffiTestPoint2 pt1, ffiTestPoint2 pt2) +{ ffiTestPoint2 result; printf("pt1.x = %d\npt1.y = %d\npt2.x = %d\npt2.y = %d\n", pt1.x, pt1.y, pt2.x, pt2.y); @@ -309,7 +454,8 @@ EXPORT(ffiTestPoint2) ffiTestStruct64(ffiTestPoint2 pt1, ffiTestPoint2 pt2) { } /* test passing and returning large structures */ -EXPORT(ffiTestPoint4) ffiTestStructBig(ffiTestPoint4 pt1, ffiTestPoint4 pt2) { +EXPORT(ffiTestPoint4) ffiTestStructBig(ffiTestPoint4 pt1, ffiTestPoint4 pt2) +{ ffiTestPoint4 result; printf("pt1.x = %d\npt1.y = %d\npt1.z = %d\npt1.w = %d\n", pt1.x, pt1.y, pt1.z, pt1.w); @@ -322,7 +468,8 @@ EXPORT(ffiTestPoint4) ffiTestStructBig(ffiTestPoint4 pt1, ffiTestPoint4 pt2) { return result; } -EXPORT(ffiTestBiggerStruct) ffiTestStructBigger(ffiTestPoint4 pt1, ffiTestPoint4 pt2) { +EXPORT(ffiTestBiggerStruct) ffiTestStructBigger(ffiTestPoint4 pt1, ffiTestPoint4 pt2) +{ ffiTestBiggerStruct result; result.x = pt1.x; @@ -338,7 +485,8 @@ EXPORT(ffiTestBiggerStruct) ffiTestStructBigger(ffiTestPoint4 pt1, ffiTestPoint4 } /* test passing and returning pointers */ -EXPORT(ffiTestPoint4*) ffiTestPointers(ffiTestPoint4 *pt1, ffiTestPoint4 *pt2) { +EXPORT(ffiTestPoint4*) ffiTestPointers(ffiTestPoint4 *pt1, ffiTestPoint4 *pt2) +{ ffiTestPoint4 *result; printf("pt1.x = %d\npt1.y = %d\npt1.z = %d\npt1.w = %d\n", pt1->x, pt1->y, pt1->z, pt1->w); @@ -353,14 +501,16 @@ EXPORT(ffiTestPoint4*) ffiTestPointers(ffiTestPoint4 *pt1, ffiTestPoint4 *pt2) { } /* test returning small structure (uses registers on some platforms) */ -EXPORT(ffiSmallStruct1) ffiTestSmallStructReturn(void) { +EXPORT(ffiSmallStruct1) ffiTestSmallStructReturn(void) +{ ffiSmallStruct1 result; result.x = 3; result.y = 4; return result; } -EXPORT(int) ffiTestMixedIntAndStruct(int i1, ffiTestPoint2 pt1, ffiTestPoint2 pt2) { +EXPORT(int) ffiTestMixedIntAndStruct(int i1, ffiTestPoint2 pt1, ffiTestPoint2 pt2) +{ int result; printf("int1 = %d\n", i1); printf("pt1.x = %d\npt1.y = %d\n", pt1.x, pt1.y); @@ -369,7 +519,8 @@ EXPORT(int) ffiTestMixedIntAndStruct(int i1, ffiTestPoint2 pt1, ffiTestPoint2 pt return result; } -EXPORT(int) ffiTestMixedIntAndStruct2(int i1, ffiTestPoint4 pt2) { +EXPORT(int) ffiTestMixedIntAndStruct2(int i1, ffiTestPoint4 pt2) +{ int result; printf("int1 = %d\n", i1); printf("pt2.x = %d\npt2.y = %d\npt2.z = %d\npt2.w = %d\n", @@ -378,7 +529,8 @@ EXPORT(int) ffiTestMixedIntAndStruct2(int i1, ffiTestPoint4 pt2) { return result; } -EXPORT(int) ffiTestMixedIntAndStruct3(int i1, ffiSmallStruct1 pt2) { +EXPORT(int) ffiTestMixedIntAndStruct3(int i1, ffiSmallStruct1 pt2) +{ int result; printf("int1 = %d\n", i1); printf("pt2.x = %d\npt2.y = %d\n", pt2.x, pt2.y); @@ -386,7 +538,8 @@ EXPORT(int) ffiTestMixedIntAndStruct3(int i1, ffiSmallStruct1 pt2) { return result; } -EXPORT(double) ffiTestMixedDoublesIntAndStruct(double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8, double f9, int i1, ffiTestPoint4 pt) { +EXPORT(double) ffiTestMixedDoublesIntAndStruct(double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8, double f9, int i1, ffiTestPoint4 pt) +{ printf("The 9 doubles are %f %f %f %f %f %f %f %f %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9); printf("int1 = %d\n", i1); printf("pt.x = %d\npt.y = %d\npt.z = %d\npt.w = %d\n", @@ -395,31 +548,38 @@ EXPORT(double) ffiTestMixedDoublesIntAndStruct(double f1, double f2, double f3, } /* test passing and returning longlongs */ -EXPORT(LONGLONG) ffiTestLongLong(LONGLONG i1, LONGLONG i2) { +EXPORT(LONGLONG) ffiTestLongLong(LONGLONG i1, LONGLONG i2) +{ return i1 + i2; } -EXPORT(LONGLONG) ffiTestLongLonga1(char c1, LONGLONG i1, LONGLONG i2) { +EXPORT(LONGLONG) ffiTestLongLonga1(char c1, LONGLONG i1, LONGLONG i2) +{ return c1 + i1 + i2; } -EXPORT(LONGLONG) ffiTestLongLonga2(char c1, char c2, LONGLONG i1, LONGLONG i2) { +EXPORT(LONGLONG) ffiTestLongLonga2(char c1, char c2, LONGLONG i1, LONGLONG i2) +{ return c1 + c2 + i1 + i2; } -EXPORT(LONGLONG) ffiTestLongLonga3(char c1, LONGLONG i1, char c2) { +EXPORT(LONGLONG) ffiTestLongLonga3(char c1, LONGLONG i1, char c2) +{ return c1 + i1 + c2; } -EXPORT(LONGLONG) ffiTestLongLong8(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8, LONGLONG i1, LONGLONG i2) { +EXPORT(LONGLONG) ffiTestLongLong8(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8, LONGLONG i1, LONGLONG i2) +{ return c1+c2+c3+c4+c5+c6+c7+c8+i1 + i2; } -EXPORT(LONGLONG) ffiTestLongLong8a1(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8, char c9, LONGLONG i1, LONGLONG i2) { +EXPORT(LONGLONG) ffiTestLongLong8a1(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8, char c9, LONGLONG i1, LONGLONG i2) +{ return c1+c2+c3+c4+c5+c6+c7+c8+c9+i1 + i2; } -EXPORT(LONGLONG) ffiTestLongLong8a2(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8, char c9, char c10, LONGLONG i1, LONGLONG i2) { +EXPORT(LONGLONG) ffiTestLongLong8a2(char c1, char c2, char c3, char c4, char c5, char c6, char c7, char c8, char c9, char c10, LONGLONG i1, LONGLONG i2) +{ return c1+c2+c3+c4+c5+c6+c7+c8+c9+c10+i1 + i2; } diff --git a/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c b/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c index e252202772..fe58dcc6cd 100644 --- a/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c +++ b/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c @@ -18,7 +18,9 @@ eem 3/15/2017 Allow functions registered with ioGetSurfaceFormat, failure). This allows e.g. Pharo's AthensCairoSurface to avoid installing two null callbacks for unlock & show. */ - +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #include #include #include diff --git a/platforms/Cross/vm/sq.h b/platforms/Cross/vm/sq.h index d06c84119f..4f7bbbb829 100755 --- a/platforms/Cross/vm/sq.h +++ b/platforms/Cross/vm/sq.h @@ -577,9 +577,9 @@ void *ioLoadExternalFunctionOfLengthFromModuleOfLength (sqInt functionNameIndex, sqInt functionNameLength, sqInt moduleNameIndex, sqInt moduleNameLength); #if SPURVM -void *ioLoadExternalFunctionOfLengthFromModuleOfLengthAccessorDepthInto +void *ioLoadExternalFunctionOfLengthFromModuleOfLengthMetadataInto (sqInt functionNameIndex, sqInt functionNameLength, - sqInt moduleNameIndex, sqInt moduleNameLength, sqInt *accessorDepthPtr); + sqInt moduleNameIndex, sqInt moduleNameLength, sqInt *metadataPtr); #endif sqInt ioUnloadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength); void *ioLoadFunctionFrom(char *functionName, char *pluginName); @@ -601,14 +601,17 @@ void *ioLoadSymbolOfLengthFromModule(sqInt functionNameIndex, sqInt functionNam */ void *ioLoadModule(char *pluginName); -/* ioFindExternalFunctionIn[AccessorDepthInto]: +/* ioFindExternalFunctionIn[MetadataInto]: Find the function with the given name in the moduleHandle. WARNING: never primitiveFail() within, just return 0. Note in Spur takes an extra parameter which is defaulted to 0. */ #if SPURVM -void *ioFindExternalFunctionInAccessorDepthInto(char *lookupName, void *moduleHandle, sqInt *accessorDepthPtr); -# define ioFindExternalFunctionIn(ln,mh) ioFindExternalFunctionInAccessorDepthInto(ln,mh,0) +void *ioFindExternalFunctionInMetadataInto(char *lookupName, void *moduleHandle, sqInt *metadataPtr); +# define ioFindExternalFunctionIn(ln,mh) ioFindExternalFunctionInMetadataInto(ln,mh,0) +# define NullSpurMetadata -256 // -1 << 8, but shifting -ve values is undefined +# define SpurPrimitiveMetadataType signed short +# define validSpurPrimitiveMetadata(m) ((((m) >> 8) >= -1) && (((m) >> 8) <= 5)) #else void *ioFindExternalFunctionIn(char *lookupName, void *moduleHandle); #endif diff --git a/platforms/Cross/vm/sqHeapMap.c b/platforms/Cross/vm/sqHeapMap.c index 3d18dc00e3..fb9545510b 100644 --- a/platforms/Cross/vm/sqHeapMap.c +++ b/platforms/Cross/vm/sqHeapMap.c @@ -18,7 +18,9 @@ * object that should have been collected. * ****************************************************************************/ - +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #include #include /* for memset */ #include /* for perror */ diff --git a/platforms/Cross/vm/sqNamedPrims.c b/platforms/Cross/vm/sqNamedPrims.c index e7fe704931..da3e08ad85 100644 --- a/platforms/Cross/vm/sqNamedPrims.c +++ b/platforms/Cross/vm/sqNamedPrims.c @@ -16,7 +16,7 @@ typedef struct { char *pluginName; - char *primitiveName; /* N.B. On Spur the accessorDepth is hidden after this */ + char *primitiveName; /* N.B. On Spur metadata including the accessorDepth is hidden after this */ void *primitiveAddress; } sqExport; @@ -104,7 +104,7 @@ static void * findExternalFunctionIn(char *functionName, ModuleEntry *module #if SPURVM # define NADA , 0, 0 - , sqInt fnameLength, sqInt *accessorDepthPtr + , sqInt fnameLength, sqInt *metadataPtr #else # define NADA /* nada */ #endif @@ -115,7 +115,7 @@ findExternalFunctionIn(char *functionName, ModuleEntry *module DPRINTF(("Looking (externally) for %s in %s... ", functionName,module->name)); if (module->handle) #if SPURVM - result = ioFindExternalFunctionInAccessorDepthInto(functionName, module->handle, accessorDepthPtr); + result = ioFindExternalFunctionInMetadataInto(functionName, module->handle, metadataPtr); #else result = ioFindExternalFunctionIn(functionName, module->handle); #endif @@ -130,12 +130,12 @@ findExternalFunctionIn(char *functionName, ModuleEntry *module Lookup the given "pluginName_functionName" in the internal primitive table. If it can not be found try to look it up by using the OS dependent mechanism (see comment below). - On SPUR also get accessorDepth, hidden in functionName, if asked for. + On SPUR also get metadata, hidden after functionName, if asked for. */ static void * findInternalFunctionIn(char *functionName, char *pluginName #if SPURVM - , sqInt fnameLength, sqInt *accessorDepthPtr + , sqInt fnameLength, sqInt *metadataPtr #endif ) { @@ -166,8 +166,10 @@ findInternalFunctionIn(char *functionName, char *pluginName /* match */ DPRINTF(("found\n")); #if SPURVM - if (accessorDepthPtr) - *accessorDepthPtr = ((signed char *)function)[fnameLength+1]; + if (metadataPtr) + *metadataPtr = (SpurPrimitiveMetadataType) + ((((signed char *)function)[fnameLength+1] << 8) + + ((unsigned char *)function)[fnameLength+2]); #endif return exports[index].primitiveAddress; } @@ -179,14 +181,14 @@ findInternalFunctionIn(char *functionName, char *pluginName #if SPURVM static void * -findFunctionAndAccessorDepthIn(char *functionName, ModuleEntry *module, - sqInt fnameLength, sqInt *accessorDepthPtr) +findFunctionAndMetadataIn(char *functionName, ModuleEntry *module, + sqInt fnameLength, sqInt *metadataPtr) { return module->handle == squeakModule->handle ? findInternalFunctionIn(functionName, module->name, - fnameLength, accessorDepthPtr) + fnameLength, metadataPtr) : findExternalFunctionIn(functionName, module, - fnameLength, accessorDepthPtr); + fnameLength, metadataPtr); } #endif /* SPURVM */ @@ -389,15 +391,15 @@ ioLoadExternalFunctionOfLengthFromModuleOfLength } #if SPURVM -/* ioLoadFunctionFromAccessorDepthInto +/* ioLoadFunctionFromMetadataInto Load and return the given function from the specified plugin. Answer the function address if successful, otherwise 0. - Assign the primitive's accessor depth through accessorDepthPtr. + Assign the primitive's accessor depth and flags through metadataPtr. This entry point is called from the interpreter proxy. */ static void * -ioLoadFunctionFromAccessorDepthInto(char *functionName, char *pluginName, - sqInt fnameLength, sqInt *accessorDepthPtr) +ioLoadFunctionFromMetadataInto(char *functionName, char *pluginName, + sqInt fnameLength, sqInt *metadataPtr) { ModuleEntry *module; void *function; @@ -412,17 +414,17 @@ ioLoadFunctionFromAccessorDepthInto(char *functionName, char *pluginName, /* only the module was requested but not any specific function */ return (void *)1; /* and load the actual function */ - function = findFunctionAndAccessorDepthIn(functionName, module, fnameLength, accessorDepthPtr); + function = findFunctionAndMetadataIn(functionName, module, fnameLength, metadataPtr); return function; } -/* ioLoadExternalFunctionOfLengthFromModuleOfLengthAccessorDepthInto +/* ioLoadExternalFunctionOfLengthFromModuleOfLengthMetadataInto Entry point for functions looked up through the VM. */ void * -ioLoadExternalFunctionOfLengthFromModuleOfLengthAccessorDepthInto +ioLoadExternalFunctionOfLengthFromModuleOfLengthMetadataInto (sqInt functionNameIndex, sqInt functionNameLength, - sqInt moduleNameIndex, sqInt moduleNameLength, sqInt *accessorDepthPtr) + sqInt moduleNameIndex, sqInt moduleNameLength, sqInt *metadataPtr) { char *functionNamePointer = pointerForOop((usqInt)functionNameIndex); char *moduleNamePointer = pointerForOop((usqInt)moduleNameIndex); @@ -434,8 +436,8 @@ ioLoadExternalFunctionOfLengthFromModuleOfLengthAccessorDepthInto functionName[functionNameLength] = 0; strncpy(moduleName, moduleNamePointer, moduleNameLength); moduleName[moduleNameLength] = 0; - return ioLoadFunctionFromAccessorDepthInto - (functionName, moduleName, functionNameLength, accessorDepthPtr); + return ioLoadFunctionFromMetadataInto + (functionName, moduleName, functionNameLength, metadataPtr); } #endif /* SPURVM */ diff --git a/platforms/Cross/vm/sqSCCSVersion.h b/platforms/Cross/vm/sqSCCSVersion.h index e224fed698..c7392052e8 100644 --- a/platforms/Cross/vm/sqSCCSVersion.h +++ b/platforms/Cross/vm/sqSCCSVersion.h @@ -13,6 +13,8 @@ * 15 July 2011 */ +#include "config.h" /* this must happen before including std libraries */ + #define SCCS 0 #define RCS 0 #define CVS 0 diff --git a/platforms/Cross/vm/sqVirtualMachine.c b/platforms/Cross/vm/sqVirtualMachine.c index a86c9be0c8..6a7dc3ef58 100755 --- a/platforms/Cross/vm/sqVirtualMachine.c +++ b/platforms/Cross/vm/sqVirtualMachine.c @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #include #include #include diff --git a/platforms/Mac OS/vm/osExports.c b/platforms/Mac OS/vm/osExports.c index 59dd7553af..f074626d17 100644 --- a/platforms/Mac OS/vm/osExports.c +++ b/platforms/Mac OS/vm/osExports.c @@ -18,7 +18,7 @@ /* duh ... this is ugly */ #define XFN(export) {"", #export, (void*)export}, -#define XFND(export,depth) {"", #export "\000" depth, (void*)export}, +#define XFNDF(export,depth) {"", #export "\000" depth flags, (void*)export}, WindowPtr getSTWindow(void); void setMessageHook(eventMessageHook theHook); @@ -61,14 +61,14 @@ void *os_exports[][3] = { /* Plugin support primitives We should make these primitives a proper plugin but right now we just need the exports. */ - XFND(primitivePluginBrowserReady,"\377") + XFNDF(primitivePluginBrowserReady,"\377","\000") #ifdef ENABLE_URL_FETCH - XFND(primitivePluginRequestURLStream,"\001") - XFND(primitivePluginRequestURL,"\001") - XFND(primitivePluginPostURL,"\001") - XFND(primitivePluginRequestFileHandle,"\000") - XFND(primitivePluginDestroyRequest,"\000") - XFND(primitivePluginRequestState,"\000") + XFNDF(primitivePluginRequestURLStream,"\001","\000") + XFNDF(primitivePluginRequestURL,"\001","\000") + XFNDF(primitivePluginPostURL,"\001","\000") + XFNDF(primitivePluginRequestFileHandle,"\000","\000") + XFNDF(primitivePluginDestroyRequest,"\000","\000") + XFNDF(primitivePluginRequestState,"\000","\000") #endif {NULL, NULL, NULL} }; diff --git a/platforms/Mac OS/vm/sqMacUnixExternalPrims.c b/platforms/Mac OS/vm/sqMacUnixExternalPrims.c index a9aa3b71a5..e2adc96081 100644 --- a/platforms/Mac OS/vm/sqMacUnixExternalPrims.c +++ b/platforms/Mac OS/vm/sqMacUnixExternalPrims.c @@ -394,8 +394,8 @@ void *ioLoadModule(char *pluginName) */ #if SPURVM void * -ioFindExternalFunctionInAccessorDepthInto(char *lookupName, void *moduleHandle, - sqInt *accessorDepthPtr) +ioFindExternalFunctionInMetadataInto(char *lookupName, void *moduleHandle, + sqInt *metadataPtr) #else void * ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) @@ -431,23 +431,23 @@ ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) lookupName, moduleHandle, why); } #if SPURVM - if (fn && accessorDepthPtr) { - signed char *accessorDepthVarPtr; + if (fn && metadataPtr) { + SpurPrimitiveMetadataType *metadataVarPtr; # ifdef HAVE_SNPRINTF - snprintf(buf+strlen(buf), sizeof(buf), "AccessorDepth"); + snprintf(buf+strlen(buf), sizeof(buf), "Metadata"); # else - sprintf(buf+strlen(buf), "AccessorDepth"); + sprintf(buf+strlen(buf), "Metadata"); # endif - accessorDepthVarPtr = dlsym == NULL + metadataVarPtr = dlsym == NULL ? dlsymSqueak(moduleHandle, buf) : dlsym(moduleHandle, buf); /* The Slang machinery assumes accessor depth defaults to -1, which - * means "no accessor depth". It saves space not outputting -1 depths. + * means "no accessor depth". It saves space not outputting null metadata. */ - *accessorDepthPtr = accessorDepthVarPtr - ? *accessorDepthVarPtr - : -1; + *metadataPtr = metadataVarPtr + ? *metadataVarPtr + : NullSpurMetadata; } #endif /* SPURVM */ diff --git a/platforms/RiscOS/vm/osExports.c b/platforms/RiscOS/vm/osExports.c index a7acd42142..3ea9c85e88 100755 --- a/platforms/RiscOS/vm/osExports.c +++ b/platforms/RiscOS/vm/osExports.c @@ -28,7 +28,7 @@ #include /* duh ... this is ugly */ #define XFN(export) {"", #export, (void*)export}, -#define XFND(export,depth) {"", #export "\000" depth, (void*)export}, +#define XFNDF(export,depth) {"", #export "\000" depth flags, (void*)export}, extern void setSocketPollFunction(int spf ); void *os_exports[][3] = { XFN(setSocketPollFunction) diff --git a/platforms/iOS/vm/OSX/IconWorkspace.text b/platforms/iOS/vm/OSX/IconWorkspace.text new file mode 100644 index 0000000000..90f9bfe7bd --- /dev/null +++ b/platforms/iOS/vm/OSX/IconWorkspace.text @@ -0,0 +1,4 @@ +"This workspace has two doits. The first parses a macOS .icns file. The second concatenates the output of Image2Icon.app (brew install image2icon). Image2Icon.app takes any image and produces an iconset directory containing PNG files. The second doit creates a .icns file from these (delete the null file Image2icon.app produces)" [| f chunks | chunks := OrderedDictionary new. f := FileStream oldFileNamed: '/Users/eliot/Cog/3dicc/terf-cogvm/platforms/iOS/vm/OSX/Terf.icns'. f binary. [| pos size type | chunks at: (f next: 4) asString put: f nextInt32. [f atEnd] whileFalse: [pos := f position. type := (f next: 4) asString. size := f nextInt32. type = 'TOC ' ifTrue: [chunks at: type put: pos -> ((1 to: size - 8 / 8) collect: [:i| (f next: 4) asString -> f nextInt32])] ifFalse: [chunks at: type put: pos -> size. f skip: size - 8]]] ensure: [f close]. chunks]. "an OrderedDictionary('icns'->337372 'TOC '->8->{'ic07'->20963 . 'ic14'->185621 . 'ic08'->63373 . 'ic11'->3167 . 'is32'->539 . 's8mk'->264 . 'ic13'->63373} 'ic07'->72->20963 'ic14'->21035->185621 'ic08'->206656->63373 'ic11'->270029->3167 'is32'->273196->539 's8mk'->273735->264 'ic13'->273999->63373 ) " + +"See https://en.wikipedia.org/wiki/Apple_Icon_Image_format" +"ic07:128x128 icon in JPEG 2000 or PNG format ic14:256x256@2x ''retina'' icon in JPEG 2000 or PNG format ic08:256×256 icon in JPEG 2000 or PNG format ic11:16x16@2x ''retina'' icon in JPEG 2000 or PNG format is32:16×16 24-bit icon s8mk:16x16 8-bit mask ic13:128x128@2x ''retina'' icon in JPEG 2000 or PNG format" [| dir typeMap map toc size out | typeMap := Dictionary newFromPairs: #('16x16' 'icp4' '16x16@2x' 'ic11' '32x32' 'icp5' '32x32@2x' 'ic12' '128x128' 'ic07' '128x128@2x' 'ic13' '256x256' 'ic08' '256x256@2x' 'ic14' '512x512' 'ic09' '512x512@2x' 'ic10'). map := Dictionary new. dir := FileDirectory on: '/Users/eliot/Cog/3dicc/virtend-vm/platforms/iOS/vm/OSX/Virtend/icon.iconset'. dir fileNames do: [:fn| map at: (typeMap at: ((FileDirectory baseNameFor: fn) allButFirst: 5)) put: fn]. toc := #('ic10' 'ic09' 'ic14' 'ic08' 'ic13' 'ic07' 'ic11' 'icp4'). size := dir fileNames inject: 8 + (toc size + 1 * 8) into: [:total :fn| total + (dir entryAt: fn) fileSize]. out := FileStream forceNewFileNamed: '/Users/eliot/Cog/3dicc/virtend-vm/platforms/iOS/vm/OSX/Virtend.icns'. [out binary. out nextPutAll: 'icns' asByteArray; nextInt32Put: size; nextPutAll: 'TOC ' asByteArray; nextInt32Put: toc size + 1 * 8. toc do: [:content| out nextPutAll: content asByteArray; nextInt32Put: ((dir entryAt: (map at: content)) fileSize)]. toc do: [:content| out nextPutAll: content asByteArray; nextInt32Put: ((dir entryAt: (map at: content)) fileSize + 8); nextPutAll: (dir oldFileNamed: (map at: content)) binary contentsOfEntireFile]] ensure: [out close]] \ No newline at end of file diff --git a/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m b/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m index 1c2469366b..a2eaf2450e 100644 --- a/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m +++ b/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m @@ -43,6 +43,7 @@ #import "sqSqueakOSXInfoPlistInterface.h" #import "SqueakOSXAppDelegate.h" #import "sq.h" +#import "sqAssert.h" extern SqueakOSXAppDelegate *gDelegateApp; #define thePListInterface ((sqSqueakOSXInfoPlistInterface *)gDelegateApp.squeakApplication.infoPlistInterfaceLogic) @@ -102,10 +103,14 @@ if ((handle = dlopen(libName, RTLD_NOW | RTLD_GLOBAL))) return handle; why = dlerror(); +#if PRINT_DL_ERRORS // In practice these reasons are too important to hide + fprintf(stderr, "ioLoadModule(%s):\t%s\n", libName, why); +#else if (thePListInterface.SqueakDebug) fprintf(stderr, "ioLoadModule(%s):\n %s\n", libName, why); else if (strstr(why,"undefined symbol")) fprintf(stderr, "tryLoadingInternals: dlopen: %s\n", why); +#endif } return NULL; } @@ -186,23 +191,51 @@ static void * tryLoadingLinked(char *libName) { + struct stat buf; + void *handle; + #if !PharoVM if (thePListInterface.SqueakPluginsBuiltInOrLocalOnly) return NULL; #endif - void *handle = dlopen(libName, RTLD_NOW | RTLD_GLOBAL); - DPRINTF((stderr, __FILE__ " %d tryLoadingLinked dlopen(%s) = %p\n", __LINE__, libName, handle)); +#if 0 // This seems like the right thing to do but it breaks ioLoadModule + // ioLoadModule for system dylibs found along the system path(2). + // Instead, filter-out noise errors below + if (stat(libName, &buf)) { + dprintf((stderr, "tryLoadingLinked(%s) does not exist\n", libName)); + return 0; + } + else if (S_ISDIR(buf.st_mode)) { + dprintf((stderr, "tryLoadingLinked(%s) is a directory\n", libName)); + return 0; + } +#endif + + handle = dlopen(libName, RTLD_NOW | RTLD_GLOBAL); #if DEBUG if (handle) printf("%s: loaded plugin `%s'\n", exeName, libName); #endif if (!handle) { const char *why = dlerror(); + // filter out failures due to non-existent libraries + if (stat(libName, &buf)) { + dprintf((stderr, "tryLoadingLinked(%s) does not exist\n", libName)); + return 0; + } + else if (S_ISDIR(buf.st_mode)) { + dprintf((stderr, "tryLoadingLinked(%s) is a directory\n", libName)); + return 0; + } +#if PRINT_DL_ERRORS // In practice these reasons are too important to hide + fprintf(stderr, "tryLoadingLinked(%s):\t%s\n", libName, why); +#else if (thePListInterface.SqueakDebug) fprintf(stderr, "tryLoadingLinked(%s):\n %s\n", libName, why); else if (strstr(why,"undefined symbol")) fprintf(stderr, "tryLoadingLinked: dlopen: %s\n", why); +#endif } return handle; } @@ -226,7 +259,11 @@ handle = dlopen(0, RTLD_NOW | RTLD_GLOBAL); if (!handle) { char * why = dlerror(); +#if PRINT_DL_ERRORS // In practice these reasons are too important to hide + fprintf(stderr, "ioLoadModule(): %s\n", why); +#else dprintf((stderr, "ioLoadModule(): %s\n", why)); +#endif return NULL; } dprintf((stderr, "loaded: \n")); @@ -357,8 +394,8 @@ */ #if SPURVM void * -ioFindExternalFunctionInAccessorDepthInto(char *lookupName, void *moduleHandle, - sqInt *accessorDepthPtr) +ioFindExternalFunctionInMetadataInto(char *lookupName, void *moduleHandle, + sqInt *metadataPtr) #else void * ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) @@ -378,18 +415,19 @@ lookupName, moduleHandle, dlerror()); #if SPURVM - if (fn && accessorDepthPtr) { + if (fn && metadataPtr) { char buf[NAME_MAX+1]; - signed char *accessorDepthVarPtr; + SpurPrimitiveMetadataType *metadataVarPtr; - snprintf(buf, sizeof(buf), "%sAccessorDepth", lookupName); - accessorDepthVarPtr = dlsym(moduleHandle, buf); + snprintf(buf, sizeof(buf), "%sMetadata", lookupName); + metadataVarPtr = dlsym(moduleHandle, buf); /* The Slang machinery assumes accessor depth defaults to -1, which - * means "no accessor depth". It saves space not outputting -1 depths. + * means "no accessor depth". It saves space not outputting null metadata. */ - *accessorDepthPtr = accessorDepthVarPtr - ? *accessorDepthVarPtr - : -1; + *metadataPtr = metadataVarPtr + ? *metadataVarPtr + : NullSpurMetadata; + assert(validSpurPrimitiveMetadata(*metadataPtr)); } #endif /* SPURVM */ @@ -405,6 +443,10 @@ sqInt ioFreeModule(void *moduleHandle) return 1; char *why = dlerror(); +#if PRINT_DL_ERRORS // In practice these reasons are too important to hide + fprintf(stderr, "ioFreeModule(%ld): %s\n", (long) moduleHandle, why); +#else dprintf((stderr, "ioFreeModule(%ld): %s\n", (long) moduleHandle, why)); +#endif return 0; } diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m b/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m index a5b337f31a..c097385af7 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m @@ -54,7 +54,7 @@ sqInt dropShutdown(void) { char *dropRequestFileName(sqInt dropIndex) { NSURL *dragURIAtIndex = [gDelegateApp dragURIAtIndex: dropIndex]; - if(!dragURIAtIndex || !dragURIAtIndex.fileURL) + if (!dragURIAtIndex || !dragURIAtIndex.fileURL) return NULL; return (char *) [dragURIAtIndex.path UTF8String]; @@ -62,7 +62,7 @@ sqInt dropShutdown(void) { char *dropRequestURI(sqInt dropIndex) { NSURL *dragURIAtIndex = [gDelegateApp dragURIAtIndex: dropIndex]; - if(!dragURIAtIndex) + if (!dragURIAtIndex) return NULL; return (char *) [dragURIAtIndex.absoluteString UTF8String]; @@ -75,10 +75,10 @@ sqInt dropRequestFileHandle(sqInt dropIndex) { char *fileName = dropRequestFileName(dropIndex); if (!fileName) - return 0; + return interpreterProxy->nilObject(); void *fn = interpreterProxy->ioLoadFunctionFrom("fileOpenNamesizewritesecure", "FilePlugin"); - if (fn == NULL) { + if (!fn) { /* begin primitiveFail */ interpreterProxy->success(false); return 0; diff --git a/platforms/minheadless/common/sqExternalPrimitives.c b/platforms/minheadless/common/sqExternalPrimitives.c index c9a7fd1481..22426d0fea 100644 --- a/platforms/minheadless/common/sqExternalPrimitives.c +++ b/platforms/minheadless/common/sqExternalPrimitives.c @@ -33,6 +33,7 @@ #include #include "sq.h" +#include "sqAssert.h" int sqVMOptionTraceModuleLoading = 0; @@ -140,8 +141,8 @@ ioFreeModule(void *moduleHandle) #if SPURVM void * -ioFindExternalFunctionInAccessorDepthInto(char *lookupName, void *moduleHandle, - sqInt *accessorDepthPtr) +ioFindExternalFunctionInMetadataInto(char *lookupName, void *moduleHandle, + sqInt *metadataPtr) #else void * ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) @@ -155,20 +156,20 @@ ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) function = getModuleSymbol(moduleHandle, lookupName); #if SPURVM - if (function && accessorDepthPtr) - { + if (function && metadataPtr) { char buf[256]; - signed char *accessorDepthVarPtr; + SpurPrimitiveMetadataType *metadataVarPtr; strcpy(buf, lookupName); - snprintf(buf+strlen(buf), sizeof(buf) - strlen(buf), "AccessorDepth"); - accessorDepthVarPtr = getModuleSymbol(moduleHandle, buf); + snprintf(buf+strlen(buf), sizeof(buf) - strlen(buf), "Metadata"); + metadataVarPtr = getModuleSymbol(moduleHandle, buf); /* The Slang machinery assumes accessor depth defaults to -1, which - * means "no accessor depth". It saves space not outputting -1 depths. + * means "no accessor depth". It saves space not outputting null metadata. */ - *accessorDepthPtr = accessorDepthVarPtr - ? *accessorDepthVarPtr - : -1; + *metadataPtr = metadataVarPtr + ? *metadataVarPtr + : NullSpurMetadata; + assert(validSpurPrimitiveMetadata(*metadataPtr)); } #endif /* SPURVM */ return function; diff --git a/platforms/minheadless/sdl2-window/sqWindow-SDL2.c b/platforms/minheadless/sdl2-window/sqWindow-SDL2.c index b4a42f20b4..2141fbdadb 100644 --- a/platforms/minheadless/sdl2-window/sqWindow-SDL2.c +++ b/platforms/minheadless/sdl2-window/sqWindow-SDL2.c @@ -1109,13 +1109,13 @@ primitiveSetVMSDL2Input() } #define XFN(export) {"", #export, (void*)export}, -#define XFND(export,depth) {"", #export "\000" depth, (void*)export}, +#define XFNDF(export,depth) {"", #export "\000" depth flags, (void*)export}, static void *sdl2_exports[][3]= { - XFND(primitiveIsVMDisplayUsingSDL2, "\001") - XFND(primitivePollVMSDL2Event, "\001") - XFND(primitiveSetVMSDL2Input, "\001") + XFNDF(primitiveIsVMDisplayUsingSDL2, "\001","\000") + XFNDF(primitivePollVMSDL2Event, "\001","\000") + XFNDF(primitiveSetVMSDL2Input, "\001","\000") { 0, 0, 0 } }; diff --git a/platforms/minheadless/unix/sqImageFileAccess.h b/platforms/minheadless/unix/sqImageFileAccess.h index d32834a806..ad521eafbf 100644 --- a/platforms/minheadless/unix/sqImageFileAccess.h +++ b/platforms/minheadless/unix/sqImageFileAccess.h @@ -15,13 +15,13 @@ #include #include -/* On Unix we use the native file interface. */ +// On Unix we use the native file interface. #define sqImageFile int #define squeakFileOffsetType off_t -/* Save/restore. */ -/* Read the image from the given file starting at the given image offset */ +// Save/restore. +// Read the image from the given file starting at the given image offset size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset); static inline sqImageFile @@ -40,6 +40,11 @@ sqImageFileOpen(const char *fileName, const char *mode) static inline void sqImageFileClose(sqImageFile f) { +extern sqInt failed(void); + + if (!failed() + && ftruncate(f,lseek(f, 0, SEEK_CUR)) < 0) + perror("sqImageFileClose ftruncate"); /* Don't exit; if snapshotting, continuing is probably the best course */ if (close(f) < 0) perror("sqImageFileClose close"); diff --git a/platforms/unix/config/getversion.c b/platforms/unix/config/getversion.c index 0fdadb0f83..73a1fe47e3 100644 --- a/platforms/unix/config/getversion.c +++ b/platforms/unix/config/getversion.c @@ -1,3 +1,2 @@ #define VERSION_PROGRAM 1 - #include "sqSCCSVersion.h" diff --git a/platforms/unix/plugins/BochsIA32Plugin/Makefile.inc b/platforms/unix/plugins/BochsIA32Plugin/Makefile.inc index c50c68f223..7c0d138b2f 100644 --- a/platforms/unix/plugins/BochsIA32Plugin/Makefile.inc +++ b/platforms/unix/plugins/BochsIA32Plugin/Makefile.inc @@ -1,4 +1,4 @@ -XCPPFLAGS= -DUSE_BOCHS_CONFIG_H=1 \ +XCPPFLAGS= -fPIC -DUSE_BOCHS_CONFIG_H=1 \ -I../../../bochsx86 \ -I$(topdir)/processors/IA32/bochs \ -I$(topdir)/processors/IA32/bochs/instrument/stubs diff --git a/platforms/unix/plugins/BochsX64Plugin/Makefile.inc b/platforms/unix/plugins/BochsX64Plugin/Makefile.inc index 58c5ecd542..0dd0e4c5d2 100644 --- a/platforms/unix/plugins/BochsX64Plugin/Makefile.inc +++ b/platforms/unix/plugins/BochsX64Plugin/Makefile.inc @@ -1,4 +1,4 @@ -XCPPFLAGS= -DUSE_BOCHS_CONFIG_H=1 \ +XCPPFLAGS= -fPIC -DUSE_BOCHS_CONFIG_H=1 \ -I../../../bochsx64 \ -I$(topdir)/processors/IA32/bochs \ -I$(topdir)/processors/IA32/bochs/instrument/stubs diff --git a/platforms/unix/plugins/FileAttributesPlugin/faSupport.c b/platforms/unix/plugins/FileAttributesPlugin/faSupport.c index 2d73af10ee..6361a0314e 100644 --- a/platforms/unix/plugins/FileAttributesPlugin/faSupport.c +++ b/platforms/unix/plugins/FileAttributesPlugin/faSupport.c @@ -2,6 +2,9 @@ * faSupport.c - Unix support routines for the FileAttributesPlugin * */ +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif #include #include #include diff --git a/platforms/unix/plugins/VectorEnginePlugin/Makefile.inc b/platforms/unix/plugins/VectorEnginePlugin/Makefile.inc new file mode 100644 index 0000000000..629603c62f --- /dev/null +++ b/platforms/unix/plugins/VectorEnginePlugin/Makefile.inc @@ -0,0 +1,3 @@ +# Disable compiler optimization. Adding this to XCFLAGS will effectively +# override any previous definition of -O in CFLAGS +XCFLAGS=$(X_CFLAGS) -O0 diff --git a/platforms/unix/vm-display-X11/sqUnixX11.c b/platforms/unix/vm-display-X11/sqUnixX11.c index a59eb0e013..f26f71be51 100644 --- a/platforms/unix/vm-display-X11/sqUnixX11.c +++ b/platforms/unix/vm-display-X11/sqUnixX11.c @@ -6782,31 +6782,37 @@ int openXDisplay(void) return 0; } -int forgetXDisplay(void) -{ - /* Initialise variables related to the X connection, and - make the existing connection to the X Display invalid - for any further access from this Squeak image. Any socket - connection to the X server is closed, but the server is - not told to terminate any windows or X sessions. This - is used to support fork() for an existing Squeak image, - where the child is expected to continue as a headless - image, and the parent continues its normal execution. */ +static void clearXDisplayVariables() +{ displayName= 0; /* name of display, or 0 for $DISPLAY */ stDisplay= null; /* Squeak display */ - if (isConnectedToXServer) - { - if (stXfd >= 0) - aioDisable(stXfd); - close(stXfd); - } stXfd= -1; /* X connection file descriptor */ stParent= null; stWindow= null; /* Squeak window */ inputContext= 0; inputFont= NULL; isConnectedToXServer= 0; +} + + +/* Initialise variables related to the X connection, and make the existing + * connection to the X Display invalid for any further access from this + * Squeak image. Any socket connection to the X server is closed, but the + * server is not told to terminate any windows or X sessions. This is + * used to support fork() for an existing Squeak image, where the child + * is expected to continue as a headless image, and the parent continues + * its normal execution. + */ +int forgetXDisplay(void) +{ + if (isConnectedToXServer) + { + if (stXfd >= 0) + aioDisable(stXfd); + close(stXfd); + clearXDisplayVariables(); + } return 0; } @@ -6828,9 +6834,11 @@ int disconnectXDisplay(void) } if (inputFont) XFreeFontSet(stDisplay, inputFont); + if (stXfd >= 0) + aioDisable(stXfd); XCloseDisplay(stDisplay); + clearXDisplayVariables(); } - forgetXDisplay(); return 0; } diff --git a/platforms/unix/vm/aio.c b/platforms/unix/vm/aio.c index a7ff84464f..d4686dd23d 100644 --- a/platforms/unix/vm/aio.c +++ b/platforms/unix/vm/aio.c @@ -30,20 +30,20 @@ * Last edited: Tue Mar 29 13:06:00 PDT 2016 */ -#include "interp.h" /* For COGVM define */ -#include "sqaio.h" -#include "sqAssert.h" -#include - #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" /* this must happen before including std libraries */ # ifdef HAVE_UNISTD_H # include # include # endif /* HAVE_UNISTD_H */ +#include "interp.h" /* For COGVM define */ +#include "sqaio.h" +#include "sqAssert.h" +#include + # ifdef NEED_GETHOSTNAME_P extern int gethostname(); # endif @@ -113,7 +113,7 @@ long aioDebugLogging = 0; #endif #if HAVE_CONFIG_H && HAVE_EPOLL -static int epollFd; +static int epollFd= -1; static struct epoll_event** epollEventsByFileDescriptor; static size_t epollEventsByFileDescriptorSize; @@ -230,13 +230,12 @@ growEpollEventsByFileDescriptorTo(size_t newSize) { memset(epollEventsByFileDescriptor + epollEventsByFileDescriptorSize, 0, (newSize - epollEventsByFileDescriptorSize) * sizeof(*epollEventsByFileDescriptor)); epollEventsByFileDescriptorSize = newSize; } -#endif -void -aioInit(void) +static void +epollInit(void) { - extern void forceInterruptCheck(int); /* not really, but hey */ -#if HAVE_CONFIG_H && HAVE_EPOLL + if (epollFd >= 0) + close(epollFd); epollFd = epoll_create1(EPOLL_CLOEXEC); if (epollFd == -1) { perror("epoll_create1 failed"); @@ -244,6 +243,18 @@ aioInit(void) } epollEventsByFileDescriptorSize = 0; epollEventsByFileDescriptor = NULL; +} +#endif + + +void +aioInit(void) +{ + extern void forceInterruptCheck(int); /* not really, but hey */ +#if HAVE_CONFIG_H && HAVE_EPOLL + epollInit(); + if (pthread_atfork(NULL, NULL, epollInit)) + perror("pthread_atfork"); #else FD_ZERO(&fdMask); FD_ZERO(&rdMask); diff --git a/platforms/unix/vm/osExports.c b/platforms/unix/vm/osExports.c index fddb23d11f..5583a2ebbc 100755 --- a/platforms/unix/vm/osExports.c +++ b/platforms/unix/vm/osExports.c @@ -1,7 +1,7 @@ #include "sqMemoryAccess.h" #define XFN(export) {"", #export, (void*)export}, -#define XFND(export,depth) {"", #export "\000" depth, (void*)export}, +#define XFNDF(export,depth,flags) {"", #export "\000" depth flags, (void*)export}, char * GetAttributeString(sqInt id); #if !defined(HEADLESS) @@ -20,13 +20,13 @@ void *os_exports[][3]= { XFN(GetAttributeString) #if !defined(HEADLESS) - XFND(primitivePluginBrowserReady,"\377") - XFND(primitivePluginRequestURLStream,"\001") - XFND(primitivePluginRequestURL,"\001") - XFND(primitivePluginPostURL,"\001") - XFND(primitivePluginRequestFileHandle,"\000") - XFND(primitivePluginDestroyRequest,"\000") - XFND(primitivePluginRequestState,"\000") + XFNDF(primitivePluginBrowserReady,"\377","\000") + XFNDF(primitivePluginRequestURLStream,"\001","\000") + XFNDF(primitivePluginRequestURL,"\001","\000") + XFNDF(primitivePluginPostURL,"\001","\000") + XFNDF(primitivePluginRequestFileHandle,"\000","\000") + XFNDF(primitivePluginDestroyRequest,"\000","\000") + XFNDF(primitivePluginRequestState,"\000","\000") XFN(ioGetDisplay) XFN(ioGetWindow) #endif diff --git a/platforms/unix/vm/sqImageFileAccess.h b/platforms/unix/vm/sqImageFileAccess.h index d32834a806..a6b7b35051 100644 --- a/platforms/unix/vm/sqImageFileAccess.h +++ b/platforms/unix/vm/sqImageFileAccess.h @@ -15,20 +15,22 @@ #include #include -/* On Unix we use the native file interface. */ +// On Unix we use the native file interface. #define sqImageFile int #define squeakFileOffsetType off_t -/* Save/restore. */ -/* Read the image from the given file starting at the given image offset */ +// Save/restore. +// Read the image from the given file starting at the given image offset size_t readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset); +static int sIFOMode; + static inline sqImageFile sqImageFileOpen(const char *fileName, const char *mode) { int fd = open(fileName, - !strcmp(mode,"rb") ? O_RDONLY : O_RDWR+O_CREAT, + sIFOMode = !strcmp(mode,"rb") ? O_RDONLY : O_RDWR+O_CREAT, 0666); if (fd < 0) { perror("sqImageFileOpen open"); @@ -40,6 +42,12 @@ sqImageFileOpen(const char *fileName, const char *mode) static inline void sqImageFileClose(sqImageFile f) { +extern sqInt failed(void); + + if (!failed() + && sIFOMode == O_RDWR+O_CREAT + && ftruncate(f,lseek(f, 0, SEEK_CUR)) < 0) + perror("sqImageFileClose ftruncate"); /* Don't exit; if snapshotting, continuing is probably the best course */ if (close(f) < 0) perror("sqImageFileClose close"); diff --git a/platforms/unix/vm/sqUnixExternalPrims.c b/platforms/unix/vm/sqUnixExternalPrims.c index fbf3c926ec..a2bf7956b4 100644 --- a/platforms/unix/vm/sqUnixExternalPrims.c +++ b/platforms/unix/vm/sqUnixExternalPrims.c @@ -431,8 +431,8 @@ ioLoadModule(char *pluginName) */ #if SPURVM void * -ioFindExternalFunctionInAccessorDepthInto(char *lookupName, void *moduleHandle, - sqInt *accessorDepthPtr) +ioFindExternalFunctionInMetadataInto(char *lookupName, void *moduleHandle, + sqInt *metadataPtr) #else void * ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) @@ -463,17 +463,18 @@ ioFindExternalFunctionIn(char *lookupName, void *moduleHandle) } #if SPURVM - if (fn && accessorDepthPtr) { - signed char *accessorDepthVarPtr; + if (fn && metadataPtr) { + SpurPrimitiveMetadataType *metadataVarPtr; - snprintf(buf+strlen(buf), sizeof(buf) - strlen(buf), "AccessorDepth"); - accessorDepthVarPtr = dlsym(moduleHandle, buf); + snprintf(buf+strlen(buf), sizeof(buf) - strlen(buf), "Metadata"); + metadataVarPtr = dlsym(moduleHandle, buf); /* The Slang machinery assumes accessor depth defaults to -1, which - * means "no accessor depth". It saves space not outputting -1 depths. + * means "no accessor depth". It saves space not outputting null metadata. */ - *accessorDepthPtr = accessorDepthVarPtr - ? *accessorDepthVarPtr - : -1; + *metadataPtr = metadataVarPtr + ? *metadataVarPtr + : NullSpurMetadata; + assert(validSpurPrimitiveMetadata(*metadataPtr)); } #endif /* SPURVM */ diff --git a/platforms/unix/vm/sqUnixHeartbeat.c b/platforms/unix/vm/sqUnixHeartbeat.c index 3c1ae46d2e..da6d4f89d0 100644 --- a/platforms/unix/vm/sqUnixHeartbeat.c +++ b/platforms/unix/vm/sqUnixHeartbeat.c @@ -182,7 +182,7 @@ ioHighResClock(void) : : "rdx"); #elif defined(__ARM_ARCH_ISA_A64) || defined(__arm64__) || defined(__aarch64__) || defined(ARM64) - __asm__ __volatile__ ("MRS X0, CNTVCT_EL0"); + __asm__ __volatile__ ("MRS %0, CNTVCT_EL0" : "=r"(value)); #elif defined(__arm__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__)) /* tpr - do nothing for now; needs input from eliot to decide further */ /* Tim, not sure I have input beyond: diff --git a/platforms/unix/vm/sqUnixMemory.c b/platforms/unix/vm/sqUnixMemory.c index b8b7f350b1..17d5343a26 100644 --- a/platforms/unix/vm/sqUnixMemory.c +++ b/platforms/unix/vm/sqUnixMemory.c @@ -427,7 +427,7 @@ allocateJITMemory(usqInt *desiredSize) exit(1); } // Note the address for sqAllocateMemory above - endOfJITZone = (char *)result + *desiredSize; + // endOfJITZone = (char *)result + *desiredSize; return result; } diff --git a/platforms/unix/vm/sqUnixSpurMemory.c b/platforms/unix/vm/sqUnixSpurMemory.c index fcb7f23273..1309ea0a10 100644 --- a/platforms/unix/vm/sqUnixSpurMemory.c +++ b/platforms/unix/vm/sqUnixSpurMemory.c @@ -201,7 +201,7 @@ sqDeallocateMemorySegmentAtOfSize(void *addr, sqInt sz) * To cope with modern OSs that disallow executing code in writable memory we * dual-map the code zone, one mapping with read/write permissions and the other * with read/execute permissions. In such a configuration the code zone has - * already been alloated and is not included in (what is no longer) the initial + * already been allocated and is not included in (what is no longer) the initial * alloc. */ static void @@ -254,6 +254,10 @@ sqMakeMemoryExecutableFromToCodeToDataDelta(usqInt startAddr, PROT_READ | PROT_EXEC) < 0) perror("mprotect(x,y,PROT_READ | PROT_EXEC)"); +# elif defined(MAP_JIT) + + assert(!codeToDataDelta); + # else /* DUAL_MAPPED_CODE_ZONE */ if (mprotect((void *)firstPage, @@ -283,7 +287,11 @@ allocateJITMemory(usqInt *desiredSize) *desiredSize = roundUpToPage(*desiredSize); result = mmap(hint, *desiredSize, +#if DUAL_MAPPED_CODE_ZONE + PROT_READ | PROT_EXEC, +#else PROT_READ | PROT_WRITE | PROT_EXEC, +#endif MAP_FLAGS | MAP_JIT, -1, 0); if (result == MAP_FAILED) { perror("Could not allocate JIT memory"); diff --git a/platforms/unix/vm/sqUnixVMProfile.c b/platforms/unix/vm/sqUnixVMProfile.c index 442488e1c8..609c17212a 100644 --- a/platforms/unix/vm/sqUnixVMProfile.c +++ b/platforms/unix/vm/sqUnixVMProfile.c @@ -13,7 +13,10 @@ * August 5th, 2008, EEM wrote pc sampling code * *****************************************************************************/ - +#ifdef HAVE_CONFIG_H +#include "config.h" /* this must happen before including std libraries */ +#endif + #if NO_VM_PROFILE #include "sq.h" diff --git a/platforms/win32/vm/sqPlatformSpecific.h b/platforms/win32/vm/sqPlatformSpecific.h index 189f1f1917..6771838913 100755 --- a/platforms/win32/vm/sqPlatformSpecific.h +++ b/platforms/win32/vm/sqPlatformSpecific.h @@ -35,6 +35,7 @@ typedef unsigned __int64 squeakFileOffsetType; * The MSVC version of these is, as of this writing, _fseeki64 & _ftelli64. * Some cross-platform plugins use fseeko/ftello, hence this patch... */ +#include /* note: stdio.h must be included before defining ftello/fseeko */ #define fseeko(a,b,c) _fseeki64(a,b,c) #define ftello(f) _ftelli64(f) diff --git a/platforms/win32/vm/sqWin32Exports.c b/platforms/win32/vm/sqWin32Exports.c index 04b320275c..37d0fba0fe 100644 --- a/platforms/win32/vm/sqWin32Exports.c +++ b/platforms/win32/vm/sqWin32Exports.c @@ -26,7 +26,7 @@ extern void* preMessageHook; extern int fUseOpenGL; #define XFN(export) {"", #export, (void*)export}, -#define XFND(export,depth) {"", #export "\000" depth, (void*)export}, +#define XFNDF(export,depth,flags) {"", #export "\000" depth flags, (void*)export}, #define XVAR(export) {"", #export, &export}, void *os_exports[][3] = { @@ -39,14 +39,14 @@ void *os_exports[][3] = { #ifndef NO_NETWORK XFN(win32DebugPrintSocketState) #endif - XFND(primitivePluginBrowserReady,"\377") - XFND(primitivePluginRequestURLStream,"\001") - XFND(primitivePluginRequestURL,"\001") - XFND(primitivePluginPostURL,"\001") - XFND(primitivePluginRequestFileHandle,"\000") - XFND(primitivePluginDestroyRequest,"\000") - XFND(primitivePluginRequestState,"\000") - XFND(primitiveDnsInfo,"\377") + XFNDF(primitivePluginBrowserReady,"\377","\000") + XFNDF(primitivePluginRequestURLStream,"\001","\000") + XFNDF(primitivePluginRequestURL,"\001","\000") + XFNDF(primitivePluginPostURL,"\001","\000") + XFNDF(primitivePluginRequestFileHandle,"\000","\000") + XFNDF(primitivePluginDestroyRequest,"\000","\000") + XFNDF(primitivePluginRequestState,"\000","\000") + XFNDF(primitiveDnsInfo,"\377","\000") XFN(printf) XVAR(stWindow) XVAR(firstMessageHook) diff --git a/platforms/win32/vm/sqWin32ExternalPrims.c b/platforms/win32/vm/sqWin32ExternalPrims.c index d76c468068..e91e97b8eb 100644 --- a/platforms/win32/vm/sqWin32ExternalPrims.c +++ b/platforms/win32/vm/sqWin32ExternalPrims.c @@ -14,8 +14,8 @@ #include #include -#include #include "sq.h" +#include "sqAssert.h" static HANDLE tryLoading(TCHAR *prefix, TCHAR *baseName, TCHAR *postfix) @@ -77,23 +77,24 @@ ioLoadModule(char *pluginName) #if SPURVM void * -ioFindExternalFunctionInAccessorDepthInto(char *lookupName, void *moduleHandle, - sqInt *accessorDepthPtr) +ioFindExternalFunctionInMetadataInto(char *lookupName, void *moduleHandle, + sqInt *metadataPtr) { void *f; char buffer[256]; f = GetProcAddress(moduleHandle, lookupName); - if (f && accessorDepthPtr) { - void *accessorDepthVarPtr; - snprintf(buffer,256,"%sAccessorDepth",lookupName); - accessorDepthVarPtr = GetProcAddress(moduleHandle, buffer); + if (f && metadataPtr) { + void *metadataVarPtr; + snprintf(buffer,256,"%sMetadata",lookupName); + metadataVarPtr = GetProcAddress(moduleHandle, buffer); /* The Slang machinery assumes accessor depth defaults to -1, which - * means "no accessor depth". It saves space not outputting -1 depths. + * means "no accessor depth". It saves space not outputting null metadata. */ - *accessorDepthPtr = accessorDepthVarPtr - ? *(signed char *)accessorDepthVarPtr - : -1; + *metadataPtr = metadataVarPtr + ? *(SpurPrimitiveMetadataType *)metadataVarPtr + : NullSpurMetadata; + assert(validSpurPrimitiveMetadata(*metadataPtr)); } return f; } diff --git a/processors/ARM/gdb-8.3.1/sim/aarch64/sim-main.h b/processors/ARM/gdb-8.3.1/sim/aarch64/sim-main.h index 63ad0941dd..972f96e4e7 100644 --- a/processors/ARM/gdb-8.3.1/sim/aarch64/sim-main.h +++ b/processors/ARM/gdb-8.3.1/sim/aarch64/sim-main.h @@ -45,6 +45,9 @@ struct _sim_cpu uint64_t tpidr; /* Thread pointer id. */ +#if COG + uint64_t cntvct; +#endif sim_cpu_base base; }; diff --git a/processors/ARM/gdb-8.3.1/sim/aarch64/simulator.c b/processors/ARM/gdb-8.3.1/sim/aarch64/simulator.c index d07f2d01ef..e29a4ea6a4 100644 --- a/processors/ARM/gdb-8.3.1/sim/aarch64/simulator.c +++ b/processors/ARM/gdb-8.3.1/sim/aarch64/simulator.c @@ -14238,6 +14238,10 @@ dexSystem (sim_cpu *cpu) do_MSR_reg (cpu); else if (INSTR (21, 19) == 0 && INSTR (15, 12) == 0x4) do_MSR_immediate (cpu); +#if COG // MRS , CNTVCT_EL0 (Counter-timer Virtual Count reg) p D13-3774 + else if (INSTR (21, 19) == 7 && INSTR (15, 12) == 0xE && rt < 31) + cpu->gr[rt].u64 = cpu->cntvct; +#endif else HALT_NYI; return; @@ -14371,6 +14375,7 @@ aarch64_step (sim_cpu *cpu) aarch64_set_next_PC (cpu, pc + 4); #if COG + cpu->cntvct++; aarch64_get_instr (cpu) = aarch64_get_mem_u32(cpu, pc); #else /* Code is always little-endian. */ diff --git a/processors/ARM/gdb-8.3.1/sim/arm/armos.c b/processors/ARM/gdb-8.3.1/sim/arm/armos.c index 05a51b1a2a..0e98e4ab35 100644 --- a/processors/ARM/gdb-8.3.1/sim/arm/armos.c +++ b/processors/ARM/gdb-8.3.1/sim/arm/armos.c @@ -406,7 +406,7 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) state->EndCondition = InstructionPrefetchError; // during execution, the pc points the next fetch address, which is 8 byte after the current instruction. - gdb_log_printf(NULL, "Illegal Instruction fetch address (%#p).", state->Reg[15]-8); + // gdb_log_printf(NULL, "Illegal Instruction fetch address (%#p).", state->Reg[15]-8); return TRUE; // escape immediately break; #endif diff --git a/processors/ARM/gdb-8.3.1/sim/arm/armulmem.c b/processors/ARM/gdb-8.3.1/sim/arm/armulmem.c index fe1ec96b41..a47c41e327 100755 --- a/processors/ARM/gdb-8.3.1/sim/arm/armulmem.c +++ b/processors/ARM/gdb-8.3.1/sim/arm/armulmem.c @@ -13,6 +13,7 @@ */ #if COG # include "GdbARMPlugin.h" +extern uintptr_t minReadAddress, minWriteAddress; #endif /* armvirt.c -- ARMulator virtual memory interace: ARM6 Instruction Emulator. @@ -77,18 +78,14 @@ int SWI_vector_installed = FALSE; static ARMword GetWord (ARMul_State * state, ARMword address, int check) { - if(address < minReadAddress || address + 4 > (state->MemSize)) - { + if (address < minReadAddress || address + 4 > (state->MemSize)) { //raise memory access error state->EndCondition = MemoryBoundsError; state->Emulate = FALSE; - gdb_log_printf(NULL, "Illegal memory read at %#p. ", address); + // gdb_log_printf(NULL, "Illegal memory read at %#p. ", address); return 0; } - else - { - return *((ARMword*) (state->MemDataPtr + (address & ~3))); - } + return *((ARMword*) (state->MemDataPtr + (address & ~3))); } /***************************************************************************\ @@ -98,16 +95,13 @@ GetWord (ARMul_State * state, ARMword address, int check) static void PutWord (ARMul_State * state, ARMword address, ARMword data, int check) { - if(address < minWriteAddress || address + 4 > (state->MemSize)) - { + if (address < minWriteAddress || address + 4 > (state->MemSize)) { state->Emulate = FALSE; state->EndCondition = MemoryBoundsError; - gdb_log_printf(NULL, "Illegal memory write at %#p. ", address); + // gdb_log_printf(NULL, "Illegal memory write at %#p. ", address); } else - { *((ARMword*) (state->MemDataPtr + (address & ~3))) = data; - } } /***************************************************************************\ diff --git a/processors/IA32/bochs/config.guess b/processors/IA32/bochs/config.guess index ed2e03b7f2..4cd9454b35 100755 --- a/processors/IA32/bochs/config.guess +++ b/processors/IA32/bochs/config.guess @@ -1,13 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright 1992-2019 Free Software Foundation, Inc. -timestamp='2002-03-20' +timestamp='2019-04-28' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -16,24 +15,22 @@ timestamp='2002-03-20' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -42,7 +39,7 @@ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -53,8 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright 1992-2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -66,11 +62,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -88,34 +84,48 @@ if test $# != 0; then exit 1 fi +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; - for c in cc gcc c89 c99 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - rm -f $dummy.c $dummy.o $dummy.rel ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$driver" + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi @@ -124,12 +134,40 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "$UNAME_SYSTEM" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl + fi + ;; +esac + # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -139,21 +177,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ + echo unknown)` + case "$UNAME_MACHINE_ARCH" in + armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine="${arch}${endian}"-unknown + ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in + # to ELF recently (or will in the future) and ABI. + case "$UNAME_MACHINE_ARCH" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -163,145 +213,153 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd + ;; + esac + # Determine ABI tags. + case "$UNAME_MACHINE_ARCH" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "$UNAME_VERSION" in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + echo "$machine-${os}${release}${abi-}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; + *:ekkoBSD:*:*) + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + exit ;; + *:SolidBSD:*:*) + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:MirBSD:*:*) + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:Sortix:*:*) + echo "$UNAME_MACHINE"-unknown-sortix + exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + echo "$UNAME_MACHINE"-unknown-amigaos + exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + echo "$UNAME_MACHINE"-unknown-morphos + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + echo arm-acorn-riscix"$UNAME_RELEASE" + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -309,25 +367,51 @@ EOF else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux"$UNAME_RELEASE" + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -335,26 +419,26 @@ EOF ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + exit ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + echo m68k-sun-sunos"$UNAME_RELEASE" + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) - echo m68k-sun-sunos${UNAME_RELEASE} + echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) - echo sparc-sun-sunos${UNAME_RELEASE} + echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + echo sparc-auspex-sunos"$UNAME_RELEASE" + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -364,41 +448,44 @@ EOF # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-milan-mint"$UNAME_RELEASE" + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-hades-mint"$UNAME_RELEASE" + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-unknown-mint"$UNAME_RELEASE" + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten"$UNAME_RELEASE" + exit ;; powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + echo powerpc-apple-machten"$UNAME_RELEASE" + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + echo mips-dec-ultrix"$UNAME_RELEASE" + exit ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + echo vax-dec-ultrix"$UNAME_RELEASE" + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + echo clipper-intergraph-clix"$UNAME_RELEASE" + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -407,89 +494,95 @@ EOF #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos"$UNAME_RELEASE" + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ + [ "$TARGET_BINARY_INTERFACE"x = x ] then - echo m88k-dg-dgux${UNAME_RELEASE} + echo m88k-dg-dgux"$UNAME_RELEASE" else - echo m88k-dg-dguxbcs${UNAME_RELEASE} + echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else - echo i586-dg-dgux${UNAME_RELEASE} + echo i586-dg-dgux"$UNAME_RELEASE" fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include main() @@ -500,119 +593,143 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; - *:AIX:*:[45]) + exit ;; + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) + exit ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + case "$UNAME_MACHINE" in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "$sc_cpu_version" in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "$sc_kernel_bits" in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + if [ "$HP_ARCH" = "" ]; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + if [ "$HP_ARCH" = hppa2.0w ] + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + exit ;; ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux"$HPUX_REV" + exit ;; 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include int main () @@ -637,500 +754,727 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + echo "$UNAME_MACHINE"-unknown-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + echo "$UNAME_MACHINE"-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + exit ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + echo sparc-unknown-bsdi"$UNAME_RELEASE" + exit ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + exit ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi + else + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf + fi + exit ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case "$UNAME_PROCESSOR" in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + echo "$UNAME_MACHINE"-pc-cygwin + exit ;; + *:MINGW64*:*) + echo "$UNAME_MACHINE"-pc-mingw64 + exit ;; + *:MINGW*:*) + echo "$UNAME_MACHINE"-pc-mingw32 + exit ;; + *:MSYS*:*) + echo "$UNAME_MACHINE"-pc-msys + exit ;; i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i386-pc-interix3 - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; + echo "$UNAME_MACHINE"-pc-pw32 + exit ;; + *:Interix*:*) + case "$UNAME_MACHINE" in + x86) + echo i586-pc-interix"$UNAME_RELEASE" + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix"$UNAME_RELEASE" + exit ;; + IA64) + echo ia64-unknown-interix"$UNAME_RELEASE" + exit ;; + esac ;; i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; + echo "$UNAME_MACHINE"-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-pc-cygwin + exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + # the GNU system + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + exit ;; + *:Minix:*:*) + echo "$UNAME_MACHINE"-unknown-minix + exit ;; + aarch64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + else + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + cris:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + crisv32:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + e2k:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + frv:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + hexagon:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:Linux:*:*) + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m32r*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel + MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips + MIPS_ENDIAN= #else - CPU= + MIPS_ENDIAN= #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c - test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + mips64el:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-"$LIBC" + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-"$LIBC" + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-"$LIBC" + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-"$LIBC" + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-"$LIBC" + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-"$LIBC" + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-"$LIBC" + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + exit ;; + sh64*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + tile*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + vax:Linux:*:*) + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + xtensa*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + # Use sysv4.2uw... so that sysv4* matches it. + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo "$UNAME_MACHINE"-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo "$UNAME_MACHINE"-unknown-stop + exit ;; + i*86:atheos:*:*) + echo "$UNAME_MACHINE"-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo "$UNAME_MACHINE"-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos"$UNAME_RELEASE" + exit ;; + i*86:*DOS:*:*) + echo "$UNAME_MACHINE"-pc-msdosdjgpp + exit ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else - echo ${UNAME_MACHINE}-pc-sysv32 + echo "$UNAME_MACHINE"-pc-sysv32 fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 - exit 0 ;; + exit ;; paragon:*:*:*) echo i860-intel-osf1 - exit 0 ;; + exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + echo m68k-unknown-lynxos"$UNAME_RELEASE" + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + echo sparc-unknown-lynxos"$UNAME_RELEASE" + exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + echo rs6000-unknown-lynxos"$UNAME_RELEASE" + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos"$UNAME_RELEASE" + exit ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + echo mips-dde-sysv"$UNAME_RELEASE" + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 + echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo "$UNAME_MACHINE"-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + echo m68k-apple-aux"$UNAME_RELEASE" + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv"$UNAME_RELEASE" else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv"$UNAME_RELEASE" fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + echo sx4-nec-superux"$UNAME_RELEASE" + exit ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + echo sx5-nec-superux"$UNAME_RELEASE" + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux"$UNAME_RELEASE" + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux"$UNAME_RELEASE" + exit ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + echo powerpc-apple-rhapsody"$UNAME_RELEASE" + exit ;; *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + exit ;; *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + # shellcheck disable=SC2154 + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + echo "$UNAME_MACHINE"-unknown-plan9 + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux"$UNAME_RELEASE" + exit ;; + *:DragonFly:*:*) + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "$UNAME_MACHINE" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + exit ;; + i*86:rdos:*:*) + echo "$UNAME_MACHINE"-pc-rdos + exit ;; + i*86:AROS:*:*) + echo "$UNAME_MACHINE"-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; + *:Unleashed:*:*) + echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < "$dummy.c" < -# include +#include +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif #endif main () { @@ -1143,22 +1487,14 @@ main () #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" @@ -1198,39 +1534,54 @@ main () #endif #if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); + struct utsname un; + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif #endif #if defined (alliant) && defined (i860) @@ -1241,52 +1592,38 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +echo "$0: unable to guess system type" >&2 -# Convex versions that predate uname can use getsysinfo(1) +case "$UNAME_MACHINE:$UNAME_SYSTEM" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp @@ -1305,16 +1642,16 @@ hostinfo = `(hostinfo) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/processors/IA32/bochs/cpu/cpu.cc b/processors/IA32/bochs/cpu/cpu.cc index e2f7102baa..b6b0b97ff8 100644 --- a/processors/IA32/bochs/cpu/cpu.cc +++ b/processors/IA32/bochs/cpu/cpu.cc @@ -288,7 +288,7 @@ void BX_CPU_C::cpu_single_step() #endif // BX_SUPPORT_ICACHE #if BX_SUPPORT_TRACE_CACHE -# error "COG assumes no BX_SUPPORT_TRACE_CACHE +# error "COG assumes no BX_SUPPORT_TRACE_CACHE" #endif // decoding instruction completed -> continue with execution diff --git a/scripts/ci/actions_build.sh b/scripts/ci/actions_build.sh new file mode 100755 index 0000000000..a69f624b4b --- /dev/null +++ b/scripts/ci/actions_build.sh @@ -0,0 +1,182 @@ +#!/bin/bash +set -e + +# This script locates and executes the platform and flavor-specific +# build scripts, which are typically Makefile-based, to compile and +# link the configured VM flavor. It then copies the build artifacts to +# to the ./products directory for subsequent steps such as signing and +# packing and deploying. +# +# This script uses/requires to following variables: +# - ARCH (e.g., "macos64x64") +# - ARCH_ARM (only set for ARM builds in docker container) +# - FLAVOR (e.g., "squeak.cog.spur") +# - RUNNER_OS (i.e., "Linux", "macOS", "Windows") +# - HEARTBEAT (i.e., "threaded" or "itimer"; !! Linux only !!) +# +# This script provides variables for subsequent steps: +# - ASSET_REVISION (e.g., "202107261048") +# - ASSET_NAME (e.g., "squeak.cog.spur_macos64x64") +# - PRODUCTS_PATH (e.g., "products") +# - APP_NAME (e.g., "vm" or "sqcogspur64linuxht" or "Squeak.app") + + + +if [[ "${RUNNER_OS}" == "Windows" ]]; then + source ./scripts/ci/actions_prepare_msys.sh +fi + +echo "$(cat platforms/Cross/vm/sqSCCSVersion.h | .git_filters/RevDateURL.smudge)" > platforms/Cross/vm/sqSCCSVersion.h +echo "$(cat platforms/Cross/plugins/sqPluginsSCCSVersion.h | .git_filters/RevDateURL.smudge)" > platforms/Cross/plugins/sqPluginsSCCSVersion.h + +[[ -z "${ARCH}" ]] && exit 2 +[[ -z "${FLAVOR}" ]] && exit 3 + +readonly ASSET_REVISION=$(grep -m1 "SvnRawRevisionString" "platforms/Cross/vm/sqSCCSVersion.h" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/') + +ASSET_NAME="${FLAVOR}_${ARCH}" +BUILD_PATH="$(pwd)/build.${ARCH}/${FLAVOR}" + +PRODUCTS_PATH="$(pwd)/products" +mkdir "${PRODUCTS_PATH}" || true # ensure PRODUCTS_PATH exists + +check_buildPath() { + if [[ ! -d "${BUILD_PATH}" ]]; then + echo "Build path does not exist: ${BUILD_PATH}" + exit 11 + fi +} + +skip_BochsPlugins() { + echo "Skipping Bochs plugins..." + sed -i 's/Bochs.* //g' plugins.ext + sed -i 's/Bochs.* //g' plugins.int +} + +export_variable() { + local var_name=$1 + local var_value=$2 + if [[ ! -z "${ARCH_ARM}" ]]; then + # We are in a docker container. See https://github.com/uraimo/run-on-arch-action + echo "::set-output name=${var_name}::${var_value}" + else + echo "${var_name}=${var_value}" >> $GITHUB_ENV + fi +} + +# export COGVREV="$(git describe --tags --always)" +# export COGVDATE="$(git show -s --format=%cd HEAD)" +# export COGVURL="$(git config --get remote.origin.url)" +# export COGVOPTS="-DCOGVREV=\"${COGVREV}\" -DCOGVDATE=\"${COGVDATE// /_}\" -DCOGVURL=\"${COGVURL//\//\\\/}\"" + +build_Linux() { + echo '::group::Running "make configure" in platforms/unix/config ...' + (cd platforms/unix/config/ && make configure) + echo '::endgroup::' + + BUILD_PATH="${BUILD_PATH}/build" + if [[ "${MODE}" == "debug" ]]; then + BUILD_PATH="${BUILD_PATH}.debug" + PRODUCTS_PATH="${PRODUCTS_PATH}/debug" + elif [[ "${MODE}" == "assert" ]]; then + BUILD_PATH="${BUILD_PATH}.assert" + PRODUCTS_PATH="${PRODUCTS_PATH}/assert" + fi + + if [[ ! -z "$HEARTBEAT" ]] && [[ "${HEARTBEAT}" != "threaded" ]]; then + BUILD_PATH="${BUILD_PATH}.itimerheartbeat" + ASSET_NAME="${ASSET_NAME}_itimer" + fi + + pushd "${BUILD_PATH}" + + echo "::group::Building ${BUILD_PATH}..." + echo n | bash -e ./mvm || exit 1 + echo "::endgroup::" + + cd "${PRODUCTS_PATH}" + readonly APP_NAME=$(find * -type d | head -n 1) + + popd +} + +build_macOS() { + check_buildPath + + pushd "${BUILD_PATH}" + + echo "::group::Building ${BUILD_PATH}..." + if [[ "${MODE}" == "debug" ]]; then + bash -e ./mvm -d || exit 1 + elif [[ "${MODE}" == "assert" ]]; then + bash -e ./mvm -a || exit 1 + else + bash -e ./mvm -f || exit 1 + fi + echo "::endgroup::" + + echo "::group::Moving build artifacts to ${PRODUCTS_PATH}..." + if [[ "${FLAVOR}" == "newspeak"* ]]; then + # TODO: Why does the Newspeak flavor have to wrong name? Should be set in its build scripts (or Makefile ...) + mv ./*.app "${PRODUCTS_PATH}/Newspeak.app" + else + mv ./*.app "${PRODUCTS_PATH}/" + fi + echo "::endgroup::" + + cd "${PRODUCTS_PATH}" + readonly APP_NAME=$(find * -type d -path "*.app" | head -n 1) + + popd +} + +build_Windows() { + check_buildPath + pushd "${BUILD_PATH}" + + echo "::group::Building ${BUILD_PATH}..." + skip_BochsPlugins + if [[ "${MODE}" == "debug" ]]; then + bash -e ./mvm -d || exit 1 + elif [[ "${MODE}" == "assert" ]]; then + bash -e ./mvm -a || exit 1 + else + bash -e ./mvm -f || exit 1 + fi + echo "::endgroup::" + + echo "::group::Moving build artifacts to ${PRODUCTS_PATH}..." + if [[ "${MODE}" == "debug" ]]; then + mv "./builddbg/vm" "${PRODUCTS_PATH}/" + elif [[ "${MODE}" == "assert" ]]; then + mv "./buildast/vm" "${PRODUCTS_PATH}/" + else + mv "./build/vm" "${PRODUCTS_PATH}/" + fi + echo "::endgroup::" + + readonly APP_NAME="vm" + + popd +} + +if [[ ! $(type -t build_$RUNNER_OS) ]]; then + echo "Unsupported runner OS ${RUNNER_OS}." + exit 99 +fi + +build_$RUNNER_OS + +if [[ "${MODE}" == "debug" ]]; then + ASSET_NAME="${ASSET_NAME}_debug" +elif [[ "${MODE}" == "assert" ]]; then + ASSET_NAME="${ASSET_NAME}_assert" +fi + +export_variable "ASSET_REVISION" "${ASSET_REVISION}" +export_variable "ASSET_NAME" "${ASSET_NAME}" + +[[ ! -d "${PRODUCTS_PATH}" ]] && exit 13 +export_variable "PRODUCTS_PATH" "${PRODUCTS_PATH}" +[[ ! -d "${PRODUCTS_PATH}/${APP_NAME}" ]] && exit 14 +export_variable "APP_NAME" "${APP_NAME}" diff --git a/scripts/ci/actions_prepare_linux_arm.sh b/scripts/ci/actions_prepare_linux_arm.sh new file mode 100755 index 0000000000..894b9a8303 --- /dev/null +++ b/scripts/ci/actions_prepare_linux_arm.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +# This script installs all packages required to build the various VM +# flavors in an ARM-compatible environment such as via QEMU or on a +# Raspberry Pi. For simplicity, the packages should cover all possible +# plugins even if those are not compiled in a particular build +# configuration. +# +# Note that "libtool automake autoconf libltdl-dev" are required to +# let the configure script pass. + +apt-get update -y +apt-get install -yq --no-install-suggests --no-install-recommends build-essential git devscripts uuid-dev libcairo2-dev libpango1.0-dev libgl1-mesa-dev libgl1-mesa-glx libssl-dev libevdev-dev m4 libpulse-dev libasound2-dev libfreetype6-dev libx11-dev libxrender-dev libtool automake autoconf libltdl-dev + +# Other packages found in older build scripts, ignored for now: +# uuid-runtime libsm-dev libice-dev cmake diff --git a/scripts/ci/actions_prepare_linux_x86.sh b/scripts/ci/actions_prepare_linux_x86.sh new file mode 100755 index 0000000000..b481741fc8 --- /dev/null +++ b/scripts/ci/actions_prepare_linux_x86.sh @@ -0,0 +1,68 @@ +#!/bin/bash +set -e + +# This script installs all packages required to build the various VM +# flavors in an x86-compatible environment. It supports both 32-bit +# and #64-bit architectures, which means that the host Linux platform +# has to support the older i386 packages to make 32-bit compile. + +if [[ "${ARCH}" = "linux64x64" ]]; then + sudo apt-get update -y + sudo apt-get install -yq --no-install-suggests --no-install-recommends --allow-unauthenticated \ + debhelper \ + devscripts \ + libasound2-dev \ + libc6-dev \ + libssl-dev \ + libfreetype6-dev \ + libx11-dev \ + libxext-dev \ + libxrender-dev \ + libpango1.0-dev \ + libpulse-dev \ + libaudio-dev \ + libsndio-dev \ + gcc-multilib \ + uuid-dev \ + libglu1-mesa-dev \ + automake \ + autoconf \ + libtool \ + curl \ + cmake +elif [[ "${ARCH}" = "linux32x86" ]]; then + sudo dpkg --add-architecture i386 + sudo apt-get update -y + sudo apt-get install -yq --no-install-suggests --no-install-recommends --allow-unauthenticated \ + devscripts \ + libc6-dev:i386 \ + libasound2:i386 \ + libasound2-dev:i386 \ + libssl-dev:i386 \ + libpng-dev:i386 \ + libfreetype6-dev:i386 \ + libx11-dev:i386 \ + libsm-dev:i386 \ + libice-dev:i386 \ + libllvm12:i386 \ + libgl1-mesa-glx:i386 \ + libgl1-mesa-dev:i386 \ + libxext-dev:i386 \ + libxrender-dev:i386 \ + libglapi-mesa:i386 \ + libcairo2-dev:i386 \ + libpango1.0-dev:i386 \ + libglib2.0-dev:i386 \ + libxft-dev:i386 \ + gir1.2-pango-1.0:i386 \ + gir1.2-freedesktop:i386 \ + gir1.2-glib-2.0:i386 \ + libgirepository-1.0-1:i386 \ + libpulse-dev:i386 \ + libaudio-dev:i386 \ + libsndio-dev:i386 \ + gcc-multilib \ + uuid-dev:i386 \ + libcurl4-openssl-dev:i386 \ + libssh2-1-dev:i386 +fi diff --git a/scripts/ci/actions_prepare_msys.sh b/scripts/ci/actions_prepare_msys.sh new file mode 100755 index 0000000000..f32f883601 --- /dev/null +++ b/scripts/ci/actions_prepare_msys.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Prepare MSYS environment so that all build tools have the $(TOOLPREFIX) as +# expected in Makefile.tools: +# - win64x64\common\Makefile.tools +# - win32x86\common\Makefile.tools +# Also, extend $PATH since MSYS is installed but not conveniently accessible +# in a GitHub-Actions Windows environment. + +[[ -z "${MSYS_SYS}" ]] && exit 2 +[[ -z "${MSYS_ENV}" ]] && exit 2 + +ln -f -s /c/msys64/${MSYS_SYS}/bin/clang /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-clang +ln -f -s /c/msys64/${MSYS_SYS}/bin/clang++ /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-clang++ +ln -f -s /c/msys64/${MSYS_SYS}/bin/ar /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-ar +ln -f -s /c/msys64/${MSYS_SYS}/bin/dlltool /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-dlltool +ln -f -s /c/msys64/${MSYS_SYS}/bin/as /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-as +ln -f -s /c/msys64/${MSYS_SYS}/bin/windres /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-windres +ln -f -s /c/msys64/${MSYS_SYS}/bin/nm /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-nm +ln -f -s /c/msys64/${MSYS_SYS}/bin/dllwrap /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-dllwrap +ln -f -s /c/msys64/${MSYS_SYS}/bin/strip /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-strip +ln -f -s /c/msys64/${MSYS_SYS}/bin/objcopy /c/msys64/${MSYS_SYS}/bin/${MSYS_ENV}-w64-mingw32-objcopy + +# Add MinGW tools for build scripts +PATH=$PATH:/c/msys64/${MSYS_SYS}/bin + +# Add other GNU tools (e.g., wget) for third-party build scripts +PATH=$PATH:/c/msys64/usr/bin diff --git a/scripts/ci/travis_build.sh b/scripts/ci/travis_build.sh deleted file mode 100755 index fe110e5f2f..0000000000 --- a/scripts/ci/travis_build.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash -set -e - -source ./scripts/ci/travis_helpers.sh - -if [[ "${APPVEYOR}" ]]; then - TRAVIS_BUILD_DIR="$(pwd)" - TRAVIS_TAG="${APPVEYOR_REPO_TAG}" - PLATFORM="windows" - - # Appveyor's GCC is pretty new, patch the Makefiles and replace the tools to - # make it work - - echo - echo "Using gcc $(i686-w64-mingw32-gcc --version)" - echo "Using 64-bit gcc $(x86_64-w64-mingw32-gcc --version)" - echo - test -d /usr/i686-w64-mingw32/sys-root/mingw/lib || echo "No lib dir" - test -d /usr/i686-w64-mingw32/sys-root/mingw/include || echo "No inc dir" -else - PLATFORM="${TRAVIS_OS_NAME}" -fi - -[[ -z "${ARCH}" ]] && exit 2 -[[ -z "${FLAVOR}" ]] && exit 3 - -if [[ "${ARCH}" == "linux32ARM"* ]]; then - # we're in chroot at this point - export LC_ALL=C - export LC_CTYPE=C - export LANG=C - export LANGUAGE=C - TRAVIS_BUILD_DIR="$(pwd)" -fi - -echo "$(cat platforms/Cross/vm/sqSCCSVersion.h | .git_filters/RevDateURL.smudge)" > platforms/Cross/vm/sqSCCSVersion.h -echo "$(cat platforms/Cross/plugins/sqPluginsSCCSVersion.h | .git_filters/RevDateURL.smudge)" > platforms/Cross/plugins/sqPluginsSCCSVersion.h - -# echo $PATH -if [[ "${BUILD_WITH_CMAKE}" == "yes" ]]; then - [[ -z "${CPU_ARCH}" ]] && exit 2 - PLATFORM="minheadless_with_cmake" - BUILD_DIRECTORY="$(pwd)/building/minheadless.cmake/${CPU_ARCH}/${FLAVOR}"; -else - BUILD_DIRECTORY="$(pwd)/building/${ARCH}/${FLAVOR}"; -fi -readonly BUILD_DIRECTORY -readonly PRODUCTS_DIR="$(pwd)/products" -mkdir "${PRODUCTS_DIR}" || true # ensure PRODUCTS_DIR exists - -export COGVREV="$(git describe --tags --always)" -export COGVDATE="$(git show -s --format=%cd HEAD)" -export COGVURL="$(git config --get remote.origin.url)" -export COGVOPTS="-DCOGVREV=\"${COGVREV}\" -DCOGVDATE=\"${COGVDATE// /_}\" -DCOGVURL=\"${COGVURL//\//\\\/}\"" - -build_linux_in() { - local build_dir=$1 - local fold_name=$2 - - [[ ! -d "${build_dir}" ]] && exit 10 - - pushd "${build_dir}" - travis_fold start "${fold_name}" "Building OpenSmalltalk VM in ${build_dir}..." - echo n | bash -e ./mvm - travis_fold end "${fold_name}" - # cat config.log - popd -} - -build_linux() { - travis_fold start 'unix_configure' 'Running "make config" in platforms/unix/config ...' - (cd platforms/unix/config/ && make configure) - travis_fold end 'unix_configure' - - # build will include both, threaded and itimer version unless - # HEARTBEAT variable is set, in which case just one of both - # will be built. - # HEARTBEAT can be "threaded" or "itimer" - - if [ -z "$HEARTBEAT" ] || [ "$HEARTBEAT" = "threaded" ]; then - build_linux_in "${BUILD_DIRECTORY}/build" "build_vm" - fi - - # Also build VM with itimerheartbeat if available - if [[ ! -d "${BUILD_DIRECTORY}/build.itimerheartbeat" ]]; then - return - fi - - if [ -z "$HEARTBEAT" ] || [ "$HEARTBEAT" = "itimer" ]; then - build_linux_in "${BUILD_DIRECTORY}/build.itimerheartbeat" "build_itimer_vm" - fi -} - -build_osx() { - [[ ! -d "${BUILD_DIRECTORY}" ]] && exit 50 - - pushd "${BUILD_DIRECTORY}" - - travis_fold start build_vm "Building OpenSmalltalk VM..." - bash -e ./mvm -f - travis_fold end build_vm - - mv ./*.app "${PRODUCTS_DIR}/" # Move app to PRODUCTS_DIR - popd -} - -build_windows() { - [[ ! -d "${BUILD_DIRECTORY}" ]] && exit 100 - - pushd "${BUILD_DIRECTORY}" - echo "Removing bochs plugins..." - sed -i 's/Bochs.* //g' plugins.ext - - echo "Building OpenSmalltalk VM for Windows..." - # We cannot zip dbg and ast if we pass -f to just to the full thing... - # Once this builds, let's pass -A instead of -f and put the full zip (but we should do several zips in the future) - bash -e ./mvm -f || exit 1 - # zip -r "${output_file}.zip" "./builddbg/vm/" "./buildast/vm/" "./build/vm/" - mv "./build/vm" "${PRODUCTS_DIR}/" # Move result to PRODUCTS_DIR - popd -} - -build_minheadless_with_cmake() { - [[ ! -d "${BUILD_DIRECTORY}" ]] && exit 150 - - local vm_variant_name="${FLAVOR}_minheadless-cmake_${ARCH}" - - pushd "${BUILD_DIRECTORY}" - travis_fold start build_vm "Building OpenSmalltalk VM..." - bash -e ./mvm -f || exit 1 - mv ./release/install-dist/* "${PRODUCTS_DIR}/" - travis_fold end build_vm - popd - -} - -if [[ ! $(type -t build_$PLATFORM) ]]; then - echo "Unsupported platform '$(uname -s)'." 1>&2 - exit 99 -fi - -build_$PLATFORM diff --git a/scripts/ci/travis_helpers.sh b/scripts/ci/travis_helpers.sh deleted file mode 100755 index fc55f44dff..0000000000 --- a/scripts/ci/travis_helpers.sh +++ /dev/null @@ -1,12 +0,0 @@ -travis_fold() { - local action=$1 - local name=$2 - local title="${3:-}" - - if [[ "${TRAVIS:-}" = "true" ]]; then - echo -en "travis_fold:${action}:${name}\r\033[0K" - fi - if [[ -n "${title}" ]]; then - echo -e "\033[34;1m${title}\033[0m" - fi -} diff --git a/scripts/ci/travis_install.sh b/scripts/ci/travis_install.sh deleted file mode 100755 index 73150eb875..0000000000 --- a/scripts/ci/travis_install.sh +++ /dev/null @@ -1,144 +0,0 @@ -set -e - -if [[ "${ARCH}" = "linux64x64" ]]; then - sudo apt-get update -y - sudo apt-get install -yq --no-install-suggests --no-install-recommends --force-yes \ - debhelper \ - devscripts \ - libasound2-dev \ - libc6-dev \ - libssl-dev \ - libfreetype6-dev \ - libx11-dev \ - libxext-dev \ - libxrender-dev \ - libpango1.0-dev \ - libpulse-dev \ - libaudio-dev \ - libsndio-dev \ - gcc-multilib \ - uuid-dev \ - libglu1-mesa-dev \ - automake \ - autoconf \ - libtool \ - curl \ - cmake -elif [[ "${ARCH}" = "linux32x86" ]]; then - sudo apt-get update -y - sudo apt-get remove -q -y gvfs-daemons - sudo apt-get install -yq --no-install-suggests --no-install-recommends --force-yes \ - devscripts \ - libc6-dev:i386 \ - libasound2:i386 \ - libasound2-dev:i386 \ - libssl-dev:i386 \ - libssl0.9.8:i386 \ - libpng-dev:i386 \ - libfreetype6-dev:i386 \ - libx11-dev:i386 \ - libsm-dev:i386 \ - libice-dev:i386 \ - libgl1-mesa-glx:i386 \ - libgl1-mesa-dev:i386 \ - libxext-dev:i386 \ - libxrender-dev:i386 \ - libglapi-mesa:i386 \ - libcairo2-dev:i386 \ - libpango1.0-dev:i386 \ - libglib2.0-dev:i386 \ - libxft-dev:i386 \ - gir1.2-pango-1.0:i386 \ - gir1.2-freedesktop:i386 \ - gir1.2-glib-2.0:i386 \ - libgirepository-1.0-1:i386 \ - libpulse-dev:i386 \ - libaudio-dev:i386 \ - libsndio-dev:i386 \ - gcc-multilib \ - uuid-dev:i386 \ - libcurl4-openssl-dev:i386 \ - libssh2-1-dev:i386 -fi - -[[ "${ARCH}" != "linux32ARMv6" ]] && exit 0 - -MIRROR=http://archive.raspbian.org/raspbian -VERSION=jessie -# TOOLS_DIR=$PWD/tools -ARMCHROOT=$PWD/armchroot - -sudo dpkg --add-architecture i386 -sudo apt-add-repository multiverse -sudo apt-add-repository universe -sudo apt-get update -myq || true - -sudo apt-get update -y -sudo apt-get install -yq --no-install-suggests --no-install-recommends --force-yes \ - gcc-arm-linux-gnueabi \ - gcc-arm-linux-gnueabihf \ - qemu-system \ - qemu-system-arm \ - qemu-user \ - qemu-user-static \ - sbuild \ - schroot \ - scratchbox2 \ - debootstrap \ - zlib1g:i386 \ - libstdc++6:i386 \ - libffi-dev:i386 \ - libffi6:i386 \ - libssl1.0.0:i386 \ - libbz2-1.0:i386 \ - libc6-dev-i386 \ - libc6:i386 \ - libexpat1:i386 \ - libtinfo5:i386 \ - binfmt-support \ - build-essential \ - python-dev \ - libffi-dev \ - zlib1g-dev \ - libtool \ - automake \ - autoconf - -sudo chown $USER /etc/schroot/schroot.conf -echo " -[rpi] -directory=$ARMCHROOT -users=$USER -root-users=$USER -groups=$USER -aliases=default -type=directory -" >> /etc/schroot/schroot.conf -cat /etc/schroot/schroot.conf -sudo chown root /etc/schroot/schroot.conf - -# git clone https://github.com/raspberrypi/tools.git $TOOLS_DIR - -# chroot -if [ ! -e "$ARMCHROOT/etc/debian_chroot" ]; then - mkdir -p $ARMCHROOT - sudo qemu-debootstrap --no-check-gpg --include=fakeroot,build-essential --arch=armhf ${VERSION} ${ARMCHROOT} ${MIRROR} - sudo su -c "echo \"deb ${MIRROR} jessie main contrib rpi\" > ${ARMCHROOT}/etc/apt/sources.list" - schroot -c rpi -u root -- apt-get update - schroot -c rpi -u root -- apt-get --allow-unauthenticated install -y \ - build-essential libcairo2-dev libpango1.0-dev libssl-dev uuid-dev uuid-runtime libasound2-dev \ - debhelper devscripts libssl-dev libfreetype6-dev libx11-dev libxext-dev libxrender-dev \ - libx11-dev libsm-dev libice-dev libgl1-mesa-dev libgl1-mesa-glx git \ - libtool automake autoconf - #needed for third-party libraries - schroot -c rpi -u root -- apt-get --allow-unauthenticated install -y cmake curl -fi -schroot -c rpi -- uname -m - -sudo mount -o remount,size=100M /tmp || echo "No tmp size increase required" - -# Use Scratchbox2 for faster compilation -# pushd $ARMCHROOT -# sb2-init -c `which qemu-arm` rpi $TOOLS_DIR/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc -# sb2-config -d rpi -# popd diff --git a/src/plugins/ADPCMCodecPlugin/ADPCMCodecPlugin.c b/src/plugins/ADPCMCodecPlugin/ADPCMCodecPlugin.c index e9fdc3fdf2..b199d0cbe4 100644 --- a/src/plugins/ADPCMCodecPlugin/ADPCMCodecPlugin.c +++ b/src/plugins/ADPCMCodecPlugin/ADPCMCodecPlugin.c @@ -1,10 +1,10 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - ADPCMCodecPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + ADPCMCodecPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 ADPCMCodec * Sound-eem.81 uuid: 43c1e089-1145-4a27-b5b8-f35e872fc99a */ -static char __buildInfo[] = "ADPCMCodecPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686\n\ +static char __buildInfo[] = "ADPCMCodecPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190\n\ ADPCMCodec * Sound-eem.81 uuid: 43c1e089-1145-4a27-b5b8-f35e872fc99a " __DATE__ ; @@ -67,7 +67,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ADPCMCodecPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "ADPCMCodecPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -930,19 +930,17 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "ADPCMCodecPlugin"; void* ADPCMCodecPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDecodeMono\000\001", (void*)primitiveDecodeMono}, - {(void*)_m, "primitiveDecodeStereo\000\001", (void*)primitiveDecodeStereo}, - {(void*)_m, "primitiveEncodeMono\000\001", (void*)primitiveEncodeMono}, - {(void*)_m, "primitiveEncodeStereo\000\000", (void*)primitiveEncodeStereo}, + {(void*)_m, "primitiveDecodeMono\000\377\000", (void*)primitiveDecodeMono}, + {(void*)_m, "primitiveDecodeStereo\000\377\000", (void*)primitiveDecodeStereo}, + {(void*)_m, "primitiveEncodeMono\000\377\000", (void*)primitiveEncodeMono}, + {(void*)_m, "primitiveEncodeStereo\000\377\000", (void*)primitiveEncodeStereo}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDecodeMonoAccessorDepth = 1; -EXPORT(signed char) primitiveDecodeStereoAccessorDepth = 1; -EXPORT(signed char) primitiveEncodeMonoAccessorDepth = 1; -EXPORT(signed char) primitiveEncodeStereoAccessorDepth = 0; +#if SPURVM +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/AioPlugin/AioPlugin.c b/src/plugins/AioPlugin/AioPlugin.c index d4c89dc77e..7907125f7c 100644 --- a/src/plugins/AioPlugin/AioPlugin.c +++ b/src/plugins/AioPlugin/AioPlugin.c @@ -1,5 +1,5 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from UnixAioPlugin VMConstruction-Plugins-AioPlugin.oscog-eem.26 uuid: 9d32c4ef-9646-4ce2-b069-44fe86a2dbfb */ @@ -620,25 +620,27 @@ versionString(void) static char _m[] = "AioPlugin"; void* AioPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveAioDisable\000\000", (void*)primitiveAioDisable}, - {(void*)_m, "primitiveAioEnable\000\000", (void*)primitiveAioEnable}, - {(void*)_m, "primitiveAioHandle\000\000", (void*)primitiveAioHandle}, - {(void*)_m, "primitiveAioSuspend\000\000", (void*)primitiveAioSuspend}, - {(void*)_m, "primitiveModuleName\000\377", (void*)primitiveModuleName}, - {(void*)_m, "primitiveOSFileHandle\000\001", (void*)primitiveOSFileHandle}, - {(void*)_m, "primitiveOSSocketHandle\000\001", (void*)primitiveOSSocketHandle}, - {(void*)_m, "primitiveVersionString\000\377", (void*)primitiveVersionString}, + {(void*)_m, "primitiveAioDisable\000\000\000", (void*)primitiveAioDisable}, + {(void*)_m, "primitiveAioEnable\000\000\000", (void*)primitiveAioEnable}, + {(void*)_m, "primitiveAioHandle\000\000\000", (void*)primitiveAioHandle}, + {(void*)_m, "primitiveAioSuspend\000\000\000", (void*)primitiveAioSuspend}, + {(void*)_m, "primitiveModuleName\000\377\000", (void*)primitiveModuleName}, + {(void*)_m, "primitiveOSFileHandle\000\001\000", (void*)primitiveOSFileHandle}, + {(void*)_m, "primitiveOSSocketHandle\000\001\000", (void*)primitiveOSSocketHandle}, + {(void*)_m, "primitiveVersionString\000\377\000", (void*)primitiveVersionString}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveAioDisableAccessorDepth = 0; -EXPORT(signed char) primitiveAioEnableAccessorDepth = 0; -EXPORT(signed char) primitiveAioHandleAccessorDepth = 0; -EXPORT(signed char) primitiveAioSuspendAccessorDepth = 0; -EXPORT(signed char) primitiveOSFileHandleAccessorDepth = 1; -EXPORT(signed char) primitiveOSSocketHandleAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveAioDisableMetadata = 0; +EXPORT(signed short) primitiveAioEnableMetadata = 0; +EXPORT(signed short) primitiveAioHandleMetadata = 0; +EXPORT(signed short) primitiveAioSuspendMetadata = 0; +EXPORT(signed short) primitiveOSFileHandleMetadata = 0x100; +EXPORT(signed short) primitiveOSSocketHandleMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/AsynchFilePlugin/AsynchFilePlugin.c b/src/plugins/AsynchFilePlugin/AsynchFilePlugin.c index 3e8b105c79..3eb955a74f 100644 --- a/src/plugins/AsynchFilePlugin/AsynchFilePlugin.c +++ b/src/plugins/AsynchFilePlugin/AsynchFilePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - AsynchFilePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + AsynchFilePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "AsynchFilePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -116,7 +116,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "AsynchFilePlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "AsynchFilePlugin VMMaker.oscog-eem.3024 " INT_EXT; static void * sCOAFfn; @@ -185,9 +185,6 @@ primitiveAsyncFileClose(void) sqInt fh; fh = stackValue(0); - if (failed()) { - return null; - } /* begin asyncFileValueOf: */ if ((isBytes(fh)) && ((byteSizeOf(fh)) == (sizeof(AsyncFile)))) { @@ -222,15 +219,11 @@ primitiveAsyncFileOpen(void) if (!((isBytes(stackValue(2))) && ((isBooleanObject(stackValue(1))) && (isIntegerObject((semaIndex = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileName = ((char *) (firstIndexableField(stackValue(2)))); writeFlag = booleanValueOf(stackValue(1)); semaIndex = integerValueOf(semaIndex); - if (failed()) { - return null; - } /* If the security plugin can be loaded, use it to check for permission. If not, assume it's ok */ @@ -278,16 +271,12 @@ primitiveAsyncFileReadResult(void) if (!((isIntegerObject((start = stackValue(1)))) && (isIntegerObject((num = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fhandle = stackValue(3); buffer = stackValue(2); start = integerValueOf(start); num = integerValueOf(num); - if (failed()) { - return null; - } /* begin asyncFileValueOf: */ if ((isBytes(fhandle)) && ((byteSizeOf(fhandle)) == (sizeof(AsyncFile)))) { @@ -336,15 +325,11 @@ primitiveAsyncFileReadStart(void) if (!((isIntegerObject((fPosition = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fHandle = stackValue(2); fPosition = integerValueOf(fPosition); count = integerValueOf(count); - if (failed()) { - return null; - } /* begin asyncFileValueOf: */ if ((isBytes(fHandle)) && ((byteSizeOf(fHandle)) == (sizeof(AsyncFile)))) { @@ -374,9 +359,6 @@ primitiveAsyncFileWriteResult(void) sqInt _return_value; fHandle = stackValue(0); - if (failed()) { - return null; - } /* begin asyncFileValueOf: */ if ((isBytes(fHandle)) && ((byteSizeOf(fHandle)) == (sizeof(AsyncFile)))) { @@ -417,17 +399,13 @@ primitiveAsyncFileWriteStart(void) if (!((isIntegerObject((fPosition = stackValue(3)))) && ((isIntegerObject((start = stackValue(1)))) && (isIntegerObject((num = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fHandle = stackValue(4); fPosition = integerValueOf(fPosition); buffer = stackValue(2); start = integerValueOf(start); num = integerValueOf(num); - if (failed()) { - return null; - } /* begin asyncFileValueOf: */ if ((isBytes(fHandle)) && ((byteSizeOf(fHandle)) == (sizeof(AsyncFile)))) { @@ -535,24 +513,26 @@ void* AsynchFilePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveAsyncFileClose\000\000", (void*)primitiveAsyncFileClose}, - {(void*)_m, "primitiveAsyncFileOpen\000\000", (void*)primitiveAsyncFileOpen}, - {(void*)_m, "primitiveAsyncFileReadResult\000\000", (void*)primitiveAsyncFileReadResult}, - {(void*)_m, "primitiveAsyncFileReadStart\000\000", (void*)primitiveAsyncFileReadStart}, - {(void*)_m, "primitiveAsyncFileWriteResult\000\000", (void*)primitiveAsyncFileWriteResult}, - {(void*)_m, "primitiveAsyncFileWriteStart\000\000", (void*)primitiveAsyncFileWriteStart}, + {(void*)_m, "primitiveAsyncFileClose\000\001\000", (void*)primitiveAsyncFileClose}, + {(void*)_m, "primitiveAsyncFileOpen\000\000\000", (void*)primitiveAsyncFileOpen}, + {(void*)_m, "primitiveAsyncFileReadResult\000\001\000", (void*)primitiveAsyncFileReadResult}, + {(void*)_m, "primitiveAsyncFileReadStart\000\001\000", (void*)primitiveAsyncFileReadStart}, + {(void*)_m, "primitiveAsyncFileWriteResult\000\001\000", (void*)primitiveAsyncFileWriteResult}, + {(void*)_m, "primitiveAsyncFileWriteStart\000\001\000", (void*)primitiveAsyncFileWriteStart}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveAsyncFileCloseAccessorDepth = 0; -EXPORT(signed char) primitiveAsyncFileOpenAccessorDepth = 0; -EXPORT(signed char) primitiveAsyncFileReadResultAccessorDepth = 0; -EXPORT(signed char) primitiveAsyncFileReadStartAccessorDepth = 0; -EXPORT(signed char) primitiveAsyncFileWriteResultAccessorDepth = 0; -EXPORT(signed char) primitiveAsyncFileWriteStartAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveAsyncFileCloseMetadata = 0x100; +EXPORT(signed short) primitiveAsyncFileOpenMetadata = 0; +EXPORT(signed short) primitiveAsyncFileReadResultMetadata = 0x100; +EXPORT(signed short) primitiveAsyncFileReadStartMetadata = 0x100; +EXPORT(signed short) primitiveAsyncFileWriteResultMetadata = 0x100; +EXPORT(signed short) primitiveAsyncFileWriteStartMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/B2DPlugin/B2DPlugin.c b/src/plugins/B2DPlugin/B2DPlugin.c index 89a9d30081..40c1beffc4 100644 --- a/src/plugins/B2DPlugin/B2DPlugin.c +++ b/src/plugins/B2DPlugin/B2DPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2972 uuid: d3fd6149-f8a8-495d-bdb0-57456ffa277c + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - BalloonEnginePlugin VMMaker.oscog-eem.2972 uuid: d3fd6149-f8a8-495d-bdb0-57456ffa277c + BalloonEnginePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.2972 uuid: d3fd6149-f8a8-495d-bdb0-57456ffa277c " __DATE__ ; +static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -840,7 +840,7 @@ extern #endif struct VirtualMachine* interpreterProxy; static void * loadBBFn; -static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.2972 " INT_EXT; +static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.3024 " INT_EXT; static int* objBuffer; static sqInt objUsed; static unsigned int* spanBuffer; @@ -15135,97 +15135,97 @@ void* B2DPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveAbortProcessing\000\002", (void*)primitiveAbortProcessing}, - {(void*)_m, "primitiveAddActiveEdgeEntry\000\003", (void*)primitiveAddActiveEdgeEntry}, - {(void*)_m, "primitiveAddBezier\000\002", (void*)primitiveAddBezier}, - {(void*)_m, "primitiveAddBezierShape\000\003", (void*)primitiveAddBezierShape}, - {(void*)_m, "primitiveAddBitmapFill\000\002", (void*)primitiveAddBitmapFill}, - {(void*)_m, "primitiveAddCompressedShape\000\002", (void*)primitiveAddCompressedShape}, - {(void*)_m, "primitiveAddGradientFill\000\002", (void*)primitiveAddGradientFill}, - {(void*)_m, "primitiveAddLine\000\002", (void*)primitiveAddLine}, - {(void*)_m, "primitiveAddOval\000\002", (void*)primitiveAddOval}, - {(void*)_m, "primitiveAddPolygon\000\002", (void*)primitiveAddPolygon}, - {(void*)_m, "primitiveAddRect\000\002", (void*)primitiveAddRect}, - {(void*)_m, "primitiveChangedActiveEdgeEntry\000\002", (void*)primitiveChangedActiveEdgeEntry}, - {(void*)_m, "primitiveCopyBuffer\000\001", (void*)primitiveCopyBuffer}, - {(void*)_m, "primitiveDisplaySpanBuffer\000\002", (void*)primitiveDisplaySpanBuffer}, - {(void*)_m, "primitiveDoProfileStats\000\000", (void*)primitiveDoProfileStats}, - {(void*)_m, "primitiveFinishedProcessing\000\002", (void*)primitiveFinishedProcessing}, - {(void*)_m, "primitiveGetAALevel\000\002", (void*)primitiveGetAALevel}, - {(void*)_m, "primitiveGetBezierStats\000\002", (void*)primitiveGetBezierStats}, - {(void*)_m, "primitiveGetClipRect\000\002", (void*)primitiveGetClipRect}, - {(void*)_m, "primitiveGetCounts\000\002", (void*)primitiveGetCounts}, - {(void*)_m, "primitiveGetDepth\000\002", (void*)primitiveGetDepth}, - {(void*)_m, "primitiveGetFailureReason\000\002", (void*)primitiveGetFailureReason}, - {(void*)_m, "primitiveGetOffset\000\002", (void*)primitiveGetOffset}, - {(void*)_m, "primitiveGetTimes\000\002", (void*)primitiveGetTimes}, - {(void*)_m, "primitiveInitializeBuffer\000\001", (void*)primitiveInitializeBuffer}, - {(void*)_m, "primitiveInitializeProcessing\000\002", (void*)primitiveInitializeProcessing}, - {(void*)_m, "primitiveMergeFillFrom\000\002", (void*)primitiveMergeFillFrom}, - {(void*)_m, "primitiveNeedsFlush\000\002", (void*)primitiveNeedsFlush}, - {(void*)_m, "primitiveNeedsFlushPut\000\002", (void*)primitiveNeedsFlushPut}, - {(void*)_m, "primitiveNextActiveEdgeEntry\000\002", (void*)primitiveNextActiveEdgeEntry}, - {(void*)_m, "primitiveNextFillEntry\000\003", (void*)primitiveNextFillEntry}, - {(void*)_m, "primitiveNextGlobalEdgeEntry\000\002", (void*)primitiveNextGlobalEdgeEntry}, - {(void*)_m, "primitiveRegisterExternalEdge\000\002", (void*)primitiveRegisterExternalEdge}, - {(void*)_m, "primitiveRegisterExternalFill\000\002", (void*)primitiveRegisterExternalFill}, - {(void*)_m, "primitiveRenderImage\000\003", (void*)primitiveRenderImage}, - {(void*)_m, "primitiveRenderScanline\000\003", (void*)primitiveRenderScanline}, - {(void*)_m, "primitiveSetAALevel\000\002", (void*)primitiveSetAALevel}, - {(void*)_m, "primitiveSetBitBltPlugin\000\001", (void*)primitiveSetBitBltPlugin}, - {(void*)_m, "primitiveSetClipRect\000\002", (void*)primitiveSetClipRect}, - {(void*)_m, "primitiveSetColorTransform\000\002", (void*)primitiveSetColorTransform}, - {(void*)_m, "primitiveSetDepth\000\002", (void*)primitiveSetDepth}, - {(void*)_m, "primitiveSetEdgeTransform\000\002", (void*)primitiveSetEdgeTransform}, - {(void*)_m, "primitiveSetOffset\000\002", (void*)primitiveSetOffset}, + {(void*)_m, "primitiveAbortProcessing\000\002\000", (void*)primitiveAbortProcessing}, + {(void*)_m, "primitiveAddActiveEdgeEntry\000\003\000", (void*)primitiveAddActiveEdgeEntry}, + {(void*)_m, "primitiveAddBezier\000\002\000", (void*)primitiveAddBezier}, + {(void*)_m, "primitiveAddBezierShape\000\003\000", (void*)primitiveAddBezierShape}, + {(void*)_m, "primitiveAddBitmapFill\000\003\000", (void*)primitiveAddBitmapFill}, + {(void*)_m, "primitiveAddCompressedShape\000\003\000", (void*)primitiveAddCompressedShape}, + {(void*)_m, "primitiveAddGradientFill\000\002\000", (void*)primitiveAddGradientFill}, + {(void*)_m, "primitiveAddLine\000\002\000", (void*)primitiveAddLine}, + {(void*)_m, "primitiveAddOval\000\002\000", (void*)primitiveAddOval}, + {(void*)_m, "primitiveAddPolygon\000\003\000", (void*)primitiveAddPolygon}, + {(void*)_m, "primitiveAddRect\000\002\000", (void*)primitiveAddRect}, + {(void*)_m, "primitiveChangedActiveEdgeEntry\000\002\000", (void*)primitiveChangedActiveEdgeEntry}, + {(void*)_m, "primitiveCopyBuffer\000\001\000", (void*)primitiveCopyBuffer}, + {(void*)_m, "primitiveDisplaySpanBuffer\000\002\000", (void*)primitiveDisplaySpanBuffer}, + {(void*)_m, "primitiveDoProfileStats\000\000\000", (void*)primitiveDoProfileStats}, + {(void*)_m, "primitiveFinishedProcessing\000\002\000", (void*)primitiveFinishedProcessing}, + {(void*)_m, "primitiveGetAALevel\000\002\000", (void*)primitiveGetAALevel}, + {(void*)_m, "primitiveGetBezierStats\000\002\000", (void*)primitiveGetBezierStats}, + {(void*)_m, "primitiveGetClipRect\000\002\000", (void*)primitiveGetClipRect}, + {(void*)_m, "primitiveGetCounts\000\002\000", (void*)primitiveGetCounts}, + {(void*)_m, "primitiveGetDepth\000\002\000", (void*)primitiveGetDepth}, + {(void*)_m, "primitiveGetFailureReason\000\002\000", (void*)primitiveGetFailureReason}, + {(void*)_m, "primitiveGetOffset\000\002\000", (void*)primitiveGetOffset}, + {(void*)_m, "primitiveGetTimes\000\002\000", (void*)primitiveGetTimes}, + {(void*)_m, "primitiveInitializeBuffer\000\001\000", (void*)primitiveInitializeBuffer}, + {(void*)_m, "primitiveInitializeProcessing\000\002\000", (void*)primitiveInitializeProcessing}, + {(void*)_m, "primitiveMergeFillFrom\000\002\000", (void*)primitiveMergeFillFrom}, + {(void*)_m, "primitiveNeedsFlush\000\002\000", (void*)primitiveNeedsFlush}, + {(void*)_m, "primitiveNeedsFlushPut\000\002\000", (void*)primitiveNeedsFlushPut}, + {(void*)_m, "primitiveNextActiveEdgeEntry\000\002\000", (void*)primitiveNextActiveEdgeEntry}, + {(void*)_m, "primitiveNextFillEntry\000\003\000", (void*)primitiveNextFillEntry}, + {(void*)_m, "primitiveNextGlobalEdgeEntry\000\002\000", (void*)primitiveNextGlobalEdgeEntry}, + {(void*)_m, "primitiveRegisterExternalEdge\000\002\000", (void*)primitiveRegisterExternalEdge}, + {(void*)_m, "primitiveRegisterExternalFill\000\002\000", (void*)primitiveRegisterExternalFill}, + {(void*)_m, "primitiveRenderImage\000\377\000", (void*)primitiveRenderImage}, + {(void*)_m, "primitiveRenderScanline\000\377\000", (void*)primitiveRenderScanline}, + {(void*)_m, "primitiveSetAALevel\000\002\000", (void*)primitiveSetAALevel}, + {(void*)_m, "primitiveSetBitBltPlugin\000\001\000", (void*)primitiveSetBitBltPlugin}, + {(void*)_m, "primitiveSetClipRect\000\002\000", (void*)primitiveSetClipRect}, + {(void*)_m, "primitiveSetColorTransform\000\002\000", (void*)primitiveSetColorTransform}, + {(void*)_m, "primitiveSetDepth\000\002\000", (void*)primitiveSetDepth}, + {(void*)_m, "primitiveSetEdgeTransform\000\002\000", (void*)primitiveSetEdgeTransform}, + {(void*)_m, "primitiveSetOffset\000\002\000", (void*)primitiveSetOffset}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveAbortProcessingAccessorDepth = 2; -EXPORT(signed char) primitiveAddActiveEdgeEntryAccessorDepth = 3; -EXPORT(signed char) primitiveAddBezierAccessorDepth = 2; -EXPORT(signed char) primitiveAddBezierShapeAccessorDepth = 3; -EXPORT(signed char) primitiveAddBitmapFillAccessorDepth = 2; -EXPORT(signed char) primitiveAddCompressedShapeAccessorDepth = 2; -EXPORT(signed char) primitiveAddGradientFillAccessorDepth = 2; -EXPORT(signed char) primitiveAddLineAccessorDepth = 2; -EXPORT(signed char) primitiveAddOvalAccessorDepth = 2; -EXPORT(signed char) primitiveAddPolygonAccessorDepth = 2; -EXPORT(signed char) primitiveAddRectAccessorDepth = 2; -EXPORT(signed char) primitiveChangedActiveEdgeEntryAccessorDepth = 2; -EXPORT(signed char) primitiveCopyBufferAccessorDepth = 1; -EXPORT(signed char) primitiveDisplaySpanBufferAccessorDepth = 2; -EXPORT(signed char) primitiveDoProfileStatsAccessorDepth = 0; -EXPORT(signed char) primitiveFinishedProcessingAccessorDepth = 2; -EXPORT(signed char) primitiveGetAALevelAccessorDepth = 2; -EXPORT(signed char) primitiveGetBezierStatsAccessorDepth = 2; -EXPORT(signed char) primitiveGetClipRectAccessorDepth = 2; -EXPORT(signed char) primitiveGetCountsAccessorDepth = 2; -EXPORT(signed char) primitiveGetDepthAccessorDepth = 2; -EXPORT(signed char) primitiveGetFailureReasonAccessorDepth = 2; -EXPORT(signed char) primitiveGetOffsetAccessorDepth = 2; -EXPORT(signed char) primitiveGetTimesAccessorDepth = 2; -EXPORT(signed char) primitiveInitializeBufferAccessorDepth = 1; -EXPORT(signed char) primitiveInitializeProcessingAccessorDepth = 2; -EXPORT(signed char) primitiveMergeFillFromAccessorDepth = 2; -EXPORT(signed char) primitiveNeedsFlushAccessorDepth = 2; -EXPORT(signed char) primitiveNeedsFlushPutAccessorDepth = 2; -EXPORT(signed char) primitiveNextActiveEdgeEntryAccessorDepth = 2; -EXPORT(signed char) primitiveNextFillEntryAccessorDepth = 3; -EXPORT(signed char) primitiveNextGlobalEdgeEntryAccessorDepth = 2; -EXPORT(signed char) primitiveRegisterExternalEdgeAccessorDepth = 2; -EXPORT(signed char) primitiveRegisterExternalFillAccessorDepth = 2; -EXPORT(signed char) primitiveRenderImageAccessorDepth = 3; -EXPORT(signed char) primitiveRenderScanlineAccessorDepth = 3; -EXPORT(signed char) primitiveSetAALevelAccessorDepth = 2; -EXPORT(signed char) primitiveSetBitBltPluginAccessorDepth = 1; -EXPORT(signed char) primitiveSetClipRectAccessorDepth = 2; -EXPORT(signed char) primitiveSetColorTransformAccessorDepth = 2; -EXPORT(signed char) primitiveSetDepthAccessorDepth = 2; -EXPORT(signed char) primitiveSetEdgeTransformAccessorDepth = 2; -EXPORT(signed char) primitiveSetOffsetAccessorDepth = 2; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveAbortProcessingMetadata = 0x200; +EXPORT(signed short) primitiveAddActiveEdgeEntryMetadata = 0x300; +EXPORT(signed short) primitiveAddBezierMetadata = 0x200; +EXPORT(signed short) primitiveAddBezierShapeMetadata = 0x300; +EXPORT(signed short) primitiveAddBitmapFillMetadata = 0x300; +EXPORT(signed short) primitiveAddCompressedShapeMetadata = 0x300; +EXPORT(signed short) primitiveAddGradientFillMetadata = 0x200; +EXPORT(signed short) primitiveAddLineMetadata = 0x200; +EXPORT(signed short) primitiveAddOvalMetadata = 0x200; +EXPORT(signed short) primitiveAddPolygonMetadata = 0x300; +EXPORT(signed short) primitiveAddRectMetadata = 0x200; +EXPORT(signed short) primitiveChangedActiveEdgeEntryMetadata = 0x200; +EXPORT(signed short) primitiveCopyBufferMetadata = 0x100; +EXPORT(signed short) primitiveDisplaySpanBufferMetadata = 0x200; +EXPORT(signed short) primitiveDoProfileStatsMetadata = 0; +EXPORT(signed short) primitiveFinishedProcessingMetadata = 0x200; +EXPORT(signed short) primitiveGetAALevelMetadata = 0x200; +EXPORT(signed short) primitiveGetBezierStatsMetadata = 0x200; +EXPORT(signed short) primitiveGetClipRectMetadata = 0x200; +EXPORT(signed short) primitiveGetCountsMetadata = 0x200; +EXPORT(signed short) primitiveGetDepthMetadata = 0x200; +EXPORT(signed short) primitiveGetFailureReasonMetadata = 0x200; +EXPORT(signed short) primitiveGetOffsetMetadata = 0x200; +EXPORT(signed short) primitiveGetTimesMetadata = 0x200; +EXPORT(signed short) primitiveInitializeBufferMetadata = 0x100; +EXPORT(signed short) primitiveInitializeProcessingMetadata = 0x200; +EXPORT(signed short) primitiveMergeFillFromMetadata = 0x200; +EXPORT(signed short) primitiveNeedsFlushMetadata = 0x200; +EXPORT(signed short) primitiveNeedsFlushPutMetadata = 0x200; +EXPORT(signed short) primitiveNextActiveEdgeEntryMetadata = 0x200; +EXPORT(signed short) primitiveNextFillEntryMetadata = 0x300; +EXPORT(signed short) primitiveNextGlobalEdgeEntryMetadata = 0x200; +EXPORT(signed short) primitiveRegisterExternalEdgeMetadata = 0x200; +EXPORT(signed short) primitiveRegisterExternalFillMetadata = 0x200; +EXPORT(signed short) primitiveSetAALevelMetadata = 0x200; +EXPORT(signed short) primitiveSetBitBltPluginMetadata = 0x100; +EXPORT(signed short) primitiveSetClipRectMetadata = 0x200; +EXPORT(signed short) primitiveSetColorTransformMetadata = 0x200; +EXPORT(signed short) primitiveSetDepthMetadata = 0x200; +EXPORT(signed short) primitiveSetEdgeTransformMetadata = 0x200; +EXPORT(signed short) primitiveSetOffsetMetadata = 0x200; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c b/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c index d23ab1aacc..2198388fec 100644 --- a/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c +++ b/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc from - B3DAcceleratorPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + B3DAcceleratorPlugin VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc */ -static char __buildInfo[] = "B3DAcceleratorPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "B3DAcceleratorPlugin VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc " __DATE__ ; #include "config.h" @@ -82,7 +82,6 @@ EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); EXPORT(sqInt) shutdownModule(void); static sqInt stackLightArrayValue(sqInt stackIndex); static void * stackMaterialValue(sqInt stackIndex); -static void* stackMatrix(sqInt index); static void* stackPrimitiveIndexArrayofSizevalidateforVertexSize(sqInt stackIndex, sqInt nItems, sqInt aBool, sqInt maxIndex); static void* stackPrimitiveVertexArrayofSize(sqInt index, sqInt nItems); @@ -147,7 +146,7 @@ extern sqInt topRemappableOop(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "B3DAcceleratorPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "B3DAcceleratorPlugin VMMaker.oscog-eem.3019 " INT_EXT; @@ -1176,13 +1175,33 @@ primitiveSetTransform(void) { sqInt handle; float *modelViewMatrix; + sqInt oop; + sqInt oop1; float *projectionMatrix; if (!((methodArgumentCount()) == 3)) { return primitiveFail(); } - projectionMatrix = stackMatrix(0); - modelViewMatrix = stackMatrix(1); + /* begin stackMatrix: */ + oop = stackValue(0); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + projectionMatrix = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + projectionMatrix = ((void *) null); + l1: /* end stackMatrix: */; + /* begin stackMatrix: */ + oop1 = stackValue(1); + if ((isWords(oop1)) + && ((slotSizeOf(oop1)) == 16)) { + modelViewMatrix = firstIndexableField(oop1); + goto l2; + } + primitiveFail(); + modelViewMatrix = ((void *) null); + l2: /* end stackMatrix: */; handle = stackIntegerValue(2); if (!(failed())) { b3dxSetTransform(handle, modelViewMatrix, projectionMatrix); @@ -1518,27 +1537,6 @@ stackMaterialValue(sqInt stackIndex) } -/* Load a 4x4 transformation matrix from the interpreter stack. - Return a pointer to the matrix data if successful, nil otherwise. */ - - /* B3DAcceleratorPlugin>>#stackMatrix: */ -static void* -stackMatrix(sqInt index) -{ - sqInt oop; - - oop = stackObjectValue(index); - if (oop == null) { - return null; - } - if ((isWords(oop)) - && ((slotSizeOf(oop)) == 16)) { - return firstIndexableField(oop); - } - return null; -} - - /* Load a primitive index array from the interpreter stack. If aBool is true then check that all the indexes are in the range (1,maxIndex). Return a pointer to the index data if successful, nil @@ -1611,84 +1609,86 @@ static char _m[] = "B3DAcceleratorPlugin"; void* B3DAcceleratorPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveAllocateTexture\000\000", (void*)primitiveAllocateTexture}, - {(void*)_m, "primitiveClearDepthBuffer\000\000", (void*)primitiveClearDepthBuffer}, - {(void*)_m, "primitiveClearViewport\000\000", (void*)primitiveClearViewport}, - {(void*)_m, "primitiveCompositeTexture\000\000", (void*)primitiveCompositeTexture}, - {(void*)_m, "primitiveCreateRenderer\000\000", (void*)primitiveCreateRenderer}, - {(void*)_m, "primitiveCreateRendererFlags\000\000", (void*)primitiveCreateRendererFlags}, - {(void*)_m, "primitiveDestroyRenderer\000\000", (void*)primitiveDestroyRenderer}, - {(void*)_m, "primitiveDestroyTexture\000\000", (void*)primitiveDestroyTexture}, - {(void*)_m, "primitiveDrawArrays\000\001", (void*)primitiveDrawArrays}, - {(void*)_m, "primitiveDrawElements\000\001", (void*)primitiveDrawElements}, - {(void*)_m, "primitiveDrawRangeElements\000\001", (void*)primitiveDrawRangeElements}, - {(void*)_m, "primitiveEnableDrawRangeChecks\000\377", (void*)primitiveEnableDrawRangeChecks}, - {(void*)_m, "primitiveFinishRenderer\000\000", (void*)primitiveFinishRenderer}, - {(void*)_m, "primitiveFlushRenderer\000\000", (void*)primitiveFlushRenderer}, - {(void*)_m, "primitiveGetIntProperty\000\000", (void*)primitiveGetIntProperty}, - {(void*)_m, "primitiveGetRendererColorMasks\000\000", (void*)primitiveGetRendererColorMasks}, - {(void*)_m, "primitiveGetRendererSurfaceDepth\000\000", (void*)primitiveGetRendererSurfaceDepth}, - {(void*)_m, "primitiveGetRendererSurfaceHandle\000\000", (void*)primitiveGetRendererSurfaceHandle}, - {(void*)_m, "primitiveGetRendererSurfaceHeight\000\000", (void*)primitiveGetRendererSurfaceHeight}, - {(void*)_m, "primitiveGetRendererSurfaceWidth\000\000", (void*)primitiveGetRendererSurfaceWidth}, - {(void*)_m, "primitiveIsOverlayRenderer\000\000", (void*)primitiveIsOverlayRenderer}, - {(void*)_m, "primitiveRendererVersion\000\377", (void*)primitiveRendererVersion}, - {(void*)_m, "primitiveRenderVertexBuffer\000\001", (void*)primitiveRenderVertexBuffer}, - {(void*)_m, "primitiveSetBufferRect\000\000", (void*)primitiveSetBufferRect}, - {(void*)_m, "primitiveSetFog\000\000", (void*)primitiveSetFog}, - {(void*)_m, "primitiveSetIntProperty\000\000", (void*)primitiveSetIntProperty}, - {(void*)_m, "primitiveSetLights\000\001", (void*)primitiveSetLights}, - {(void*)_m, "primitiveSetMaterial\000\000", (void*)primitiveSetMaterial}, - {(void*)_m, "primitiveSetTransform\000\000", (void*)primitiveSetTransform}, - {(void*)_m, "primitiveSetVerboseLevel\000\000", (void*)primitiveSetVerboseLevel}, - {(void*)_m, "primitiveSetViewport\000\000", (void*)primitiveSetViewport}, - {(void*)_m, "primitiveSwapRendererBuffers\000\000", (void*)primitiveSwapRendererBuffers}, - {(void*)_m, "primitiveTextureByteSex\000\000", (void*)primitiveTextureByteSex}, - {(void*)_m, "primitiveTextureDepth\000\000", (void*)primitiveTextureDepth}, - {(void*)_m, "primitiveTextureGetColorMasks\000\000", (void*)primitiveTextureGetColorMasks}, - {(void*)_m, "primitiveTextureSurfaceHandle\000\000", (void*)primitiveTextureSurfaceHandle}, - {(void*)_m, "primitiveTextureUpload\000\002", (void*)primitiveTextureUpload}, + {(void*)_m, "primitiveAllocateTexture\000\000\000", (void*)primitiveAllocateTexture}, + {(void*)_m, "primitiveClearDepthBuffer\000\000\000", (void*)primitiveClearDepthBuffer}, + {(void*)_m, "primitiveClearViewport\000\000\000", (void*)primitiveClearViewport}, + {(void*)_m, "primitiveCompositeTexture\000\000\000", (void*)primitiveCompositeTexture}, + {(void*)_m, "primitiveCreateRenderer\000\000\000", (void*)primitiveCreateRenderer}, + {(void*)_m, "primitiveCreateRendererFlags\000\000\000", (void*)primitiveCreateRendererFlags}, + {(void*)_m, "primitiveDestroyRenderer\000\000\000", (void*)primitiveDestroyRenderer}, + {(void*)_m, "primitiveDestroyTexture\000\000\000", (void*)primitiveDestroyTexture}, + {(void*)_m, "primitiveDrawArrays\000\001\000", (void*)primitiveDrawArrays}, + {(void*)_m, "primitiveDrawElements\000\001\000", (void*)primitiveDrawElements}, + {(void*)_m, "primitiveDrawRangeElements\000\001\000", (void*)primitiveDrawRangeElements}, + {(void*)_m, "primitiveEnableDrawRangeChecks\000\377\000", (void*)primitiveEnableDrawRangeChecks}, + {(void*)_m, "primitiveFinishRenderer\000\000\000", (void*)primitiveFinishRenderer}, + {(void*)_m, "primitiveFlushRenderer\000\000\000", (void*)primitiveFlushRenderer}, + {(void*)_m, "primitiveGetIntProperty\000\000\000", (void*)primitiveGetIntProperty}, + {(void*)_m, "primitiveGetRendererColorMasks\000\000\000", (void*)primitiveGetRendererColorMasks}, + {(void*)_m, "primitiveGetRendererSurfaceDepth\000\000\000", (void*)primitiveGetRendererSurfaceDepth}, + {(void*)_m, "primitiveGetRendererSurfaceHandle\000\000\000", (void*)primitiveGetRendererSurfaceHandle}, + {(void*)_m, "primitiveGetRendererSurfaceHeight\000\000\000", (void*)primitiveGetRendererSurfaceHeight}, + {(void*)_m, "primitiveGetRendererSurfaceWidth\000\000\000", (void*)primitiveGetRendererSurfaceWidth}, + {(void*)_m, "primitiveIsOverlayRenderer\000\000\000", (void*)primitiveIsOverlayRenderer}, + {(void*)_m, "primitiveRendererVersion\000\377\000", (void*)primitiveRendererVersion}, + {(void*)_m, "primitiveRenderVertexBuffer\000\001\000", (void*)primitiveRenderVertexBuffer}, + {(void*)_m, "primitiveSetBufferRect\000\000\000", (void*)primitiveSetBufferRect}, + {(void*)_m, "primitiveSetFog\000\000\000", (void*)primitiveSetFog}, + {(void*)_m, "primitiveSetIntProperty\000\000\000", (void*)primitiveSetIntProperty}, + {(void*)_m, "primitiveSetLights\000\001\000", (void*)primitiveSetLights}, + {(void*)_m, "primitiveSetMaterial\000\000\000", (void*)primitiveSetMaterial}, + {(void*)_m, "primitiveSetTransform\000\000\000", (void*)primitiveSetTransform}, + {(void*)_m, "primitiveSetVerboseLevel\000\000\000", (void*)primitiveSetVerboseLevel}, + {(void*)_m, "primitiveSetViewport\000\000\000", (void*)primitiveSetViewport}, + {(void*)_m, "primitiveSwapRendererBuffers\000\000\000", (void*)primitiveSwapRendererBuffers}, + {(void*)_m, "primitiveTextureByteSex\000\000\000", (void*)primitiveTextureByteSex}, + {(void*)_m, "primitiveTextureDepth\000\000\000", (void*)primitiveTextureDepth}, + {(void*)_m, "primitiveTextureGetColorMasks\000\000\000", (void*)primitiveTextureGetColorMasks}, + {(void*)_m, "primitiveTextureSurfaceHandle\000\000\000", (void*)primitiveTextureSurfaceHandle}, + {(void*)_m, "primitiveTextureUpload\000\002\000", (void*)primitiveTextureUpload}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveAllocateTextureAccessorDepth = 0; -EXPORT(signed char) primitiveClearDepthBufferAccessorDepth = 0; -EXPORT(signed char) primitiveClearViewportAccessorDepth = 0; -EXPORT(signed char) primitiveCompositeTextureAccessorDepth = 0; -EXPORT(signed char) primitiveCreateRendererAccessorDepth = 0; -EXPORT(signed char) primitiveCreateRendererFlagsAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyRendererAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyTextureAccessorDepth = 0; -EXPORT(signed char) primitiveDrawArraysAccessorDepth = 1; -EXPORT(signed char) primitiveDrawElementsAccessorDepth = 1; -EXPORT(signed char) primitiveDrawRangeElementsAccessorDepth = 1; -EXPORT(signed char) primitiveFinishRendererAccessorDepth = 0; -EXPORT(signed char) primitiveFlushRendererAccessorDepth = 0; -EXPORT(signed char) primitiveGetIntPropertyAccessorDepth = 0; -EXPORT(signed char) primitiveGetRendererColorMasksAccessorDepth = 0; -EXPORT(signed char) primitiveGetRendererSurfaceDepthAccessorDepth = 0; -EXPORT(signed char) primitiveGetRendererSurfaceHandleAccessorDepth = 0; -EXPORT(signed char) primitiveGetRendererSurfaceHeightAccessorDepth = 0; -EXPORT(signed char) primitiveGetRendererSurfaceWidthAccessorDepth = 0; -EXPORT(signed char) primitiveIsOverlayRendererAccessorDepth = 0; -EXPORT(signed char) primitiveRenderVertexBufferAccessorDepth = 1; -EXPORT(signed char) primitiveSetBufferRectAccessorDepth = 0; -EXPORT(signed char) primitiveSetFogAccessorDepth = 0; -EXPORT(signed char) primitiveSetIntPropertyAccessorDepth = 0; -EXPORT(signed char) primitiveSetLightsAccessorDepth = 1; -EXPORT(signed char) primitiveSetMaterialAccessorDepth = 0; -EXPORT(signed char) primitiveSetTransformAccessorDepth = 0; -EXPORT(signed char) primitiveSetVerboseLevelAccessorDepth = 0; -EXPORT(signed char) primitiveSetViewportAccessorDepth = 0; -EXPORT(signed char) primitiveSwapRendererBuffersAccessorDepth = 0; -EXPORT(signed char) primitiveTextureByteSexAccessorDepth = 0; -EXPORT(signed char) primitiveTextureDepthAccessorDepth = 0; -EXPORT(signed char) primitiveTextureGetColorMasksAccessorDepth = 0; -EXPORT(signed char) primitiveTextureSurfaceHandleAccessorDepth = 0; -EXPORT(signed char) primitiveTextureUploadAccessorDepth = 2; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveAllocateTextureMetadata = 0; +EXPORT(signed short) primitiveClearDepthBufferMetadata = 0; +EXPORT(signed short) primitiveClearViewportMetadata = 0; +EXPORT(signed short) primitiveCompositeTextureMetadata = 0; +EXPORT(signed short) primitiveCreateRendererMetadata = 0; +EXPORT(signed short) primitiveCreateRendererFlagsMetadata = 0; +EXPORT(signed short) primitiveDestroyRendererMetadata = 0; +EXPORT(signed short) primitiveDestroyTextureMetadata = 0; +EXPORT(signed short) primitiveDrawArraysMetadata = 0x100; +EXPORT(signed short) primitiveDrawElementsMetadata = 0x100; +EXPORT(signed short) primitiveDrawRangeElementsMetadata = 0x100; +EXPORT(signed short) primitiveFinishRendererMetadata = 0; +EXPORT(signed short) primitiveFlushRendererMetadata = 0; +EXPORT(signed short) primitiveGetIntPropertyMetadata = 0; +EXPORT(signed short) primitiveGetRendererColorMasksMetadata = 0; +EXPORT(signed short) primitiveGetRendererSurfaceDepthMetadata = 0; +EXPORT(signed short) primitiveGetRendererSurfaceHandleMetadata = 0; +EXPORT(signed short) primitiveGetRendererSurfaceHeightMetadata = 0; +EXPORT(signed short) primitiveGetRendererSurfaceWidthMetadata = 0; +EXPORT(signed short) primitiveIsOverlayRendererMetadata = 0; +EXPORT(signed short) primitiveRenderVertexBufferMetadata = 0x100; +EXPORT(signed short) primitiveSetBufferRectMetadata = 0; +EXPORT(signed short) primitiveSetFogMetadata = 0; +EXPORT(signed short) primitiveSetIntPropertyMetadata = 0; +EXPORT(signed short) primitiveSetLightsMetadata = 0x100; +EXPORT(signed short) primitiveSetMaterialMetadata = 0; +EXPORT(signed short) primitiveSetTransformMetadata = 0; +EXPORT(signed short) primitiveSetVerboseLevelMetadata = 0; +EXPORT(signed short) primitiveSetViewportMetadata = 0; +EXPORT(signed short) primitiveSwapRendererBuffersMetadata = 0; +EXPORT(signed short) primitiveTextureByteSexMetadata = 0; +EXPORT(signed short) primitiveTextureDepthMetadata = 0; +EXPORT(signed short) primitiveTextureGetColorMasksMetadata = 0; +EXPORT(signed short) primitiveTextureSurfaceHandleMetadata = 0; +EXPORT(signed short) primitiveTextureUploadMetadata = 0x200; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c b/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c index d759ed492d..a8b56f0053 100644 --- a/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c +++ b/src/plugins/BMPReadWriterPlugin/BMPReadWriterPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - BMPReadWriterPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + BMPReadWriterPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "BMPReadWriterPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -67,7 +67,7 @@ extern sqInt stackObjectValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "BMPReadWriterPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "BMPReadWriterPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -233,15 +233,17 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "BMPReadWriterPlugin"; void* BMPReadWriterPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveRead24BmpLine\000\001", (void*)primitiveRead24BmpLine}, - {(void*)_m, "primitiveWrite24BmpLine\000\001", (void*)primitiveWrite24BmpLine}, + {(void*)_m, "primitiveRead24BmpLine\000\001\000", (void*)primitiveRead24BmpLine}, + {(void*)_m, "primitiveWrite24BmpLine\000\001\000", (void*)primitiveWrite24BmpLine}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveRead24BmpLineAccessorDepth = 1; -EXPORT(signed char) primitiveWrite24BmpLineAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveRead24BmpLineMetadata = 0x100; +EXPORT(signed short) primitiveWrite24BmpLineMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/BitBltPlugin/BitBltPlugin.c b/src/plugins/BitBltPlugin/BitBltPlugin.c index ad71977913..c086277306 100644 --- a/src/plugins/BitBltPlugin/BitBltPlugin.c +++ b/src/plugins/BitBltPlugin/BitBltPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc from - BitBltSimulation VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + BitBltSimulation VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc */ -static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc " __DATE__ ; #include "config.h" @@ -361,7 +361,7 @@ static int maskTable[33] = { 0, 1, 3, 0, 15, 31, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 65535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1 }; -static const char *moduleName = "BitBltPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "BitBltPlugin VMMaker.oscog-eem.3019 " INT_EXT; static sqInt noHalftone; static sqInt noSource; static sqInt numGCsOnInvocation; @@ -1852,6 +1852,7 @@ copyBitsFallback(operation_t *op, unsigned int flags) ungammaLookupTable = (void *) op->opt.componentAlpha.ungammaLookupTable; } destPPW = 32 / destDepth; + sourcePPW = 32 / sourceDepth; cmBitsPerColor = 0; if (cmMask == 0x1FF) { cmBitsPerColor = 3; @@ -1862,6 +1863,11 @@ copyBitsFallback(operation_t *op, unsigned int flags) if (cmMask == 0x7FFF) { cmBitsPerColor = 5; } + if ((sourceForm == 0) + && (destForm == 0)) { + sourceForm = sourceBits; + destForm = destBits; + } /* begin tryCopyingBitsQuickly */ if (noSource) { done = 0; @@ -5178,8 +5184,7 @@ primitiveCompareColors(void) if (!((isPositiveMachineIntegerObject(stackValue(2))) && ((isPositiveMachineIntegerObject(stackValue(1))) && (isIntegerObject((testID = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } colorA = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(2)) @@ -5189,9 +5194,6 @@ primitiveCompareColors(void) : positive64BitValueOf(stackValue(1))); testID = integerValueOf(testID); rcvr = stackValue(3); - if (failed()) { - return null; - } # if ENABLE_FAST_BLT if (!(loadBitBltFromwarping(rcvr, 0))) { return primitiveFail(); @@ -5622,15 +5624,11 @@ primitivePixelValueAt(void) if (!((isIntegerObject((xVal = stackValue(1)))) && (isIntegerObject((yVal = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } xVal = integerValueOf(xVal); yVal = integerValueOf(yVal); rcvr = stackValue(2); - if (failed()) { - return null; - } if ((xVal < 0) || (yVal < 0)) { _return_value = integerObjectOf(0); @@ -6382,10 +6380,11 @@ rgbComponentAlphawith(sqInt sourceWord, sqInt destinationWord) sqInt srcPix; sqInt v; + + /* This is not a valid optimisation because alpha == 0 can change the destination + due to rounding errors in blending and/or in gamma lookup round-trip + alpha = 0 ifTrue:[^destinationWord]. */ alpha = sourceWord; - if (alpha == 0) { - return destinationWord; - } /* begin partitionedRgbComponentAlpha:dest:nBits:nPartitions: */ /* partition mask starts at the right */ @@ -8268,30 +8267,31 @@ warpPickSourcePixelsxDeltahyDeltahxDeltavyDeltavdstShiftIncflags(sqInt nPixels, static char _m[] = "BitBltPlugin"; void* BitBltPlugin_exports[][3] = { - {(void*)_m, "copyBits\000\003", (void*)copyBits}, + {(void*)_m, "copyBits", (void*)copyBits}, {(void*)_m, "copyBitsFromtoat", (void*)copyBitsFromtoat}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "loadBitBltFrom", (void*)loadBitBltFrom}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveCompareColors\000\003", (void*)primitiveCompareColors}, - {(void*)_m, "primitiveCopyBits\000\003", (void*)primitiveCopyBits}, - {(void*)_m, "primitiveDisplayString\000\003", (void*)primitiveDisplayString}, - {(void*)_m, "primitiveDrawLoop\000\003", (void*)primitiveDrawLoop}, - {(void*)_m, "primitivePixelValueAt\000\001", (void*)primitivePixelValueAt}, - {(void*)_m, "primitiveWarpBits\000\003", (void*)primitiveWarpBits}, + {(void*)_m, "primitiveCompareColors\000\002\000", (void*)primitiveCompareColors}, + {(void*)_m, "primitiveCopyBits\000\002\000", (void*)primitiveCopyBits}, + {(void*)_m, "primitiveDisplayString\000\002\000", (void*)primitiveDisplayString}, + {(void*)_m, "primitiveDrawLoop\000\003\000", (void*)primitiveDrawLoop}, + {(void*)_m, "primitivePixelValueAt\000\001\000", (void*)primitivePixelValueAt}, + {(void*)_m, "primitiveWarpBits\000\002\000", (void*)primitiveWarpBits}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) copyBitsAccessorDepth = 3; -EXPORT(signed char) primitiveCompareColorsAccessorDepth = 3; -EXPORT(signed char) primitiveCopyBitsAccessorDepth = 3; -EXPORT(signed char) primitiveDisplayStringAccessorDepth = 3; -EXPORT(signed char) primitiveDrawLoopAccessorDepth = 3; -EXPORT(signed char) primitivePixelValueAtAccessorDepth = 1; -EXPORT(signed char) primitiveWarpBitsAccessorDepth = 3; +#if SPURVM +EXPORT(signed short) primitiveCompareColorsMetadata = 0x200; +EXPORT(signed short) primitiveCopyBitsMetadata = 0x200; +EXPORT(signed short) primitiveDisplayStringMetadata = 0x200; +EXPORT(signed short) primitiveDrawLoopMetadata = 0x300; +EXPORT(signed short) primitivePixelValueAtMetadata = 0x100; +EXPORT(signed short) primitiveWarpBitsMetadata = 0x200; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c b/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c index 207142292f..f9b103480a 100644 --- a/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c +++ b/src/plugins/BochsIA32Plugin/BochsIA32Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - BochsIA32Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 + BochsIA32Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 */ -static char __buildInfo[] = "BochsIA32Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 " __DATE__ ; +static char __buildInfo[] = "BochsIA32Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 " __DATE__ ; #include "config.h" @@ -171,7 +171,7 @@ extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePo extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "BochsIA32Plugin Cog-eem.435 " INT_EXT; +static const char *moduleName = "BochsIA32Plugin Cog-eem.438 " INT_EXT; /* ProcessorSimulatorPlugin>>#forceStopOnInterrupt */ @@ -228,15 +228,11 @@ primitiveDisassembleAtInMemory(void) logLen = 0; if (!((isIntegerObject((address = stackValue(1)))) && (isWordsOrBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } address = integerValueOf(address); memory = ((char *) (firstIndexableField(stackValue(0)))); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -313,15 +309,11 @@ primitiveFlushICacheFromTo(void) if (!((isIntegerObject((startAddress = stackValue(1)))) && (isIntegerObject((endAddress = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } startAddress = integerValueOf(startAddress); endAddress = integerValueOf(endAddress); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -351,9 +343,6 @@ primitiveIntegerRegisterState(void) sqInt registerStateVector; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -400,9 +389,6 @@ primitiveResetCPU(void) sqInt maybeErr; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -446,17 +432,13 @@ primitiveRunInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -507,16 +489,12 @@ primitiveRunInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -568,17 +546,13 @@ primitiveRunInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -630,17 +604,13 @@ primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -685,16 +655,12 @@ primitiveSingleStepInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -740,17 +706,13 @@ primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -873,33 +835,35 @@ startOfData(sqInt alienOop) static char _m[] = "BochsIA32Plugin"; void* BochsIA32Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDisassembleAtInMemory\000\000", (void*)primitiveDisassembleAtInMemory}, - {(void*)_m, "primitiveErrorAndLog\000\377", (void*)primitiveErrorAndLog}, - {(void*)_m, "primitiveFlushICacheFromTo\000\000", (void*)primitiveFlushICacheFromTo}, - {(void*)_m, "primitiveIntegerRegisterState\000\000", (void*)primitiveIntegerRegisterState}, - {(void*)_m, "primitiveNewCPU\000\377", (void*)primitiveNewCPU}, - {(void*)_m, "primitiveResetCPU\000\000", (void*)primitiveResetCPU}, - {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveDisassembleAtInMemory\000\000\000", (void*)primitiveDisassembleAtInMemory}, + {(void*)_m, "primitiveErrorAndLog\000\377\000", (void*)primitiveErrorAndLog}, + {(void*)_m, "primitiveFlushICacheFromTo\000\000\000", (void*)primitiveFlushICacheFromTo}, + {(void*)_m, "primitiveIntegerRegisterState\000\000\000", (void*)primitiveIntegerRegisterState}, + {(void*)_m, "primitiveNewCPU\000\377\000", (void*)primitiveNewCPU}, + {(void*)_m, "primitiveResetCPU\000\000\000", (void*)primitiveResetCPU}, + {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveDisassembleAtInMemoryAccessorDepth = 0; -EXPORT(signed char) primitiveFlushICacheFromToAccessorDepth = 0; -EXPORT(signed char) primitiveIntegerRegisterStateAccessorDepth = 0; -EXPORT(signed char) primitiveResetCPUAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveDisassembleAtInMemoryMetadata = 0; +EXPORT(signed short) primitiveFlushICacheFromToMetadata = 0; +EXPORT(signed short) primitiveIntegerRegisterStateMetadata = 0; +EXPORT(signed short) primitiveResetCPUMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/BochsX64Plugin/BochsX64Plugin.c b/src/plugins/BochsX64Plugin/BochsX64Plugin.c index fc94e63181..b5375b117f 100644 --- a/src/plugins/BochsX64Plugin/BochsX64Plugin.c +++ b/src/plugins/BochsX64Plugin/BochsX64Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - BochsX64Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 + BochsX64Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 */ -static char __buildInfo[] = "BochsX64Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 " __DATE__ ; +static char __buildInfo[] = "BochsX64Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 " __DATE__ ; #include "config.h" @@ -171,7 +171,7 @@ extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePo extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "BochsX64Plugin Cog-eem.435 " INT_EXT; +static const char *moduleName = "BochsX64Plugin Cog-eem.438 " INT_EXT; /* ProcessorSimulatorPlugin>>#forceStopOnInterrupt */ @@ -228,15 +228,11 @@ primitiveDisassembleAtInMemory(void) logLen = 0; if (!((isIntegerObject((address = stackValue(1)))) && (isWordsOrBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } address = integerValueOf(address); memory = ((char *) (firstIndexableField(stackValue(0)))); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -313,15 +309,11 @@ primitiveFlushICacheFromTo(void) if (!((isIntegerObject((startAddress = stackValue(1)))) && (isIntegerObject((endAddress = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } startAddress = integerValueOf(startAddress); endAddress = integerValueOf(endAddress); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -351,9 +343,6 @@ primitiveIntegerRegisterState(void) sqInt registerStateVector; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -400,9 +389,6 @@ primitiveResetCPU(void) sqInt maybeErr; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -446,17 +432,13 @@ primitiveRunInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -507,16 +489,12 @@ primitiveRunInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -568,17 +546,13 @@ primitiveRunInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -630,17 +604,13 @@ primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -685,16 +655,12 @@ primitiveSingleStepInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -740,17 +706,13 @@ primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -873,33 +835,35 @@ startOfData(sqInt alienOop) static char _m[] = "BochsX64Plugin"; void* BochsX64Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDisassembleAtInMemory\000\000", (void*)primitiveDisassembleAtInMemory}, - {(void*)_m, "primitiveErrorAndLog\000\377", (void*)primitiveErrorAndLog}, - {(void*)_m, "primitiveFlushICacheFromTo\000\000", (void*)primitiveFlushICacheFromTo}, - {(void*)_m, "primitiveIntegerRegisterState\000\000", (void*)primitiveIntegerRegisterState}, - {(void*)_m, "primitiveNewCPU\000\377", (void*)primitiveNewCPU}, - {(void*)_m, "primitiveResetCPU\000\000", (void*)primitiveResetCPU}, - {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveDisassembleAtInMemory\000\000\000", (void*)primitiveDisassembleAtInMemory}, + {(void*)_m, "primitiveErrorAndLog\000\377\000", (void*)primitiveErrorAndLog}, + {(void*)_m, "primitiveFlushICacheFromTo\000\000\000", (void*)primitiveFlushICacheFromTo}, + {(void*)_m, "primitiveIntegerRegisterState\000\000\000", (void*)primitiveIntegerRegisterState}, + {(void*)_m, "primitiveNewCPU\000\377\000", (void*)primitiveNewCPU}, + {(void*)_m, "primitiveResetCPU\000\000\000", (void*)primitiveResetCPU}, + {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveDisassembleAtInMemoryAccessorDepth = 0; -EXPORT(signed char) primitiveFlushICacheFromToAccessorDepth = 0; -EXPORT(signed char) primitiveIntegerRegisterStateAccessorDepth = 0; -EXPORT(signed char) primitiveResetCPUAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveDisassembleAtInMemoryMetadata = 0; +EXPORT(signed short) primitiveFlushICacheFromToMetadata = 0; +EXPORT(signed short) primitiveIntegerRegisterStateMetadata = 0; +EXPORT(signed short) primitiveResetCPUMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/CameraPlugin/CameraPlugin.c b/src/plugins/CameraPlugin/CameraPlugin.c index 69ea35e824..c8f5c1756b 100644 --- a/src/plugins/CameraPlugin/CameraPlugin.c +++ b/src/plugins/CameraPlugin/CameraPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2957 uuid: 1905cffe-ff84-45bc-b423-79e7978ecfd7 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - CameraPlugin VMMaker.oscog-eem.2957 uuid: 1905cffe-ff84-45bc-b423-79e7978ecfd7 + CameraPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "CameraPlugin VMMaker.oscog-eem.2957 uuid: 1905cffe-ff84-45bc-b423-79e7978ecfd7 " __DATE__ ; +static char __buildInfo[] = "CameraPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -112,7 +112,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "CameraPlugin VMMaker.oscog-eem.2957 " INT_EXT; +static const char *moduleName = "CameraPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -487,34 +487,36 @@ static char _m[] = "CameraPlugin"; void* CameraPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primAcknowledgeFrame\000\000", (void*)primAcknowledgeFrame}, - {(void*)_m, "primCameraName\000\000", (void*)primCameraName}, - {(void*)_m, "primCameraUID\000\000", (void*)primCameraUID}, - {(void*)_m, "primCloseCamera\000\000", (void*)primCloseCamera}, - {(void*)_m, "primFrameExtent\000\000", (void*)primFrameExtent}, - {(void*)_m, "primGetCameraSemaphore\000\000", (void*)primGetCameraSemaphore}, - {(void*)_m, "primGetFrame\000\000", (void*)primGetFrame}, - {(void*)_m, "primGetParam\000\000", (void*)primGetParam}, - {(void*)_m, "primOpenCamera\000\000", (void*)primOpenCamera}, - {(void*)_m, "primSetCameraBuffers\000\000", (void*)primSetCameraBuffers}, - {(void*)_m, "primSetCameraSemaphore\000\000", (void*)primSetCameraSemaphore}, + {(void*)_m, "primAcknowledgeFrame\000\000\000", (void*)primAcknowledgeFrame}, + {(void*)_m, "primCameraName\000\000\000", (void*)primCameraName}, + {(void*)_m, "primCameraUID\000\000\000", (void*)primCameraUID}, + {(void*)_m, "primCloseCamera\000\000\000", (void*)primCloseCamera}, + {(void*)_m, "primFrameExtent\000\000\000", (void*)primFrameExtent}, + {(void*)_m, "primGetCameraSemaphore\000\000\000", (void*)primGetCameraSemaphore}, + {(void*)_m, "primGetFrame\000\000\000", (void*)primGetFrame}, + {(void*)_m, "primGetParam\000\000\000", (void*)primGetParam}, + {(void*)_m, "primOpenCamera\000\000\000", (void*)primOpenCamera}, + {(void*)_m, "primSetCameraBuffers\000\000\000", (void*)primSetCameraBuffers}, + {(void*)_m, "primSetCameraSemaphore\000\000\000", (void*)primSetCameraSemaphore}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primAcknowledgeFrameAccessorDepth = 0; -EXPORT(signed char) primCameraNameAccessorDepth = 0; -EXPORT(signed char) primCameraUIDAccessorDepth = 0; -EXPORT(signed char) primCloseCameraAccessorDepth = 0; -EXPORT(signed char) primFrameExtentAccessorDepth = 0; -EXPORT(signed char) primGetCameraSemaphoreAccessorDepth = 0; -EXPORT(signed char) primGetFrameAccessorDepth = 0; -EXPORT(signed char) primGetParamAccessorDepth = 0; -EXPORT(signed char) primOpenCameraAccessorDepth = 0; -EXPORT(signed char) primSetCameraBuffersAccessorDepth = 0; -EXPORT(signed char) primSetCameraSemaphoreAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primAcknowledgeFrameMetadata = 0; +EXPORT(signed short) primCameraNameMetadata = 0; +EXPORT(signed short) primCameraUIDMetadata = 0; +EXPORT(signed short) primCloseCameraMetadata = 0; +EXPORT(signed short) primFrameExtentMetadata = 0; +EXPORT(signed short) primGetCameraSemaphoreMetadata = 0; +EXPORT(signed short) primGetFrameMetadata = 0; +EXPORT(signed short) primGetParamMetadata = 0; +EXPORT(signed short) primOpenCameraMetadata = 0; +EXPORT(signed short) primSetCameraBuffersMetadata = 0; +EXPORT(signed short) primSetCameraSemaphoreMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c b/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c index 983d3ec1ca..3ad9c353ec 100644 --- a/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c +++ b/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - ClipboardExtendedPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + ClipboardExtendedPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "ClipboardExtendedPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "ClipboardExtendedPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -90,7 +90,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ClipboardExtendedPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "ClipboardExtendedPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -119,15 +119,11 @@ ioAddClipboardData(void) if (!((isBytes(stackValue(1))) && (isBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } clipboard = stackValue(2); data = ((char *) (firstIndexableField(stackValue(1)))); aFormat = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } clipboardAddress = positiveMachineIntegerValueOf(clipboard); dataLength = slotSizeOf(((sqInt)(sqIntptr_t)(data) - BaseHeaderSize)); formatLength = slotSizeOf(((sqInt)(sqIntptr_t)(aFormat) - BaseHeaderSize)); @@ -146,9 +142,6 @@ ioClearClipboard(void) usqIntptr_t clipboardAddress; clipboard = stackValue(0); - if (failed()) { - return null; - } clipboardAddress = positiveMachineIntegerValueOf(clipboard); sqPasteboardClear(clipboardAddress); if (!(failed())) { @@ -183,14 +176,10 @@ ioGetClipboardFormat(void) sqInt _return_value; if (!(isIntegerObject((formatNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } clipboard = stackValue(1); formatNumber = integerValueOf(formatNumber); - if (failed()) { - return null; - } clipboardAddress = positiveMachineIntegerValueOf(clipboard); itemCount = sqPasteboardGetItemCount(clipboardAddress); if (itemCount > 0) { @@ -217,14 +206,10 @@ ioReadClipboardData(void) sqInt _return_value; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } clipboard = stackValue(1); format = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } clipboardAddress = positiveMachineIntegerValueOf(clipboard); formatLength = slotSizeOf(((sqInt)(sqIntptr_t)(format) - BaseHeaderSize)); if (!(failed())) { @@ -283,20 +268,22 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "ClipboardExtendedPlugin"; void* ClipboardExtendedPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "ioAddClipboardData\000\000", (void*)ioAddClipboardData}, - {(void*)_m, "ioClearClipboard\000\000", (void*)ioClearClipboard}, - {(void*)_m, "ioCreateClipboard\000\377", (void*)ioCreateClipboard}, - {(void*)_m, "ioGetClipboardFormat\000\000", (void*)ioGetClipboardFormat}, - {(void*)_m, "ioReadClipboardData\000\000", (void*)ioReadClipboardData}, + {(void*)_m, "ioAddClipboardData", (void*)ioAddClipboardData}, + {(void*)_m, "ioClearClipboard", (void*)ioClearClipboard}, + {(void*)_m, "ioCreateClipboard", (void*)ioCreateClipboard}, + {(void*)_m, "ioGetClipboardFormat", (void*)ioGetClipboardFormat}, + {(void*)_m, "ioReadClipboardData", (void*)ioReadClipboardData}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) ioAddClipboardDataAccessorDepth = 0; -EXPORT(signed char) ioClearClipboardAccessorDepth = 0; -EXPORT(signed char) ioGetClipboardFormatAccessorDepth = 0; -EXPORT(signed char) ioReadClipboardDataAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) ioAddClipboardDataMetadata = 0; +EXPORT(signed short) ioClearClipboardMetadata = 0; +EXPORT(signed short) ioGetClipboardFormatMetadata = 0; +EXPORT(signed short) ioReadClipboardDataMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/CroquetPlugin/CroquetPlugin.c b/src/plugins/CroquetPlugin/CroquetPlugin.c index 9e4b66aaec..bb36f9b117 100644 --- a/src/plugins/CroquetPlugin/CroquetPlugin.c +++ b/src/plugins/CroquetPlugin/CroquetPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc from - CroquetPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + CroquetPlugin VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc */ -static char __buildInfo[] = "CroquetPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "CroquetPlugin VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc " __DATE__ ; #include "config.h" @@ -34,6 +34,10 @@ static char __buildInfo[] = "CroquetPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e #endif +/*** Constants ***/ +#define PrimErrNoMemory 9 + + /*** Function Prototypes ***/ EXPORT(const char*) getModuleName(void); EXPORT(sqInt) primitiveAdj3(void); @@ -51,8 +55,6 @@ EXPORT(sqInt) primitiveTransformVector3(void); EXPORT(sqInt) primitiveTransposeMatrix(void); EXPORT(sqInt) primitiveTriBoxIntersects(void); EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); -static void* stackMatrix(sqInt index); -static void* stackVector3(sqInt index); static sqInt transformMatrixwithinto(float *src, float *arg, float *dst); @@ -68,18 +70,21 @@ static sqInt (*instantiateClassindexableSize)(sqInt classPointer, sqInt size); static sqInt (*isBytes)(sqInt oop); static sqInt (*isWords)(sqInt oop); static sqInt (*methodArgumentCount)(void); +static sqInt (*methodReturnBool)(sqInt boolean); +static sqInt (*methodReturnFloat)(double aFloat); +static sqInt (*methodReturnReceiver)(void); +static sqInt (*methodReturnValue)(sqInt oop); static sqInt (*pop)(sqInt nItems); -static sqInt (*popthenPush)(sqInt nItems, sqInt oop); static sqInt (*popRemappableOop)(void); static sqInt (*positive32BitIntegerFor)(unsigned int integerValue); static sqInt (*primitiveFail)(void); +static sqInt (*primitiveFailFor)(sqInt reasonCode); static sqInt (*push)(sqInt object); -static sqInt (*pushBool)(sqInt trueOrFalse); -static sqInt (*pushFloat)(double f); static sqInt (*pushRemappableOop)(sqInt oop); static sqInt (*slotSizeOf)(sqInt oop); static sqInt (*stackIntegerValue)(sqInt offset); static sqInt (*stackObjectValue)(sqInt offset); +static sqInt (*stackValue)(sqInt offset); static sqInt (*storePointerofObjectwithValue)(sqInt index, sqInt oop, sqInt valuePointer); #else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ extern sqInt byteSizeOf(sqInt oop); @@ -91,23 +96,26 @@ extern sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size); extern sqInt isBytes(sqInt oop); extern sqInt isWords(sqInt oop); extern sqInt methodArgumentCount(void); +extern sqInt methodReturnBool(sqInt boolean); +extern sqInt methodReturnFloat(double aFloat); +extern sqInt methodReturnReceiver(void); +extern sqInt methodReturnValue(sqInt oop); extern sqInt pop(sqInt nItems); -extern sqInt popthenPush(sqInt nItems, sqInt oop); extern sqInt popRemappableOop(void); extern sqInt positive32BitIntegerFor(unsigned int integerValue); extern sqInt primitiveFail(void); +extern sqInt primitiveFailFor(sqInt reasonCode); extern sqInt push(sqInt object); -extern sqInt pushBool(sqInt trueOrFalse); -extern sqInt pushFloat(double f); extern sqInt pushRemappableOop(sqInt oop); extern sqInt slotSizeOf(sqInt oop); extern sqInt stackIntegerValue(sqInt offset); extern sqInt stackObjectValue(sqInt offset); +extern sqInt stackValue(sqInt offset); extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePointer); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "CroquetPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "CroquetPlugin VMMaker.oscog-eem.3019 " INT_EXT; @@ -132,7 +140,6 @@ getModuleName(void) EXPORT(sqInt) primitiveAdj3(void) { - sqInt argc; const int c11 = 0; const int c12 = 1; const int c13 = 2; @@ -142,7 +149,7 @@ primitiveAdj3(void) const int c31 = 8; const int c32 = 9; const int c33 = 10; - float *dst; + float * dst; sqInt dstOop; double m11; double m12; @@ -153,7 +160,7 @@ primitiveAdj3(void) double m31; double m32; double m33; - float *src; + float * src; sqInt srcOop; @@ -161,17 +168,15 @@ primitiveAdj3(void) /* */ /* */ /* then we need the following no-op to make Smalltalk shut up about vars not being initted. */ - argc = methodArgumentCount(); - if (!(argc == 1)) { - return primitiveFail(); + srcOop = stackObjectValue(1); + dstOop = stackObjectValue(0); + if (failed()) { + return null; } - flag("stackArgv"); - srcOop = stackObjectValue(argc); - src = firstIndexableField(srcOop); - dstOop = stackObjectValue(argc - 1); + src = ((float *) (firstIndexableField(srcOop))); /* read in the source matrix 3x3, which contains the encoded rotation and scale factors */ - dst = firstIndexableField(dstOop); + dst = ((float *) (firstIndexableField(dstOop))); m11 = src[c11]; m12 = src[c12]; m13 = src[c13]; @@ -193,8 +198,7 @@ primitiveAdj3(void) dst[c13] = ((m12 * m23) - (m13 * m22)); dst[c23] = (0.0 - ((m11 * m23) - (m13 * m21))); dst[c33] = ((m11 * m22) - (m12 * m21)); - popthenPush(argc + 1, dstOop); - return 0; + return methodReturnValue(dstOop); } @@ -209,6 +213,7 @@ primitiveAdj3(void) Return value: x@y - updated key state value */ +/* Align in case the compiler identifies and generates vector instructions */ /* CroquetPlugin>>#primitiveARC4Transform */ EXPORT(sqInt) @@ -236,27 +241,20 @@ primitiveARC4Transform(void) } y = stackIntegerValue(0); x = stackIntegerValue(1); - mOop = stackObjectValue(2); + mOop = stackValue(2); stopIndex = stackIntegerValue(3); startIndex = stackIntegerValue(4); - bufOop = stackObjectValue(5); + bufOop = stackValue(5); if (failed()) { return null; } if (!((isBytes(mOop)) - && (isBytes(bufOop)))) { - return primitiveFail(); - } - if (!((byteSizeOf(mOop)) == 0x100)) { - return primitiveFail(); - } - bufSize = byteSizeOf(bufOop); - if (!((startIndex > 0) - && (startIndex <= bufSize))) { - return primitiveFail(); - } - if (!((stopIndex >= startIndex) - && (stopIndex <= bufSize))) { + && ((isBytes(bufOop)) + && (((byteSizeOf(mOop)) == 0x100) + && ((startIndex > 0) + && ((startIndex <= ((bufSize = byteSizeOf(bufOop)))) + && ((stopIndex >= startIndex) + && (stopIndex <= bufSize)))))))) { return primitiveFail(); } m = firstIndexableField(mOop); @@ -272,6 +270,17 @@ primitiveARC4Transform(void) buffer[i] = ((buffer[i]) ^ mask); } ptOop = instantiateClassindexableSize(classPoint(), 0); +# if SPURVM + xOop = positive32BitIntegerFor(x); + yOop = positive32BitIntegerFor(y); + if ((ptOop == null) + || ((xOop == null) + || (yOop == null))) { + return primitiveFailFor(PrimErrNoMemory); + } + storePointerofObjectwithValue(0, ptOop, xOop); + storePointerofObjectwithValue(1, ptOop, yOop); +# else // SPURVM pushRemappableOop(ptOop); xOop = positive32BitIntegerFor(x); pushRemappableOop(xOop); @@ -280,8 +289,8 @@ primitiveARC4Transform(void) ptOop = popRemappableOop(); storePointerofObjectwithValue(0, ptOop, xOop); storePointerofObjectwithValue(1, ptOop, yOop); - pop((methodArgumentCount()) + 1); - return push(ptOop); +# endif // SPURVM + return methodReturnValue(ptOop); } @@ -291,8 +300,6 @@ primitiveARC4Transform(void) EXPORT(sqInt) primitiveDet3(void) { - sqInt argc; - double det; double m11; double m12; double m13; @@ -302,16 +309,20 @@ primitiveDet3(void) double m31; double m32; double m33; - float *src; + float * src; sqInt srcOop; - argc = methodArgumentCount(); - if (!(argc == 0)) { - return primitiveFail(); + + /* Load element vars using C version of Matrix4x4 storage, as 0-based, 1-dimensional array: + 0 1 2 3 + 4 5 6 7 + 8 9 10 11 + */ + srcOop = stackObjectValue(0); + if (failed()) { + return null; } - flag("stackArgv"); - srcOop = stackObjectValue(argc); - src = firstIndexableField(srcOop); + src = ((float *) (firstIndexableField(srcOop))); m11 = src[0]; m12 = src[1]; m13 = src[2]; @@ -320,12 +331,8 @@ primitiveDet3(void) m23 = src[6]; m31 = src[8]; m32 = src[9]; - - /* do the actual work */ m33 = src[10]; - det = ((m11 * ((m22 * m33) - (m23 * m32))) + (m12 * ((m23 * m31) - (m21 * m33)))) + (m13 * ((m21 * m32) - (m22 * m31))); - pop(argc + 1); - return pushFloat(det); + return methodReturnFloat(((m11 * ((m22 * m33) - (m23 * m32))) + (m12 * ((m23 * m31) - (m21 * m33)))) + (m13 * ((m21 * m32) - (m22 * m31)))); } @@ -336,28 +343,13 @@ EXPORT(sqInt) primitiveGatherEntropy(void) { sqInt bufOop; - void *bufPtr; - sqInt bufSize; - sqInt okay; - if (!((methodArgumentCount()) == 1)) { - return primitiveFail(); - } - bufOop = stackObjectValue(0); - if (failed()) { - return null; - } - if (!(isBytes(bufOop))) { + bufOop = stackValue(0); + if (!((isBytes(bufOop)) + && (ioGatherEntropy(firstIndexableField(bufOop), byteSizeOf(bufOop))))) { return primitiveFail(); } - bufSize = byteSizeOf(bufOop); - bufPtr = firstIndexableField(bufOop); - okay = ioGatherEntropy(bufPtr, bufSize); - if (!okay) { - return primitiveFail(); - } - pop((methodArgumentCount()) + 1); - return pushBool(1); + return methodReturnBool(1); } @@ -373,6 +365,7 @@ primitiveInplaceHouseHolderInvert(void) sqInt j; sqInt k; double m[4][4]; + sqInt oop; sqInt r; float *rcvr; double s; @@ -380,7 +373,15 @@ primitiveInplaceHouseHolderInvert(void) double sum; double x[4][4] = { {1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1} }; - rcvr = stackMatrix(0); + /* begin stackMatrix: */ + oop = stackValue(0); + rcvr = ((isWords(oop)) + && ((slotSizeOf(oop)) == 16) + ? ((float *) (firstIndexableField(oop))) + : 0); + if (!rcvr) { + return primitiveFail(); + } for (i = 0; i <= 3; i += 1) { for (j = 0; j <= 3; j += 1) { (m[i])[j] = (rcvr[(i * 4) + j]); @@ -453,7 +454,6 @@ primitiveInplaceHouseHolderInvert(void) EXPORT(sqInt) primitiveInverseByAdjoint(void) { - sqInt argc; const int c11 = 0; const int c12 = 1; const int c13 = 2; @@ -467,7 +467,7 @@ primitiveInverseByAdjoint(void) const int c33 = 10; const int c34 = 11; double det; - float *dst; + float * dst; sqInt dstOop; double m11; double m12; @@ -478,7 +478,7 @@ primitiveInverseByAdjoint(void) double m31; double m32; double m33; - float *src; + float * src; sqInt srcOop; double x; double y; @@ -486,17 +486,15 @@ primitiveInverseByAdjoint(void) /* then we need the following no-op to make Smalltalk shut up about vars not being initted. */ - argc = methodArgumentCount(); - if (!(argc == 1)) { - return primitiveFail(); + srcOop = stackValue(1); + dstOop = stackValue(0); + if (failed()) { + return null; } - flag("stackArgv"); - srcOop = stackObjectValue(argc); - src = firstIndexableField(srcOop); - dstOop = stackObjectValue(argc - 1); + src = ((float *) (firstIndexableField(srcOop))); /* read in the source matrix 3x3, which contains the encoded rotation and scale factors */ - dst = firstIndexableField(dstOop); + dst = ((float *) (firstIndexableField(dstOop))); m11 = src[c11]; m12 = src[c12]; m13 = src[c13]; @@ -542,40 +540,30 @@ primitiveInverseByAdjoint(void) dst[c14] = (0.0 - (((x * m11) + (y * m12)) + (z * m13))); dst[c24] = (0.0 - (((x * m21) + (y * m22)) + (z * m23))); dst[c34] = (0.0 - (((x * m31) + (y * m32)) + (z * m33))); - pop(argc + 1); - return push(dstOop); + return methodReturnValue(dstOop); } /* Perform an MD5 transform of input */ +/* Align in case the compiler identifies and generates vector instructions */ /* CroquetPlugin>>#primitiveMD5Transform */ EXPORT(sqInt) primitiveMD5Transform(void) { - unsigned int *buffer; sqInt bufOop; - unsigned int *hash; sqInt hashOop; - if (!((methodArgumentCount()) == 2)) { - return primitiveFail(); - } - hashOop = stackObjectValue(0); + hashOop = stackValue(0); + bufOop = stackValue(1); if (!((isWords(hashOop)) - && ((slotSizeOf(hashOop)) == 4))) { - return primitiveFail(); - } - hash = firstIndexableField(hashOop); - bufOop = stackObjectValue(1); - if (!((isWords(bufOop)) - && ((slotSizeOf(bufOop)) == 16))) { + && (((slotSizeOf(hashOop)) == 4) + && ((isWords(bufOop)) + && ((slotSizeOf(bufOop)) == 16))))) { return primitiveFail(); } - buffer = firstIndexableField(bufOop); - MD5Transform(hash, buffer); - pop((methodArgumentCount()) + 1); - return push(bufOop); + MD5Transform(firstIndexableField(hashOop), firstIndexableField(bufOop)); + return methodReturnValue(bufOop); } @@ -592,20 +580,10 @@ EXPORT(sqInt) primitiveOptimizeVertexIndicesForCacheLocality(void) { sqInt byteSize; - void *indices; sqInt indicesOop; - sqInt result; sqInt triCount; - - /* Get the oop of the IntegerArray containing the indices. */ - if (!((methodArgumentCount()) == 1)) { - return primitiveFail(); - } - indicesOop = stackObjectValue(0); - if (failed()) { - return null; - } + indicesOop = stackValue(0); if (!(isWords(indicesOop))) { return primitiveFail(); } @@ -614,54 +592,44 @@ primitiveOptimizeVertexIndicesForCacheLocality(void) if (!((triCount * 12) == byteSize)) { return primitiveFail(); } - indices = firstIndexableField(indicesOop); - if (failed()) { - return null; - } - result = optimizeVertexIndices((int*)indices, triCount); - if (!(result == 0)) { - - /* success */ + if ((optimizeVertexIndices(firstIndexableField(indicesOop), triCount)) != 0) { return primitiveFail(); } - return pop(1); + return methodReturnReceiver(); } /* CroquetPlugin>>#primitiveOrthoNormInverseMatrix */ EXPORT(sqInt) primitiveOrthoNormInverseMatrix(void) { - float *dst; + float * dst; sqInt dstOop; double rx; double ry; double rz; - float *src; + float * src; sqInt srcOop; double x; double y; double z; - if (!((methodArgumentCount()) == 0)) { - return primitiveFail(); - } - srcOop = stackObjectValue(0); - if (failed()) { - return null; - } + srcOop = stackValue(0); if (!((isWords(srcOop)) && ((slotSizeOf(srcOop)) == 16))) { return primitiveFail(); } - - /* reload srcOop in case of GC */ dstOop = cloneObject(srcOop); - srcOop = stackObjectValue(0); - src = firstIndexableField(srcOop); + if (dstOop == 0) { + return primitiveFail(); + } +# if !SPURVM + srcOop = stackValue(0); +# endif + src = ((float *) (firstIndexableField(srcOop))); /* Transpose upper 3x3 matrix */ /* dst at: 0 put: (src at: 0). */ - dst = firstIndexableField(dstOop); + dst = ((float *) (firstIndexableField(dstOop))); dst[1] = (src[4]); dst[2] = (src[8]); dst[4] = (src[1]); @@ -674,43 +642,40 @@ primitiveOrthoNormInverseMatrix(void) rx = ((x * (dst[0])) + (y * (dst[1]))) + (z * (dst[2])); ry = ((x * (dst[4])) + (y * (dst[5]))) + (z * (dst[6])); rz = ((x * (dst[8])) + (y * (dst[9]))) + (z * (dst[10])); - dst[3] = (((float) (0.0 - rx))); - dst[7] = (((float) (0.0 - ry))); - dst[11] = (((float) (0.0 - rz))); - popthenPush(1, dstOop); - return 0; + dst[3] = (0.0 - rx); + dst[7] = (0.0 - ry); + dst[11] = (0.0 - rz); + return methodReturnValue(dstOop); } /* CroquetPlugin>>#primitiveTransformDirection */ EXPORT(sqInt) primitiveTransformDirection(void) { - float *matrix; + float * matrix; + sqInt oop; double rx; double ry; double rz; sqInt v3Oop; - float *vertex; + float * vertex; double x; double y; double z; - if (!((methodArgumentCount()) == 1)) { - return primitiveFail(); - } - v3Oop = stackObjectValue(0); - if (failed()) { - return null; - } - if (!((isWords(v3Oop)) - && ((slotSizeOf(v3Oop)) == 3))) { - return primitiveFail(); - } - vertex = firstIndexableField(v3Oop); - matrix = stackMatrix(1); - if (matrix == null) { + /* begin stackMatrix: */ + oop = stackValue(1); + matrix = ((isWords(oop)) + && ((slotSizeOf(oop)) == 16) + ? ((float *) (firstIndexableField(oop))) + : 0); + v3Oop = stackValue(0); + if (!((matrix != null) + && ((isWords(v3Oop)) + && ((slotSizeOf(v3Oop)) == 3)))) { return primitiveFail(); } + vertex = ((float *) (firstIndexableField(v3Oop))); x = vertex[0]; y = vertex[1]; z = vertex[2]; @@ -718,12 +683,14 @@ primitiveTransformDirection(void) ry = ((x * (matrix[4])) + (y * (matrix[5]))) + (z * (matrix[6])); rz = ((x * (matrix[8])) + (y * (matrix[9]))) + (z * (matrix[10])); v3Oop = cloneObject(v3Oop); - vertex = firstIndexableField(v3Oop); - vertex[0] = (((float) rx)); - vertex[1] = (((float) ry)); - vertex[2] = (((float) rz)); - pop(2); - return push(v3Oop); + if (v3Oop == 0) { + return primitiveFailFor(PrimErrNoMemory); + } + vertex = ((float *) (firstIndexableField(v3Oop))); + vertex[0] = rx; + vertex[1] = ry; + vertex[2] = rz; + return methodReturnValue(v3Oop); } @@ -738,20 +705,38 @@ primitiveTransformMatrixWithInto(void) double c3; double c4; sqInt i; - float *m1; + float * m1; float *m11; - float *m2; + float * m2; float *m21; - float *m3; + float * m3; float *m31; - - m3 = stackMatrix(0); - m2 = stackMatrix(1); - m1 = stackMatrix(2); - if (((m1 == null) || (m2 == null)) || (m3 == null)) { - return primitiveFail(); - } - if (m2 == m3) { + sqInt oop; + sqInt oop1; + sqInt oop2; + + /* begin stackMatrix: */ + oop = stackValue(0); + m3 = ((isWords(oop)) + && ((slotSizeOf(oop)) == 16) + ? ((float *) (firstIndexableField(oop))) + : 0); + /* begin stackMatrix: */ + oop1 = stackValue(1); + m2 = ((isWords(oop1)) + && ((slotSizeOf(oop1)) == 16) + ? ((float *) (firstIndexableField(oop1))) + : 0); + /* begin stackMatrix: */ + oop2 = stackValue(2); + m1 = ((isWords(oop2)) + && ((slotSizeOf(oop2)) == 16) + ? ((float *) (firstIndexableField(oop2))) + : 0); + if ((m1 == null) + || ((m2 == null) + || ((m3 == null) + || (m2 == m3)))) { return primitiveFail(); } /* begin transformMatrix:with:into: */ @@ -761,12 +746,12 @@ primitiveTransformMatrixWithInto(void) for (i = 0; i <= 3; i += 1) { /* Compute next row */ - c1 = ((((((double) (m11[0]) )) * (((double) (m21[0]) ))) + ((((double) (m11[1]) )) * (((double) (m21[4]) )))) + ((((double) (m11[2]) )) * (((double) (m21[8]) )))) + ((((double) (m11[3]) )) * (((double) (m21[12]) ))); - c2 = ((((((double) (m11[0]) )) * (((double) (m21[1]) ))) + ((((double) (m11[1]) )) * (((double) (m21[5]) )))) + ((((double) (m11[2]) )) * (((double) (m21[9]) )))) + ((((double) (m11[3]) )) * (((double) (m21[13]) ))); - c3 = ((((((double) (m11[0]) )) * (((double) (m21[2]) ))) + ((((double) (m11[1]) )) * (((double) (m21[6]) )))) + ((((double) (m11[2]) )) * (((double) (m21[10]) )))) + ((((double) (m11[3]) )) * (((double) (m21[14]) ))); + c1 = ((((m11[0]) * (m21[0])) + ((m11[1]) * (m21[4]))) + ((m11[2]) * (m21[8]))) + ((m11[3]) * (m21[12])); + c2 = ((((m11[0]) * (m21[1])) + ((m11[1]) * (m21[5]))) + ((m11[2]) * (m21[9]))) + ((m11[3]) * (m21[13])); + c3 = ((((m11[0]) * (m21[2])) + ((m11[1]) * (m21[6]))) + ((m11[2]) * (m21[10]))) + ((m11[3]) * (m21[14])); /* Store result */ - c4 = ((((((double) (m11[0]) )) * (((double) (m21[3]) ))) + ((((double) (m11[1]) )) * (((double) (m21[7]) )))) + ((((double) (m11[2]) )) * (((double) (m21[11]) )))) + ((((double) (m11[3]) )) * (((double) (m21[15]) ))); + c4 = ((((m11[0]) * (m21[3])) + ((m11[1]) * (m21[7]))) + ((m11[2]) * (m21[11]))) + ((m11[3]) * (m21[15])); m31[0] = c1; m31[1] = c2; m31[2] = c3; @@ -774,40 +759,38 @@ primitiveTransformMatrixWithInto(void) m11 += 4; m31 += 4; } - return pop(3); + return methodReturnReceiver(); } /* CroquetPlugin>>#primitiveTransformVector3 */ EXPORT(sqInt) primitiveTransformVector3(void) { - float *matrix; + float * matrix; + sqInt oop; double rw; double rx; double ry; double rz; sqInt v3Oop; - float *vertex; + float * vertex; double x; double y; double z; - if (!((methodArgumentCount()) == 1)) { - return primitiveFail(); - } - v3Oop = stackObjectValue(0); - if (failed()) { - return null; - } - if (!((isWords(v3Oop)) - && ((slotSizeOf(v3Oop)) == 3))) { - return primitiveFail(); - } - vertex = firstIndexableField(v3Oop); - matrix = stackMatrix(1); - if (matrix == null) { + /* begin stackMatrix: */ + oop = stackValue(1); + matrix = ((isWords(oop)) + && ((slotSizeOf(oop)) == 16) + ? ((float *) (firstIndexableField(oop))) + : 0); + v3Oop = stackValue(0); + if (!((matrix != null) + && ((isWords(v3Oop)) + && ((slotSizeOf(v3Oop)) == 3)))) { return primitiveFail(); } + vertex = ((float *) (firstIndexableField(v3Oop))); x = vertex[0]; y = vertex[1]; z = vertex[2]; @@ -816,11 +799,14 @@ primitiveTransformVector3(void) rz = (((x * (matrix[8])) + (y * (matrix[9]))) + (z * (matrix[10]))) + (matrix[11]); rw = (((x * (matrix[12])) + (y * (matrix[13]))) + (z * (matrix[14]))) + (matrix[15]); v3Oop = cloneObject(v3Oop); - vertex = firstIndexableField(v3Oop); + if (v3Oop == 0) { + return primitiveFailFor(PrimErrNoMemory); + } + vertex = ((float *) (firstIndexableField(v3Oop))); if (rw == 1.0) { - vertex[0] = (((float) rx)); - vertex[1] = (((float) ry)); - vertex[2] = (((float) rz)); + vertex[0] = rx; + vertex[1] = ry; + vertex[2] = rz; } else { if (rw == 0.0) { @@ -829,12 +815,11 @@ primitiveTransformVector3(void) else { rw = 1.0 / rw; } - vertex[0] = (((float) (rx * rw))); - vertex[1] = (((float) (ry * rw))); - vertex[2] = (((float) (rz * rw))); + vertex[0] = (rx * rw); + vertex[1] = (ry * rw); + vertex[2] = (rz * rw); } - pop(2); - return push(v3Oop); + return methodReturnValue(v3Oop); } /* CroquetPlugin>>#primitiveTransposeMatrix */ @@ -888,27 +873,60 @@ primitiveTransposeMatrix(void) EXPORT(sqInt) primitiveTriBoxIntersects(void) { - float *maxCorner; - float *minCorner; + float * maxCorner; + float * minCorner; + sqInt oop; + sqInt oop1; + sqInt oop2; + sqInt oop3; + sqInt oop4; sqInt result; - float *v0; - float *v1; - float *v2; - - if (!((methodArgumentCount()) == 5)) { + float * v0; + float * v1; + float * v2; + + /* begin stackVector3: */ + oop = stackValue(0); + v2 = ((isWords(oop)) + && ((slotSizeOf(oop)) == 3) + ? ((float *) (firstIndexableField(oop))) + : 0); + /* begin stackVector3: */ + oop1 = stackValue(1); + v1 = ((isWords(oop1)) + && ((slotSizeOf(oop1)) == 3) + ? ((float *) (firstIndexableField(oop1))) + : 0); + /* begin stackVector3: */ + oop2 = stackValue(2); + v0 = ((isWords(oop2)) + && ((slotSizeOf(oop2)) == 3) + ? ((float *) (firstIndexableField(oop2))) + : 0); + /* begin stackVector3: */ + oop3 = stackValue(3); + maxCorner = ((isWords(oop3)) + && ((slotSizeOf(oop3)) == 3) + ? ((float *) (firstIndexableField(oop3))) + : 0); + /* begin stackVector3: */ + oop4 = stackValue(4); + minCorner = ((isWords(oop4)) + && ((slotSizeOf(oop4)) == 3) + ? ((float *) (firstIndexableField(oop4))) + : 0); + if ((v0 == null) + || ((v1 == null) + || ((v2 == null) + || ((maxCorner == null) + || (minCorner == null))))) { return primitiveFail(); } - v2 = stackVector3(0); - v1 = stackVector3(1); - v0 = stackVector3(2); - maxCorner = stackVector3(3); - minCorner = stackVector3(4); result = triBoxOverlap(minCorner, maxCorner, v0, v1, v2); if (result < 0) { return primitiveFail(); } - pop(6); - return pushBool(result); + return methodReturnBool(result > 0); } @@ -938,18 +956,21 @@ setInterpreter(struct VirtualMachine *anInterpreter) isBytes = interpreterProxy->isBytes; isWords = interpreterProxy->isWords; methodArgumentCount = interpreterProxy->methodArgumentCount; + methodReturnBool = interpreterProxy->methodReturnBool; + methodReturnFloat = interpreterProxy->methodReturnFloat; + methodReturnReceiver = interpreterProxy->methodReturnReceiver; + methodReturnValue = interpreterProxy->methodReturnValue; pop = interpreterProxy->pop; - popthenPush = interpreterProxy->popthenPush; popRemappableOop = interpreterProxy->popRemappableOop; positive32BitIntegerFor = interpreterProxy->positive32BitIntegerFor; primitiveFail = interpreterProxy->primitiveFail; + primitiveFailFor = interpreterProxy->primitiveFailFor; push = interpreterProxy->push; - pushBool = interpreterProxy->pushBool; - pushFloat = interpreterProxy->pushFloat; pushRemappableOop = interpreterProxy->pushRemappableOop; slotSizeOf = interpreterProxy->slotSizeOf; stackIntegerValue = interpreterProxy->stackIntegerValue; stackObjectValue = interpreterProxy->stackObjectValue; + stackValue = interpreterProxy->stackValue; storePointerofObjectwithValue = interpreterProxy->storePointerofObjectwithValue; #endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ } @@ -957,48 +978,6 @@ setInterpreter(struct VirtualMachine *anInterpreter) } -/* Load a 4x4 transformation matrix from the interpreter stack. - Return a pointer to the matrix data if successful, nil otherwise. */ - - /* CroquetPlugin>>#stackMatrix: */ -static void* -stackMatrix(sqInt index) -{ - sqInt oop; - - oop = stackObjectValue(index); - if (oop == null) { - return null; - } - if ((isWords(oop)) - && ((slotSizeOf(oop)) == 16)) { - return firstIndexableField(oop); - } - return null; -} - - -/* Load a Vector3 from the interpreter stack. - Return a pointer to the float data if successful, nil otherwise. */ - - /* CroquetPlugin>>#stackVector3: */ -static void* -stackVector3(sqInt index) -{ - sqInt oop; - - oop = stackObjectValue(index); - if (oop == null) { - return null; - } - if ((isWords(oop)) - && ((slotSizeOf(oop)) == 3)) { - return firstIndexableField(oop); - } - return null; -} - - /* Transform src with arg into dst. It is allowed that src == dst but not arg == dst */ @@ -1021,12 +1000,12 @@ transformMatrixwithinto(float *src, float *arg, float *dst) for (i = 0; i <= 3; i += 1) { /* Compute next row */ - c1 = ((((((double) (m1[0]) )) * (((double) (m2[0]) ))) + ((((double) (m1[1]) )) * (((double) (m2[4]) )))) + ((((double) (m1[2]) )) * (((double) (m2[8]) )))) + ((((double) (m1[3]) )) * (((double) (m2[12]) ))); - c2 = ((((((double) (m1[0]) )) * (((double) (m2[1]) ))) + ((((double) (m1[1]) )) * (((double) (m2[5]) )))) + ((((double) (m1[2]) )) * (((double) (m2[9]) )))) + ((((double) (m1[3]) )) * (((double) (m2[13]) ))); - c3 = ((((((double) (m1[0]) )) * (((double) (m2[2]) ))) + ((((double) (m1[1]) )) * (((double) (m2[6]) )))) + ((((double) (m1[2]) )) * (((double) (m2[10]) )))) + ((((double) (m1[3]) )) * (((double) (m2[14]) ))); + c1 = ((((m1[0]) * (m2[0])) + ((m1[1]) * (m2[4]))) + ((m1[2]) * (m2[8]))) + ((m1[3]) * (m2[12])); + c2 = ((((m1[0]) * (m2[1])) + ((m1[1]) * (m2[5]))) + ((m1[2]) * (m2[9]))) + ((m1[3]) * (m2[13])); + c3 = ((((m1[0]) * (m2[2])) + ((m1[1]) * (m2[6]))) + ((m1[2]) * (m2[10]))) + ((m1[3]) * (m2[14])); /* Store result */ - c4 = ((((((double) (m1[0]) )) * (((double) (m2[3]) ))) + ((((double) (m1[1]) )) * (((double) (m2[7]) )))) + ((((double) (m1[2]) )) * (((double) (m2[11]) )))) + ((((double) (m1[3]) )) * (((double) (m2[15]) ))); + c4 = ((((m1[0]) * (m2[3])) + ((m1[1]) * (m2[7]))) + ((m1[2]) * (m2[11]))) + ((m1[3]) * (m2[15])); m3[0] = c1; m3[1] = c2; m3[2] = c3; @@ -1043,39 +1022,41 @@ transformMatrixwithinto(float *src, float *arg, float *dst) static char _m[] = "CroquetPlugin"; void* CroquetPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveAdj3\000\001", (void*)primitiveAdj3}, - {(void*)_m, "primitiveARC4Transform\000\001", (void*)primitiveARC4Transform}, - {(void*)_m, "primitiveDet3\000\001", (void*)primitiveDet3}, - {(void*)_m, "primitiveGatherEntropy\000\001", (void*)primitiveGatherEntropy}, - {(void*)_m, "primitiveInplaceHouseHolderInvert\000\000", (void*)primitiveInplaceHouseHolderInvert}, - {(void*)_m, "primitiveInverseByAdjoint\000\001", (void*)primitiveInverseByAdjoint}, - {(void*)_m, "primitiveMD5Transform\000\001", (void*)primitiveMD5Transform}, - {(void*)_m, "primitiveOptimizeVertexIndicesForCacheLocality\000\001", (void*)primitiveOptimizeVertexIndicesForCacheLocality}, - {(void*)_m, "primitiveOrthoNormInverseMatrix\000\001", (void*)primitiveOrthoNormInverseMatrix}, - {(void*)_m, "primitiveTransformDirection\000\001", (void*)primitiveTransformDirection}, - {(void*)_m, "primitiveTransformMatrixWithInto\000\000", (void*)primitiveTransformMatrixWithInto}, - {(void*)_m, "primitiveTransformVector3\000\001", (void*)primitiveTransformVector3}, - {(void*)_m, "primitiveTransposeMatrix\000\001", (void*)primitiveTransposeMatrix}, - {(void*)_m, "primitiveTriBoxIntersects\000\000", (void*)primitiveTriBoxIntersects}, + {(void*)_m, "primitiveAdj3\000\000\003", (void*)primitiveAdj3}, + {(void*)_m, "primitiveARC4Transform\000\001\003", (void*)primitiveARC4Transform}, + {(void*)_m, "primitiveDet3\000\000\003", (void*)primitiveDet3}, + {(void*)_m, "primitiveGatherEntropy\000\000\000", (void*)primitiveGatherEntropy}, + {(void*)_m, "primitiveInplaceHouseHolderInvert\000\377\003", (void*)primitiveInplaceHouseHolderInvert}, + {(void*)_m, "primitiveInverseByAdjoint\000\000\003", (void*)primitiveInverseByAdjoint}, + {(void*)_m, "primitiveMD5Transform\000\000\003", (void*)primitiveMD5Transform}, + {(void*)_m, "primitiveOptimizeVertexIndicesForCacheLocality\000\000\000", (void*)primitiveOptimizeVertexIndicesForCacheLocality}, + {(void*)_m, "primitiveOrthoNormInverseMatrix\000\000\003", (void*)primitiveOrthoNormInverseMatrix}, + {(void*)_m, "primitiveTransformDirection\000\000\003", (void*)primitiveTransformDirection}, + {(void*)_m, "primitiveTransformMatrixWithInto\000\377\003", (void*)primitiveTransformMatrixWithInto}, + {(void*)_m, "primitiveTransformVector3\000\000\003", (void*)primitiveTransformVector3}, + {(void*)_m, "primitiveTransposeMatrix\000\001\000", (void*)primitiveTransposeMatrix}, + {(void*)_m, "primitiveTriBoxIntersects\000\377\003", (void*)primitiveTriBoxIntersects}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveAdj3AccessorDepth = 1; -EXPORT(signed char) primitiveARC4TransformAccessorDepth = 1; -EXPORT(signed char) primitiveDet3AccessorDepth = 1; -EXPORT(signed char) primitiveGatherEntropyAccessorDepth = 1; -EXPORT(signed char) primitiveInplaceHouseHolderInvertAccessorDepth = 0; -EXPORT(signed char) primitiveInverseByAdjointAccessorDepth = 1; -EXPORT(signed char) primitiveMD5TransformAccessorDepth = 1; -EXPORT(signed char) primitiveOptimizeVertexIndicesForCacheLocalityAccessorDepth = 1; -EXPORT(signed char) primitiveOrthoNormInverseMatrixAccessorDepth = 1; -EXPORT(signed char) primitiveTransformDirectionAccessorDepth = 1; -EXPORT(signed char) primitiveTransformMatrixWithIntoAccessorDepth = 0; -EXPORT(signed char) primitiveTransformVector3AccessorDepth = 1; -EXPORT(signed char) primitiveTransposeMatrixAccessorDepth = 1; -EXPORT(signed char) primitiveTriBoxIntersectsAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveAdj3Metadata = 3; +EXPORT(signed short) primitiveARC4TransformMetadata = 259; +EXPORT(signed short) primitiveDet3Metadata = 3; +EXPORT(signed short) primitiveGatherEntropyMetadata = 0; +EXPORT(signed short) primitiveInplaceHouseHolderInvertMetadata = -253; +EXPORT(signed short) primitiveInverseByAdjointMetadata = 3; +EXPORT(signed short) primitiveMD5TransformMetadata = 3; +EXPORT(signed short) primitiveOptimizeVertexIndicesForCacheLocalityMetadata = 0; +EXPORT(signed short) primitiveOrthoNormInverseMatrixMetadata = 3; +EXPORT(signed short) primitiveTransformDirectionMetadata = 3; +EXPORT(signed short) primitiveTransformMatrixWithIntoMetadata = -253; +EXPORT(signed short) primitiveTransformVector3Metadata = 3; +EXPORT(signed short) primitiveTransposeMatrixMetadata = 0x100; +EXPORT(signed short) primitiveTriBoxIntersectsMetadata = -253; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/DESPlugin/DESPlugin.c b/src/plugins/DESPlugin/DESPlugin.c index b963b65d46..94f1a64a29 100644 --- a/src/plugins/DESPlugin/DESPlugin.c +++ b/src/plugins/DESPlugin/DESPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - DESPlugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee + DESPlugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d */ -static char __buildInfo[] = "DESPlugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee " __DATE__ ; +static char __buildInfo[] = "DESPlugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d " __DATE__ ; #include "config.h" @@ -81,7 +81,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "DESPlugin CryptographyPlugins-ul.22 " INT_EXT; +static const char *moduleName = "DESPlugin CryptographyPlugins-eem.23 " INT_EXT; static unsigned char pc1[56] = { 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, @@ -666,16 +666,19 @@ unscrunchto(unsigned int *wordPtr, unsigned char *bytePtr) static char _m[] = "DESPlugin"; void* DESPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDESCookKey\000\001", (void*)primitiveDESCookKey}, - {(void*)_m, "primitiveDESPluginAvailable\000\377", (void*)primitiveDESPluginAvailable}, - {(void*)_m, "primitiveDESTransform\000\001", (void*)primitiveDESTransform}, + {(void*)_m, "primitiveDESCookKey\000\001\001", (void*)primitiveDESCookKey}, + {(void*)_m, "primitiveDESPluginAvailable\000\377\001", (void*)primitiveDESPluginAvailable}, + {(void*)_m, "primitiveDESTransform\000\001\001", (void*)primitiveDESTransform}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDESCookKeyAccessorDepth = 1; -EXPORT(signed char) primitiveDESTransformAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveDESCookKeyMetadata = 0x101; +EXPORT(signed short) primitiveDESPluginAvailableMetadata = -255; +EXPORT(signed short) primitiveDESTransformMetadata = 0x101; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/DSAPrims/DSAPrims.c b/src/plugins/DSAPrims/DSAPrims.c index d6e437c03f..aa6102d607 100644 --- a/src/plugins/DSAPrims/DSAPrims.c +++ b/src/plugins/DSAPrims/DSAPrims.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - DSAPlugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee + DSAPlugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d */ -static char __buildInfo[] = "DSAPlugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee " __DATE__ ; +static char __buildInfo[] = "DSAPlugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d " __DATE__ ; #include "config.h" @@ -88,7 +88,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "DSAPrims CryptographyPlugins-ul.22 " INT_EXT; +static const char *moduleName = "DSAPrims CryptographyPlugins-eem.23 " INT_EXT; static sqInt remainderDigitCount; @@ -732,22 +732,25 @@ subtractDivisorMultipliedByDigitdigitShift(sqInt digit, sqInt digitShift) static char _m[] = "DSAPrims"; void* DSAPrims_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveBigDivide\000\001", (void*)primitiveBigDivide}, - {(void*)_m, "primitiveBigMultiply\000\001", (void*)primitiveBigMultiply}, - {(void*)_m, "primitiveExpandBlock\000\001", (void*)primitiveExpandBlock}, - {(void*)_m, "primitiveHashBlock\000\001", (void*)primitiveHashBlock}, - {(void*)_m, "primitiveHasSecureHashPrimitive\000\377", (void*)primitiveHasSecureHashPrimitive}, - {(void*)_m, "primitiveHighestNonZeroDigitIndex\000\001", (void*)primitiveHighestNonZeroDigitIndex}, + {(void*)_m, "primitiveBigDivide\000\001\001", (void*)primitiveBigDivide}, + {(void*)_m, "primitiveBigMultiply\000\001\001", (void*)primitiveBigMultiply}, + {(void*)_m, "primitiveExpandBlock\000\001\001", (void*)primitiveExpandBlock}, + {(void*)_m, "primitiveHashBlock\000\001\001", (void*)primitiveHashBlock}, + {(void*)_m, "primitiveHasSecureHashPrimitive\000\377\001", (void*)primitiveHasSecureHashPrimitive}, + {(void*)_m, "primitiveHighestNonZeroDigitIndex\000\001\001", (void*)primitiveHighestNonZeroDigitIndex}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveBigDivideAccessorDepth = 1; -EXPORT(signed char) primitiveBigMultiplyAccessorDepth = 1; -EXPORT(signed char) primitiveExpandBlockAccessorDepth = 1; -EXPORT(signed char) primitiveHashBlockAccessorDepth = 1; -EXPORT(signed char) primitiveHighestNonZeroDigitIndexAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveBigDivideMetadata = 0x101; +EXPORT(signed short) primitiveBigMultiplyMetadata = 0x101; +EXPORT(signed short) primitiveExpandBlockMetadata = 0x101; +EXPORT(signed short) primitiveHashBlockMetadata = 0x101; +EXPORT(signed short) primitiveHasSecureHashPrimitiveMetadata = -255; +EXPORT(signed short) primitiveHighestNonZeroDigitIndexMetadata = 0x101; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/DropPlugin/DropPlugin.c b/src/plugins/DropPlugin/DropPlugin.c index 8a867228be..4da9fbc3cb 100644 --- a/src/plugins/DropPlugin/DropPlugin.c +++ b/src/plugins/DropPlugin/DropPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - DropPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + DropPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "DropPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "DropPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -63,7 +63,7 @@ extern sqInt stackIntegerValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "DropPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "DropPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -200,18 +200,20 @@ static char _m[] = "DropPlugin"; void* DropPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveDropRequestFileHandle\000\000", (void*)primitiveDropRequestFileHandle}, - {(void*)_m, "primitiveDropRequestFileName\000\000", (void*)primitiveDropRequestFileName}, - {(void*)_m, "primitiveDropRequestURI\000\000", (void*)primitiveDropRequestURI}, + {(void*)_m, "primitiveDropRequestFileHandle\000\000\000", (void*)primitiveDropRequestFileHandle}, + {(void*)_m, "primitiveDropRequestFileName\000\000\000", (void*)primitiveDropRequestFileName}, + {(void*)_m, "primitiveDropRequestURI\000\000\000", (void*)primitiveDropRequestURI}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDropRequestFileHandleAccessorDepth = 0; -EXPORT(signed char) primitiveDropRequestFileNameAccessorDepth = 0; -EXPORT(signed char) primitiveDropRequestURIAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveDropRequestFileHandleMetadata = 0; +EXPORT(signed short) primitiveDropRequestFileNameMetadata = 0; +EXPORT(signed short) primitiveDropRequestURIMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/EventsHandlerPlugin/EventsHandlerPlugin.c b/src/plugins/EventsHandlerPlugin/EventsHandlerPlugin.c index 12ee96a726..ca22f6cafb 100644 --- a/src/plugins/EventsHandlerPlugin/EventsHandlerPlugin.c +++ b/src/plugins/EventsHandlerPlugin/EventsHandlerPlugin.c @@ -6,7 +6,7 @@ static char __buildInfo[] = "EventsHandlerPlugin EventsHandlerPlugin-EstebanLorenzano.1 uuid: 1516ba00-d8f9-4928-93cf-a46ad8e46d70 " __DATE__ ; - +#include "config.h" #include #include #include diff --git a/src/plugins/FFTPlugin/FFTPlugin.c b/src/plugins/FFTPlugin/FFTPlugin.c index af1a331b11..316d38f729 100644 --- a/src/plugins/FFTPlugin/FFTPlugin.c +++ b/src/plugins/FFTPlugin/FFTPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - FFTPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + FFTPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "FFTPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "FFTPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -82,7 +82,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "FFTPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "FFTPlugin VMMaker.oscog-eem.3024 " INT_EXT; static sqInt nu; static unsigned int * permTable; static sqInt permTableSize; @@ -524,17 +524,19 @@ transformForward(sqInt forward) static char _m[] = "FFTPlugin"; void* FFTPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveFFTPermuteData\000\001", (void*)primitiveFFTPermuteData}, - {(void*)_m, "primitiveFFTScaleData\000\001", (void*)primitiveFFTScaleData}, - {(void*)_m, "primitiveFFTTransformData\000\001", (void*)primitiveFFTTransformData}, + {(void*)_m, "primitiveFFTPermuteData\000\002\000", (void*)primitiveFFTPermuteData}, + {(void*)_m, "primitiveFFTScaleData\000\002\000", (void*)primitiveFFTScaleData}, + {(void*)_m, "primitiveFFTTransformData\000\002\000", (void*)primitiveFFTTransformData}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveFFTPermuteDataAccessorDepth = 1; -EXPORT(signed char) primitiveFFTScaleDataAccessorDepth = 1; -EXPORT(signed char) primitiveFFTTransformDataAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveFFTPermuteDataMetadata = 0x200; +EXPORT(signed short) primitiveFFTScaleDataMetadata = 0x200; +EXPORT(signed short) primitiveFFTTransformDataMetadata = 0x200; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/FT2Plugin/FT2Plugin.c b/src/plugins/FT2Plugin/FT2Plugin.c index 91038c1777..49632bc4a1 100644 --- a/src/plugins/FT2Plugin/FT2Plugin.c +++ b/src/plugins/FT2Plugin/FT2Plugin.c @@ -6,7 +6,7 @@ static char __buildInfo[] = "FT2Plugin Freetype-Plugin-EstebanLorenzano.70 uuid: 3729adbd-b383-456b-96ec-dac31cd293f8 " __DATE__ ; - +#include "config.h" #include #include #include diff --git a/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c b/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c index 85ec194db9..bb27c8e170 100644 --- a/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c +++ b/src/plugins/FileAttributesPlugin/FileAttributesPlugin.c @@ -1,5 +1,5 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from FileAttributesPlugin FileAttributesPlugin.oscog-eem.60 uuid: de623342-2160-415d-a342-f64410f5ba5e */ @@ -1311,39 +1311,41 @@ static char _m[] = "FileAttributesPlugin"; void* FileAttributesPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveChangeMode\000\000", (void*)primitiveChangeMode}, - {(void*)_m, "primitiveChangeOwner\000\000", (void*)primitiveChangeOwner}, - {(void*)_m, "primitiveClosedir\000\000", (void*)primitiveClosedir}, - {(void*)_m, "primitiveFileAttribute\000\000", (void*)primitiveFileAttribute}, - {(void*)_m, "primitiveFileAttributes\000\001", (void*)primitiveFileAttributes}, - {(void*)_m, "primitiveFileExists\000\000", (void*)primitiveFileExists}, - {(void*)_m, "primitiveFileMasks\000\377", (void*)primitiveFileMasks}, - {(void*)_m, "primitiveLogicalDrives\000\377", (void*)primitiveLogicalDrives}, - {(void*)_m, "primitiveOpendir\000\000", (void*)primitiveOpendir}, - {(void*)_m, "primitivePathMax\000\377", (void*)primitivePathMax}, - {(void*)_m, "primitivePlatToStPath\000\000", (void*)primitivePlatToStPath}, - {(void*)_m, "primitiveReaddir\000\000", (void*)primitiveReaddir}, - {(void*)_m, "primitiveRewinddir\000\000", (void*)primitiveRewinddir}, - {(void*)_m, "primitiveStToPlatPath\000\000", (void*)primitiveStToPlatPath}, - {(void*)_m, "primitiveSymlinkChangeOwner\000\000", (void*)primitiveSymlinkChangeOwner}, - {(void*)_m, "primitiveVersionString\000\377", (void*)primitiveVersionString}, + {(void*)_m, "primitiveChangeMode\000\000\000", (void*)primitiveChangeMode}, + {(void*)_m, "primitiveChangeOwner\000\000\000", (void*)primitiveChangeOwner}, + {(void*)_m, "primitiveClosedir\000\001\000", (void*)primitiveClosedir}, + {(void*)_m, "primitiveFileAttribute\000\000\000", (void*)primitiveFileAttribute}, + {(void*)_m, "primitiveFileAttributes\000\001\000", (void*)primitiveFileAttributes}, + {(void*)_m, "primitiveFileExists\000\000\000", (void*)primitiveFileExists}, + {(void*)_m, "primitiveFileMasks\000\377\000", (void*)primitiveFileMasks}, + {(void*)_m, "primitiveLogicalDrives\000\377\000", (void*)primitiveLogicalDrives}, + {(void*)_m, "primitiveOpendir\000\000\000", (void*)primitiveOpendir}, + {(void*)_m, "primitivePathMax\000\377\000", (void*)primitivePathMax}, + {(void*)_m, "primitivePlatToStPath\000\000\000", (void*)primitivePlatToStPath}, + {(void*)_m, "primitiveReaddir\000\001\000", (void*)primitiveReaddir}, + {(void*)_m, "primitiveRewinddir\000\001\000", (void*)primitiveRewinddir}, + {(void*)_m, "primitiveStToPlatPath\000\000\000", (void*)primitiveStToPlatPath}, + {(void*)_m, "primitiveSymlinkChangeOwner\000\000\000", (void*)primitiveSymlinkChangeOwner}, + {(void*)_m, "primitiveVersionString\000\377\000", (void*)primitiveVersionString}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveChangeModeAccessorDepth = 0; -EXPORT(signed char) primitiveChangeOwnerAccessorDepth = 0; -EXPORT(signed char) primitiveClosedirAccessorDepth = 0; -EXPORT(signed char) primitiveFileAttributeAccessorDepth = 0; -EXPORT(signed char) primitiveFileAttributesAccessorDepth = 1; -EXPORT(signed char) primitiveFileExistsAccessorDepth = 0; -EXPORT(signed char) primitiveOpendirAccessorDepth = 0; -EXPORT(signed char) primitivePlatToStPathAccessorDepth = 0; -EXPORT(signed char) primitiveReaddirAccessorDepth = 0; -EXPORT(signed char) primitiveRewinddirAccessorDepth = 0; -EXPORT(signed char) primitiveStToPlatPathAccessorDepth = 0; -EXPORT(signed char) primitiveSymlinkChangeOwnerAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveChangeModeMetadata = 0; +EXPORT(signed short) primitiveChangeOwnerMetadata = 0; +EXPORT(signed short) primitiveClosedirMetadata = 0x100; +EXPORT(signed short) primitiveFileAttributeMetadata = 0; +EXPORT(signed short) primitiveFileAttributesMetadata = 0x100; +EXPORT(signed short) primitiveFileExistsMetadata = 0; +EXPORT(signed short) primitiveOpendirMetadata = 0; +EXPORT(signed short) primitivePlatToStPathMetadata = 0; +EXPORT(signed short) primitiveReaddirMetadata = 0x100; +EXPORT(signed short) primitiveRewinddirMetadata = 0x100; +EXPORT(signed short) primitiveStToPlatPathMetadata = 0; +EXPORT(signed short) primitiveSymlinkChangeOwnerMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/FileCopyPlugin/FileCopyPlugin.c b/src/plugins/FileCopyPlugin/FileCopyPlugin.c index 5fbc8d7b60..497f577e99 100644 --- a/src/plugins/FileCopyPlugin/FileCopyPlugin.c +++ b/src/plugins/FileCopyPlugin/FileCopyPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - FileCopyPlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + FileCopyPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "FileCopyPlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 " __DATE__ ; +static char __buildInfo[] = "FileCopyPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -19,6 +19,7 @@ static char __buildInfo[] = "FileCopyPlugin VMMaker.oscog-eem.2944 uuid: 242b00d #include "sqVirtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ +#include "FileCopyPlugin.h" #include "sqMemoryAccess.h" #define true 1 @@ -66,7 +67,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "FileCopyPlugin VMMaker.oscog-eem.2944 " INT_EXT; +static const char *moduleName = "FileCopyPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -94,14 +95,10 @@ primitiveFileCopyNamedTo(void) if (!((isBytes(stackValue(1))) && (isBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } srcName = ((char *) (firstIndexableField(stackValue(1)))); dstName = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } srcSz = slotSizeOf(((sqInt)(sqIntptr_t)(srcName) - BaseHeaderSize)); dstSz = slotSizeOf(((sqInt)(sqIntptr_t)(dstName) - BaseHeaderSize)); ok = sqCopyFilesizetosize(srcName, srcSz, dstName, dstSz); @@ -151,12 +148,14 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "FileCopyPlugin"; void* FileCopyPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveFileCopyNamedTo\000\377", (void*)primitiveFileCopyNamedTo}, + {(void*)_m, "primitiveFileCopyNamedTo\000\377\000", (void*)primitiveFileCopyNamedTo}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN +#if SPURVM +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/FilePlugin/FilePlugin.c b/src/plugins/FilePlugin/FilePlugin.c index 9e2ecbdf1d..96d4af233e 100644 --- a/src/plugins/FilePlugin/FilePlugin.c +++ b/src/plugins/FilePlugin/FilePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - FilePlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + FilePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "FilePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -239,7 +239,7 @@ extern sqInt unpinObject(sqInt anObject); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "FilePlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "FilePlugin VMMaker.oscog-eem.3024 " INT_EXT; static void * sCCPfn; static void * sCDFfn; static void * sCDPfn; @@ -1938,63 +1938,64 @@ void* FilePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveConnectToFile\000\001", (void*)primitiveConnectToFile}, - {(void*)_m, "primitiveConnectToFileDescriptor\000\000", (void*)primitiveConnectToFileDescriptor}, - {(void*)_m, "primitiveDirectoryCreate\000\001", (void*)primitiveDirectoryCreate}, - {(void*)_m, "primitiveDirectoryDelete\000\001", (void*)primitiveDirectoryDelete}, - {(void*)_m, "primitiveDirectoryDelimitor\000\377", (void*)primitiveDirectoryDelimitor}, - {(void*)_m, "primitiveDirectoryEntry\000\001", (void*)primitiveDirectoryEntry}, - {(void*)_m, "primitiveDirectoryGetMacTypeAndCreator\000\001", (void*)primitiveDirectoryGetMacTypeAndCreator}, - {(void*)_m, "primitiveDirectoryLookup\000\001", (void*)primitiveDirectoryLookup}, - {(void*)_m, "primitiveDirectorySetMacTypeAndCreator\000\001", (void*)primitiveDirectorySetMacTypeAndCreator}, - {(void*)_m, "primitiveDisableFileAccess\000\377", (void*)primitiveDisableFileAccess}, - {(void*)_m, "primitiveFileAtEnd\000\001", (void*)primitiveFileAtEnd}, - {(void*)_m, "primitiveFileClose\000\001", (void*)primitiveFileClose}, - {(void*)_m, "primitiveFileDelete\000\001", (void*)primitiveFileDelete}, - {(void*)_m, "primitiveFileDescriptorType\000\000", (void*)primitiveFileDescriptorType}, - {(void*)_m, "primitiveFileFlush\000\001", (void*)primitiveFileFlush}, - {(void*)_m, "primitiveFileGetPosition\000\001", (void*)primitiveFileGetPosition}, - {(void*)_m, "primitiveFileOpen\000\002", (void*)primitiveFileOpen}, - {(void*)_m, "primitiveFileOpenNew\000\002", (void*)primitiveFileOpenNew}, - {(void*)_m, "primitiveFileRead\000\001", (void*)primitiveFileRead}, - {(void*)_m, "primitiveFileRename\000\001", (void*)primitiveFileRename}, - {(void*)_m, "primitiveFileSetPosition\000\001", (void*)primitiveFileSetPosition}, - {(void*)_m, "primitiveFileSize\000\001", (void*)primitiveFileSize}, - {(void*)_m, "primitiveFileStdioHandles\000\377", (void*)primitiveFileStdioHandles}, - {(void*)_m, "primitiveFileSync\000\001", (void*)primitiveFileSync}, - {(void*)_m, "primitiveFileTruncate\000\001", (void*)primitiveFileTruncate}, - {(void*)_m, "primitiveFileWrite\000\001", (void*)primitiveFileWrite}, - {(void*)_m, "primitiveHasFileAccess\000\377", (void*)primitiveHasFileAccess}, + {(void*)_m, "primitiveConnectToFile\000\002\000", (void*)primitiveConnectToFile}, + {(void*)_m, "primitiveConnectToFileDescriptor\000\000\000", (void*)primitiveConnectToFileDescriptor}, + {(void*)_m, "primitiveDirectoryCreate\000\001\000", (void*)primitiveDirectoryCreate}, + {(void*)_m, "primitiveDirectoryDelete\000\001\000", (void*)primitiveDirectoryDelete}, + {(void*)_m, "primitiveDirectoryDelimitor\000\377\000", (void*)primitiveDirectoryDelimitor}, + {(void*)_m, "primitiveDirectoryEntry\000\001\000", (void*)primitiveDirectoryEntry}, + {(void*)_m, "primitiveDirectoryGetMacTypeAndCreator\000\001\000", (void*)primitiveDirectoryGetMacTypeAndCreator}, + {(void*)_m, "primitiveDirectoryLookup\000\001\000", (void*)primitiveDirectoryLookup}, + {(void*)_m, "primitiveDirectorySetMacTypeAndCreator\000\001\000", (void*)primitiveDirectorySetMacTypeAndCreator}, + {(void*)_m, "primitiveDisableFileAccess\000\377\000", (void*)primitiveDisableFileAccess}, + {(void*)_m, "primitiveFileAtEnd\000\000\000", (void*)primitiveFileAtEnd}, + {(void*)_m, "primitiveFileClose\000\000\000", (void*)primitiveFileClose}, + {(void*)_m, "primitiveFileDelete\000\001\000", (void*)primitiveFileDelete}, + {(void*)_m, "primitiveFileDescriptorType\000\000\000", (void*)primitiveFileDescriptorType}, + {(void*)_m, "primitiveFileFlush\000\000\000", (void*)primitiveFileFlush}, + {(void*)_m, "primitiveFileGetPosition\000\000\000", (void*)primitiveFileGetPosition}, + {(void*)_m, "primitiveFileOpen\000\002\000", (void*)primitiveFileOpen}, + {(void*)_m, "primitiveFileOpenNew\000\002\000", (void*)primitiveFileOpenNew}, + {(void*)_m, "primitiveFileRead\000\377\000", (void*)primitiveFileRead}, + {(void*)_m, "primitiveFileRename\000\001\000", (void*)primitiveFileRename}, + {(void*)_m, "primitiveFileSetPosition\000\000\000", (void*)primitiveFileSetPosition}, + {(void*)_m, "primitiveFileSize\000\000\000", (void*)primitiveFileSize}, + {(void*)_m, "primitiveFileStdioHandles\000\377\000", (void*)primitiveFileStdioHandles}, + {(void*)_m, "primitiveFileSync\000\000\000", (void*)primitiveFileSync}, + {(void*)_m, "primitiveFileTruncate\000\000\000", (void*)primitiveFileTruncate}, + {(void*)_m, "primitiveFileWrite\000\000\000", (void*)primitiveFileWrite}, + {(void*)_m, "primitiveHasFileAccess\000\377\000", (void*)primitiveHasFileAccess}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {(void*)_m, "setMacFileTypeAndCreator", (void*)setMacFileTypeAndCreator}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveConnectToFileAccessorDepth = 1; -EXPORT(signed char) primitiveConnectToFileDescriptorAccessorDepth = 0; -EXPORT(signed char) primitiveDirectoryCreateAccessorDepth = 1; -EXPORT(signed char) primitiveDirectoryDeleteAccessorDepth = 1; -EXPORT(signed char) primitiveDirectoryEntryAccessorDepth = 1; -EXPORT(signed char) primitiveDirectoryGetMacTypeAndCreatorAccessorDepth = 1; -EXPORT(signed char) primitiveDirectoryLookupAccessorDepth = 1; -EXPORT(signed char) primitiveDirectorySetMacTypeAndCreatorAccessorDepth = 1; -EXPORT(signed char) primitiveFileAtEndAccessorDepth = 1; -EXPORT(signed char) primitiveFileCloseAccessorDepth = 1; -EXPORT(signed char) primitiveFileDeleteAccessorDepth = 1; -EXPORT(signed char) primitiveFileDescriptorTypeAccessorDepth = 0; -EXPORT(signed char) primitiveFileFlushAccessorDepth = 1; -EXPORT(signed char) primitiveFileGetPositionAccessorDepth = 1; -EXPORT(signed char) primitiveFileOpenAccessorDepth = 2; -EXPORT(signed char) primitiveFileOpenNewAccessorDepth = 2; -EXPORT(signed char) primitiveFileReadAccessorDepth = 1; -EXPORT(signed char) primitiveFileRenameAccessorDepth = 1; -EXPORT(signed char) primitiveFileSetPositionAccessorDepth = 1; -EXPORT(signed char) primitiveFileSizeAccessorDepth = 1; -EXPORT(signed char) primitiveFileSyncAccessorDepth = 1; -EXPORT(signed char) primitiveFileTruncateAccessorDepth = 1; -EXPORT(signed char) primitiveFileWriteAccessorDepth = 1; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveConnectToFileMetadata = 0x200; +EXPORT(signed short) primitiveConnectToFileDescriptorMetadata = 0; +EXPORT(signed short) primitiveDirectoryCreateMetadata = 0x100; +EXPORT(signed short) primitiveDirectoryDeleteMetadata = 0x100; +EXPORT(signed short) primitiveDirectoryEntryMetadata = 0x100; +EXPORT(signed short) primitiveDirectoryGetMacTypeAndCreatorMetadata = 0x100; +EXPORT(signed short) primitiveDirectoryLookupMetadata = 0x100; +EXPORT(signed short) primitiveDirectorySetMacTypeAndCreatorMetadata = 0x100; +EXPORT(signed short) primitiveFileAtEndMetadata = 0; +EXPORT(signed short) primitiveFileCloseMetadata = 0; +EXPORT(signed short) primitiveFileDeleteMetadata = 0x100; +EXPORT(signed short) primitiveFileDescriptorTypeMetadata = 0; +EXPORT(signed short) primitiveFileFlushMetadata = 0; +EXPORT(signed short) primitiveFileGetPositionMetadata = 0; +EXPORT(signed short) primitiveFileOpenMetadata = 0x200; +EXPORT(signed short) primitiveFileOpenNewMetadata = 0x200; +EXPORT(signed short) primitiveFileRenameMetadata = 0x100; +EXPORT(signed short) primitiveFileSetPositionMetadata = 0; +EXPORT(signed short) primitiveFileSizeMetadata = 0; +EXPORT(signed short) primitiveFileSyncMetadata = 0; +EXPORT(signed short) primitiveFileTruncateMetadata = 0; +EXPORT(signed short) primitiveFileWriteMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/Float64ArrayPlugin/Float64ArrayPlugin.c b/src/plugins/Float64ArrayPlugin/Float64ArrayPlugin.c index e272dd0247..e8e854a0c0 100644 --- a/src/plugins/Float64ArrayPlugin/Float64ArrayPlugin.c +++ b/src/plugins/Float64ArrayPlugin/Float64ArrayPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 from - Float64ArrayPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + Float64ArrayPlugin VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 */ -static char __buildInfo[] = "Float64ArrayPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "Float64ArrayPlugin VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 " __DATE__ ; #include "config.h" @@ -73,13 +73,13 @@ static sqInt (*isIntegerObject)(sqInt objectPointer); #endif static sqInt (*isLong64s)(sqInt oop); static sqInt (*isWords)(sqInt oop); +static sqInt (*methodReturnBool)(sqInt boolean); static sqInt (*methodReturnFloat)(double aFloat); static sqInt (*methodReturnInteger)(sqInt integer); -static sqInt (*pop)(sqInt nItems); -static sqInt (*popthenPush)(sqInt nItems, sqInt oop); +static sqInt (*methodReturnReceiver)(void); +static sqInt (*methodReturnValue)(sqInt oop); static sqInt (*primitiveFail)(void); static sqInt (*primitiveFailFor)(sqInt reasonCode); -static sqInt (*pushBool)(sqInt trueOrFalse); static sqInt (*slotSizeOf)(sqInt oop); static sqInt (*stSizeOf)(sqInt oop); static double (*stackFloatValue)(sqInt offset); @@ -101,13 +101,13 @@ extern sqInt isLong64s(sqInt oop); # define isLong64s(oop) 0 #endif extern sqInt isWords(sqInt oop); +extern sqInt methodReturnBool(sqInt boolean); extern sqInt methodReturnFloat(double aFloat); extern sqInt methodReturnInteger(sqInt integer); -extern sqInt pop(sqInt nItems); -extern sqInt popthenPush(sqInt nItems, sqInt oop); +extern sqInt methodReturnReceiver(void); +extern sqInt methodReturnValue(sqInt oop); extern sqInt primitiveFail(void); extern sqInt primitiveFailFor(sqInt reasonCode); -extern sqInt pushBool(sqInt trueOrFalse); extern sqInt slotSizeOf(sqInt oop); extern sqInt stSizeOf(sqInt oop); extern double stackFloatValue(sqInt offset); @@ -116,7 +116,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "Float64ArrayPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "Float64ArrayPlugin VMMaker.oscog-eem.3014 " INT_EXT; @@ -160,8 +160,7 @@ primitiveAddFloat64Array(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) + (argPtr[i])); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -192,8 +191,7 @@ primitiveAddScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) + value); } - pop(1); - return 0; + return methodReturnReceiver(); } /* Float64ArrayPlugin>>#primitiveAt */ @@ -213,8 +211,7 @@ primitiveAt(void) return primitiveFail(); } doublePtr = ((double *) (firstIndexableField(rcvr))); - methodReturnFloat(doublePtr[index - 1]); - return 0; + return methodReturnFloat(doublePtr[index - 1]); } /* Float64ArrayPlugin>>#primitiveAtPut */ @@ -241,8 +238,7 @@ primitiveAtPut(void) } doublePtr = ((double *) (firstIndexableField(rcvr))); doublePtr[index - 1] = floatValue; - popthenPush(3, value); - return 0; + return methodReturnValue(value); } @@ -283,8 +279,7 @@ primitiveDivFloat64Array(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) / (argPtr[i])); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -315,8 +310,7 @@ primitiveDivScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) / value); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -350,8 +344,7 @@ primitiveDotProduct(void) for (i = 0; i < length; i += 1) { result += (rcvrPtr[i]) * (argPtr[i]); } - methodReturnFloat(result); - return 0; + return methodReturnFloat(result); } /* Float64ArrayPlugin>>#primitiveEqual */ @@ -371,18 +364,17 @@ primitiveEqual(void) && (isLong64s(rcvr)))) { return primitiveFail(); } - pop(2); if (!(((length = stSizeOf(arg))) == (stSizeOf(rcvr)))) { - return pushBool(0); + return methodReturnBool(0); } rcvrPtr = ((double *) (firstIndexableField(rcvr))); argPtr = ((double *) (firstIndexableField(arg))); for (i = 0; i < length; i += 1) { if (!((rcvrPtr[i]) == (argPtr[i]))) { - return pushBool(0); + return methodReturnBool(0); } } - return pushBool(1); + return methodReturnBool(1); } @@ -414,8 +406,7 @@ primitiveFromFloatArray(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = (((double) (argPtr[i]))); } - pop(1); - return 0; + return methodReturnReceiver(); } /* Float64ArrayPlugin>>#primitiveHashArray */ @@ -438,8 +429,7 @@ primitiveHashArray(void) for (i = 0; i < (length * 2); i += 1) { result += rcvrPtr[i]; } - methodReturnInteger(result & 0x1FFFFFFF); - return 0; + return methodReturnInteger(result & 0x1FFFFFFF); } @@ -470,8 +460,7 @@ primitiveLength(void) if (!(len > 0.0)) { return primitiveFailFor(PrimErrBadReceiver); } - methodReturnFloat(sqrt(len)); - return 0; + return methodReturnFloat(sqrt(len)); } @@ -502,8 +491,7 @@ primitiveMulFloat64Array(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) * (argPtr[i])); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -534,8 +522,7 @@ primitiveMulScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) * value); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -599,8 +586,7 @@ primitiveSubFloat64Array(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) - (argPtr[i])); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -630,8 +616,7 @@ primitiveSubScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((rcvrPtr[i]) - value); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -657,8 +642,7 @@ primitiveSum(void) for (i = 0; i < length; i += 1) { sum += rcvrPtr[i]; } - methodReturnFloat(sum); - return 0; + return methodReturnFloat(sum); } @@ -696,13 +680,13 @@ setInterpreter(struct VirtualMachine *anInterpreter) #endif #endif isWords = interpreterProxy->isWords; + methodReturnBool = interpreterProxy->methodReturnBool; methodReturnFloat = interpreterProxy->methodReturnFloat; methodReturnInteger = interpreterProxy->methodReturnInteger; - pop = interpreterProxy->pop; - popthenPush = interpreterProxy->popthenPush; + methodReturnReceiver = interpreterProxy->methodReturnReceiver; + methodReturnValue = interpreterProxy->methodReturnValue; primitiveFail = interpreterProxy->primitiveFail; primitiveFailFor = interpreterProxy->primitiveFailFor; - pushBool = interpreterProxy->pushBool; slotSizeOf = interpreterProxy->slotSizeOf; stSizeOf = interpreterProxy->stSizeOf; stackFloatValue = interpreterProxy->stackFloatValue; @@ -719,45 +703,47 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "Float64ArrayPlugin"; void* Float64ArrayPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveAddFloat64Array\000\000", (void*)primitiveAddFloat64Array}, - {(void*)_m, "primitiveAddScalar\000\000", (void*)primitiveAddScalar}, - {(void*)_m, "primitiveAt\000\000", (void*)primitiveAt}, - {(void*)_m, "primitiveAtPut\000\000", (void*)primitiveAtPut}, - {(void*)_m, "primitiveDivFloat64Array\000\000", (void*)primitiveDivFloat64Array}, - {(void*)_m, "primitiveDivScalar\000\000", (void*)primitiveDivScalar}, - {(void*)_m, "primitiveDotProduct\000\000", (void*)primitiveDotProduct}, - {(void*)_m, "primitiveEqual\000\000", (void*)primitiveEqual}, - {(void*)_m, "primitiveFromFloatArray\000\000", (void*)primitiveFromFloatArray}, - {(void*)_m, "primitiveHashArray\000\000", (void*)primitiveHashArray}, - {(void*)_m, "primitiveLength\000\000", (void*)primitiveLength}, - {(void*)_m, "primitiveMulFloat64Array\000\000", (void*)primitiveMulFloat64Array}, - {(void*)_m, "primitiveMulScalar\000\000", (void*)primitiveMulScalar}, - {(void*)_m, "primitiveNormalize\000\000", (void*)primitiveNormalize}, - {(void*)_m, "primitiveSubFloat64Array\000\000", (void*)primitiveSubFloat64Array}, - {(void*)_m, "primitiveSubScalar\000\000", (void*)primitiveSubScalar}, - {(void*)_m, "primitiveSum\000\000", (void*)primitiveSum}, + {(void*)_m, "primitiveAddFloat64Array\000\000\003", (void*)primitiveAddFloat64Array}, + {(void*)_m, "primitiveAddScalar\000\000\003", (void*)primitiveAddScalar}, + {(void*)_m, "primitiveAt\000\000\003", (void*)primitiveAt}, + {(void*)_m, "primitiveAtPut\000\000\003", (void*)primitiveAtPut}, + {(void*)_m, "primitiveDivFloat64Array\000\000\003", (void*)primitiveDivFloat64Array}, + {(void*)_m, "primitiveDivScalar\000\000\003", (void*)primitiveDivScalar}, + {(void*)_m, "primitiveDotProduct\000\000\003", (void*)primitiveDotProduct}, + {(void*)_m, "primitiveEqual\000\000\003", (void*)primitiveEqual}, + {(void*)_m, "primitiveFromFloatArray\000\000\003", (void*)primitiveFromFloatArray}, + {(void*)_m, "primitiveHashArray\000\000\003", (void*)primitiveHashArray}, + {(void*)_m, "primitiveLength\000\000\003", (void*)primitiveLength}, + {(void*)_m, "primitiveMulFloat64Array\000\000\003", (void*)primitiveMulFloat64Array}, + {(void*)_m, "primitiveMulScalar\000\000\003", (void*)primitiveMulScalar}, + {(void*)_m, "primitiveNormalize\000\000\003", (void*)primitiveNormalize}, + {(void*)_m, "primitiveSubFloat64Array\000\000\003", (void*)primitiveSubFloat64Array}, + {(void*)_m, "primitiveSubScalar\000\000\003", (void*)primitiveSubScalar}, + {(void*)_m, "primitiveSum\000\000\003", (void*)primitiveSum}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveAddFloat64ArrayAccessorDepth = 0; -EXPORT(signed char) primitiveAddScalarAccessorDepth = 0; -EXPORT(signed char) primitiveAtAccessorDepth = 0; -EXPORT(signed char) primitiveAtPutAccessorDepth = 0; -EXPORT(signed char) primitiveDivFloat64ArrayAccessorDepth = 0; -EXPORT(signed char) primitiveDivScalarAccessorDepth = 0; -EXPORT(signed char) primitiveDotProductAccessorDepth = 0; -EXPORT(signed char) primitiveEqualAccessorDepth = 0; -EXPORT(signed char) primitiveFromFloatArrayAccessorDepth = 0; -EXPORT(signed char) primitiveHashArrayAccessorDepth = 0; -EXPORT(signed char) primitiveLengthAccessorDepth = 0; -EXPORT(signed char) primitiveMulFloat64ArrayAccessorDepth = 0; -EXPORT(signed char) primitiveMulScalarAccessorDepth = 0; -EXPORT(signed char) primitiveNormalizeAccessorDepth = 0; -EXPORT(signed char) primitiveSubFloat64ArrayAccessorDepth = 0; -EXPORT(signed char) primitiveSubScalarAccessorDepth = 0; -EXPORT(signed char) primitiveSumAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveAddFloat64ArrayMetadata = 3; +EXPORT(signed short) primitiveAddScalarMetadata = 3; +EXPORT(signed short) primitiveAtMetadata = 3; +EXPORT(signed short) primitiveAtPutMetadata = 3; +EXPORT(signed short) primitiveDivFloat64ArrayMetadata = 3; +EXPORT(signed short) primitiveDivScalarMetadata = 3; +EXPORT(signed short) primitiveDotProductMetadata = 3; +EXPORT(signed short) primitiveEqualMetadata = 3; +EXPORT(signed short) primitiveFromFloatArrayMetadata = 3; +EXPORT(signed short) primitiveHashArrayMetadata = 3; +EXPORT(signed short) primitiveLengthMetadata = 3; +EXPORT(signed short) primitiveMulFloat64ArrayMetadata = 3; +EXPORT(signed short) primitiveMulScalarMetadata = 3; +EXPORT(signed short) primitiveNormalizeMetadata = 3; +EXPORT(signed short) primitiveSubFloat64ArrayMetadata = 3; +EXPORT(signed short) primitiveSubScalarMetadata = 3; +EXPORT(signed short) primitiveSumMetadata = 3; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/FloatArrayPlugin/FloatArrayPlugin.c b/src/plugins/FloatArrayPlugin/FloatArrayPlugin.c index ab8a4323cb..79c5897466 100644 --- a/src/plugins/FloatArrayPlugin/FloatArrayPlugin.c +++ b/src/plugins/FloatArrayPlugin/FloatArrayPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 from - FloatArrayPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + FloatArrayPlugin VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 */ -static char __buildInfo[] = "FloatArrayPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "FloatArrayPlugin VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 " __DATE__ ; #include "config.h" @@ -75,13 +75,13 @@ static sqInt (*isIntegerObject)(sqInt objectPointer); #endif static sqInt (*isLong64s)(sqInt oop); static sqInt (*isWords)(sqInt oop); +static sqInt (*methodReturnBool)(sqInt boolean); static sqInt (*methodReturnFloat)(double aFloat); static sqInt (*methodReturnInteger)(sqInt integer); -static sqInt (*pop)(sqInt nItems); -static sqInt (*popthenPush)(sqInt nItems, sqInt oop); +static sqInt (*methodReturnReceiver)(void); +static sqInt (*methodReturnValue)(sqInt oop); static sqInt (*primitiveFail)(void); static sqInt (*primitiveFailFor)(sqInt reasonCode); -static sqInt (*pushBool)(sqInt trueOrFalse); static sqInt (*slotSizeOf)(sqInt oop); static sqInt (*stSizeOf)(sqInt oop); static double (*stackFloatValue)(sqInt offset); @@ -103,13 +103,13 @@ extern sqInt isLong64s(sqInt oop); # define isLong64s(oop) 0 #endif extern sqInt isWords(sqInt oop); +extern sqInt methodReturnBool(sqInt boolean); extern sqInt methodReturnFloat(double aFloat); extern sqInt methodReturnInteger(sqInt integer); -extern sqInt pop(sqInt nItems); -extern sqInt popthenPush(sqInt nItems, sqInt oop); +extern sqInt methodReturnReceiver(void); +extern sqInt methodReturnValue(sqInt oop); extern sqInt primitiveFail(void); extern sqInt primitiveFailFor(sqInt reasonCode); -extern sqInt pushBool(sqInt trueOrFalse); extern sqInt slotSizeOf(sqInt oop); extern sqInt stSizeOf(sqInt oop); extern double stackFloatValue(sqInt offset); @@ -118,7 +118,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "FloatArrayPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "FloatArrayPlugin VMMaker.oscog-eem.3014 " INT_EXT; @@ -162,8 +162,7 @@ primitiveAddFloatArray(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) + (((double) (argPtr[i])))); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -192,8 +191,7 @@ primitiveAddScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) + value); } - pop(1); - return 0; + return methodReturnReceiver(); } /* FloatArrayPlugin>>#primitiveAt */ @@ -213,8 +211,7 @@ primitiveAt(void) return primitiveFail(); } floatPtr = ((float *) (firstIndexableField(rcvr))); - methodReturnFloat(floatPtr[index - 1]); - return 0; + return methodReturnFloat(floatPtr[index - 1]); } /* FloatArrayPlugin>>#primitiveAtPut */ @@ -241,8 +238,7 @@ primitiveAtPut(void) } floatPtr = ((float *) (firstIndexableField(rcvr))); floatPtr[index - 1] = (((float) floatValue)); - popthenPush(3, value); - return 0; + return methodReturnValue(value); } @@ -283,8 +279,7 @@ primitiveDivFloatArray(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) / (((double) (argPtr[i])))); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -317,8 +312,7 @@ primitiveDivScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) * inverse); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -352,8 +346,7 @@ primitiveDotProduct(void) for (i = 0; i < length; i += 1) { result += (((double) (rcvrPtr[i]))) * (((double) (argPtr[i]))); } - methodReturnFloat(result); - return 0; + return methodReturnFloat(result); } /* FloatArrayPlugin>>#primitiveEqual */ @@ -373,18 +366,17 @@ primitiveEqual(void) && (isWords(rcvr)))) { return primitiveFail(); } - pop(2); if (!(((length = stSizeOf(arg))) == (stSizeOf(rcvr)))) { - return pushBool(0); + return methodReturnBool(0); } rcvrPtr = ((float *) (firstIndexableField(rcvr))); argPtr = ((float *) (firstIndexableField(arg))); for (i = 0; i < length; i += 1) { if (!((rcvrPtr[i]) == (argPtr[i]))) { - return pushBool(0); + return methodReturnBool(0); } } - return pushBool(1); + return methodReturnBool(1); } @@ -418,8 +410,7 @@ primitiveFromFloat64Array(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = (((float) (argPtr[i]))); } - pop(1); - return 0; + return methodReturnReceiver(); } #endif /* SPURVM */ @@ -443,8 +434,7 @@ primitiveHashArray(void) for (i = 0; i < length; i += 1) { result += rcvrPtr[i]; } - methodReturnInteger(result & 0x1FFFFFFF); - return 0; + return methodReturnInteger(result & 0x1FFFFFFF); } @@ -475,8 +465,7 @@ primitiveLength(void) if (!(len > 0.0)) { return primitiveFailFor(PrimErrBadReceiver); } - methodReturnFloat(sqrt(len)); - return 0; + return methodReturnFloat(sqrt(len)); } @@ -507,8 +496,7 @@ primitiveMulFloatArray(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) * (((double) (argPtr[i])))); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -539,8 +527,7 @@ primitiveMulScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) * value); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -604,8 +591,7 @@ primitiveSubFloatArray(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) - (((double) (argPtr[i])))); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -635,8 +621,7 @@ primitiveSubScalar(void) for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) - value); } - pop(1); - return 0; + return methodReturnReceiver(); } @@ -662,8 +647,7 @@ primitiveSum(void) for (i = 0; i < length; i += 1) { sum += ((double) (rcvrPtr[i])); } - methodReturnFloat(sum); - return 0; + return methodReturnFloat(sum); } @@ -701,13 +685,13 @@ setInterpreter(struct VirtualMachine *anInterpreter) #endif #endif isWords = interpreterProxy->isWords; + methodReturnBool = interpreterProxy->methodReturnBool; methodReturnFloat = interpreterProxy->methodReturnFloat; methodReturnInteger = interpreterProxy->methodReturnInteger; - pop = interpreterProxy->pop; - popthenPush = interpreterProxy->popthenPush; + methodReturnReceiver = interpreterProxy->methodReturnReceiver; + methodReturnValue = interpreterProxy->methodReturnValue; primitiveFail = interpreterProxy->primitiveFail; primitiveFailFor = interpreterProxy->primitiveFailFor; - pushBool = interpreterProxy->pushBool; slotSizeOf = interpreterProxy->slotSizeOf; stSizeOf = interpreterProxy->stSizeOf; stackFloatValue = interpreterProxy->stackFloatValue; @@ -724,49 +708,51 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "FloatArrayPlugin"; void* FloatArrayPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveAddFloatArray\000\000", (void*)primitiveAddFloatArray}, - {(void*)_m, "primitiveAddScalar\000\000", (void*)primitiveAddScalar}, - {(void*)_m, "primitiveAt\000\000", (void*)primitiveAt}, - {(void*)_m, "primitiveAtPut\000\000", (void*)primitiveAtPut}, - {(void*)_m, "primitiveDivFloatArray\000\000", (void*)primitiveDivFloatArray}, - {(void*)_m, "primitiveDivScalar\000\000", (void*)primitiveDivScalar}, - {(void*)_m, "primitiveDotProduct\000\000", (void*)primitiveDotProduct}, - {(void*)_m, "primitiveEqual\000\000", (void*)primitiveEqual}, + {(void*)_m, "primitiveAddFloatArray\000\000\003", (void*)primitiveAddFloatArray}, + {(void*)_m, "primitiveAddScalar\000\000\003", (void*)primitiveAddScalar}, + {(void*)_m, "primitiveAt\000\000\003", (void*)primitiveAt}, + {(void*)_m, "primitiveAtPut\000\000\003", (void*)primitiveAtPut}, + {(void*)_m, "primitiveDivFloatArray\000\000\003", (void*)primitiveDivFloatArray}, + {(void*)_m, "primitiveDivScalar\000\000\003", (void*)primitiveDivScalar}, + {(void*)_m, "primitiveDotProduct\000\000\003", (void*)primitiveDotProduct}, + {(void*)_m, "primitiveEqual\000\000\003", (void*)primitiveEqual}, #if SPURVM - {(void*)_m, "primitiveFromFloat64Array\000\000", (void*)primitiveFromFloat64Array}, + {(void*)_m, "primitiveFromFloat64Array\000\000\003", (void*)primitiveFromFloat64Array}, #endif /* SPURVM */ - {(void*)_m, "primitiveHashArray\000\000", (void*)primitiveHashArray}, - {(void*)_m, "primitiveLength\000\000", (void*)primitiveLength}, - {(void*)_m, "primitiveMulFloatArray\000\000", (void*)primitiveMulFloatArray}, - {(void*)_m, "primitiveMulScalar\000\000", (void*)primitiveMulScalar}, - {(void*)_m, "primitiveNormalize\000\000", (void*)primitiveNormalize}, - {(void*)_m, "primitiveSubFloatArray\000\000", (void*)primitiveSubFloatArray}, - {(void*)_m, "primitiveSubScalar\000\000", (void*)primitiveSubScalar}, - {(void*)_m, "primitiveSum\000\000", (void*)primitiveSum}, + {(void*)_m, "primitiveHashArray\000\000\003", (void*)primitiveHashArray}, + {(void*)_m, "primitiveLength\000\000\003", (void*)primitiveLength}, + {(void*)_m, "primitiveMulFloatArray\000\000\003", (void*)primitiveMulFloatArray}, + {(void*)_m, "primitiveMulScalar\000\000\003", (void*)primitiveMulScalar}, + {(void*)_m, "primitiveNormalize\000\000\003", (void*)primitiveNormalize}, + {(void*)_m, "primitiveSubFloatArray\000\000\003", (void*)primitiveSubFloatArray}, + {(void*)_m, "primitiveSubScalar\000\000\003", (void*)primitiveSubScalar}, + {(void*)_m, "primitiveSum\000\000\003", (void*)primitiveSum}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveAddFloatArrayAccessorDepth = 0; -EXPORT(signed char) primitiveAddScalarAccessorDepth = 0; -EXPORT(signed char) primitiveAtAccessorDepth = 0; -EXPORT(signed char) primitiveAtPutAccessorDepth = 0; -EXPORT(signed char) primitiveDivFloatArrayAccessorDepth = 0; -EXPORT(signed char) primitiveDivScalarAccessorDepth = 0; -EXPORT(signed char) primitiveDotProductAccessorDepth = 0; -EXPORT(signed char) primitiveEqualAccessorDepth = 0; #if SPURVM -EXPORT(signed char) primitiveFromFloat64ArrayAccessorDepth = 0; +EXPORT(signed short) primitiveAddFloatArrayMetadata = 3; +EXPORT(signed short) primitiveAddScalarMetadata = 3; +EXPORT(signed short) primitiveAtMetadata = 3; +EXPORT(signed short) primitiveAtPutMetadata = 3; +EXPORT(signed short) primitiveDivFloatArrayMetadata = 3; +EXPORT(signed short) primitiveDivScalarMetadata = 3; +EXPORT(signed short) primitiveDotProductMetadata = 3; +EXPORT(signed short) primitiveEqualMetadata = 3; +#if SPURVM +EXPORT(signed short) primitiveFromFloat64ArrayMetadata = 3; #endif /* SPURVM */ -EXPORT(signed char) primitiveHashArrayAccessorDepth = 0; -EXPORT(signed char) primitiveLengthAccessorDepth = 0; -EXPORT(signed char) primitiveMulFloatArrayAccessorDepth = 0; -EXPORT(signed char) primitiveMulScalarAccessorDepth = 0; -EXPORT(signed char) primitiveNormalizeAccessorDepth = 0; -EXPORT(signed char) primitiveSubFloatArrayAccessorDepth = 0; -EXPORT(signed char) primitiveSubScalarAccessorDepth = 0; -EXPORT(signed char) primitiveSumAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +EXPORT(signed short) primitiveHashArrayMetadata = 3; +EXPORT(signed short) primitiveLengthMetadata = 3; +EXPORT(signed short) primitiveMulFloatArrayMetadata = 3; +EXPORT(signed short) primitiveMulScalarMetadata = 3; +EXPORT(signed short) primitiveNormalizeMetadata = 3; +EXPORT(signed short) primitiveSubFloatArrayMetadata = 3; +EXPORT(signed short) primitiveSubScalarMetadata = 3; +EXPORT(signed short) primitiveSumMetadata = 3; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/FloatMathPlugin/FloatMathPlugin.c b/src/plugins/FloatMathPlugin/FloatMathPlugin.c index 2d86ca1f4e..386bad9512 100644 --- a/src/plugins/FloatMathPlugin/FloatMathPlugin.c +++ b/src/plugins/FloatMathPlugin/FloatMathPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 from - FloatMathPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + FloatMathPlugin VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 */ -static char __buildInfo[] = "FloatMathPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "FloatMathPlugin VMMaker.oscog-eem.3014 uuid: c95cf1a8-05f7-4181-9276-7f3fdc1140e6 " __DATE__ ; #include "config.h" @@ -67,26 +67,20 @@ EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); #if !defined(SQUEAK_BUILTIN_PLUGIN) static sqInt (*failed)(void); -static sqInt (*methodArgumentCount)(void); static sqInt (*methodReturnFloat)(double aFloat); -static sqInt (*pop)(sqInt nItems); static sqInt (*primitiveFail)(void); -static sqInt (*pushFloat)(double f); static double (*stackFloatValue)(sqInt offset); static sqInt (*stackIntegerValue)(sqInt offset); #else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ extern sqInt failed(void); -extern sqInt methodArgumentCount(void); extern sqInt methodReturnFloat(double aFloat); -extern sqInt pop(sqInt nItems); extern sqInt primitiveFail(void); -extern sqInt pushFloat(double f); extern double stackFloatValue(sqInt offset); extern sqInt stackIntegerValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "FloatMathPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "FloatMathPlugin VMMaker.oscog-eem.3014 " INT_EXT; @@ -138,9 +132,7 @@ primitiveArcCos(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -161,9 +153,7 @@ primitiveArcCosH(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -184,9 +174,7 @@ primitiveArcSin(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -207,9 +195,7 @@ primitiveArcSinH(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -230,9 +216,7 @@ primitiveArcTan(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -255,9 +239,7 @@ primitiveArcTan2(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -278,9 +260,7 @@ primitiveArcTanH(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -301,9 +281,7 @@ primitiveCos(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -324,9 +302,7 @@ primitiveCosH(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -347,9 +323,7 @@ primitiveExp(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -372,9 +346,7 @@ primitiveFMod(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -396,9 +368,7 @@ primitiveFractionalPart(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -421,9 +391,7 @@ primitiveHypot(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -447,9 +415,7 @@ primitiveLog10(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -473,9 +439,7 @@ primitiveLogN(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -498,9 +462,7 @@ primitiveRaisedToPower(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -521,9 +483,7 @@ primitiveSin(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -544,9 +504,7 @@ primitiveSinH(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -570,9 +528,7 @@ primitiveSqrt(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -593,9 +549,7 @@ primitiveTan(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -616,9 +570,7 @@ primitiveTanH(void) if (isnan(result)) { return primitiveFail(); } - pop((methodArgumentCount()) + 1); - pushFloat(result); - return 0; + return methodReturnFloat(result); } @@ -677,11 +629,8 @@ setInterpreter(struct VirtualMachine *anInterpreter) #if !defined(SQUEAK_BUILTIN_PLUGIN) failed = interpreterProxy->failed; - methodArgumentCount = interpreterProxy->methodArgumentCount; methodReturnFloat = interpreterProxy->methodReturnFloat; - pop = interpreterProxy->pop; primitiveFail = interpreterProxy->primitiveFail; - pushFloat = interpreterProxy->pushFloat; stackFloatValue = interpreterProxy->stackFloatValue; stackIntegerValue = interpreterProxy->stackIntegerValue; #endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ @@ -695,55 +644,57 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "FloatMathPlugin"; void* FloatMathPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveArcCos\000\000", (void*)primitiveArcCos}, - {(void*)_m, "primitiveArcCosH\000\000", (void*)primitiveArcCosH}, - {(void*)_m, "primitiveArcSin\000\000", (void*)primitiveArcSin}, - {(void*)_m, "primitiveArcSinH\000\000", (void*)primitiveArcSinH}, - {(void*)_m, "primitiveArcTan\000\000", (void*)primitiveArcTan}, - {(void*)_m, "primitiveArcTan2\000\000", (void*)primitiveArcTan2}, - {(void*)_m, "primitiveArcTanH\000\000", (void*)primitiveArcTanH}, - {(void*)_m, "primitiveCos\000\000", (void*)primitiveCos}, - {(void*)_m, "primitiveCosH\000\000", (void*)primitiveCosH}, - {(void*)_m, "primitiveExp\000\000", (void*)primitiveExp}, - {(void*)_m, "primitiveFMod\000\000", (void*)primitiveFMod}, - {(void*)_m, "primitiveFractionalPart\000\000", (void*)primitiveFractionalPart}, - {(void*)_m, "primitiveHypot\000\000", (void*)primitiveHypot}, - {(void*)_m, "primitiveLog10\000\000", (void*)primitiveLog10}, - {(void*)_m, "primitiveLogN\000\000", (void*)primitiveLogN}, - {(void*)_m, "primitiveRaisedToPower\000\000", (void*)primitiveRaisedToPower}, - {(void*)_m, "primitiveSin\000\000", (void*)primitiveSin}, - {(void*)_m, "primitiveSinH\000\000", (void*)primitiveSinH}, - {(void*)_m, "primitiveSqrt\000\000", (void*)primitiveSqrt}, - {(void*)_m, "primitiveTan\000\000", (void*)primitiveTan}, - {(void*)_m, "primitiveTanH\000\000", (void*)primitiveTanH}, - {(void*)_m, "primitiveTimesTwoPower\000\000", (void*)primitiveTimesTwoPower}, + {(void*)_m, "primitiveArcCos\000\000\003", (void*)primitiveArcCos}, + {(void*)_m, "primitiveArcCosH\000\000\003", (void*)primitiveArcCosH}, + {(void*)_m, "primitiveArcSin\000\000\003", (void*)primitiveArcSin}, + {(void*)_m, "primitiveArcSinH\000\000\003", (void*)primitiveArcSinH}, + {(void*)_m, "primitiveArcTan\000\000\003", (void*)primitiveArcTan}, + {(void*)_m, "primitiveArcTan2\000\000\003", (void*)primitiveArcTan2}, + {(void*)_m, "primitiveArcTanH\000\000\003", (void*)primitiveArcTanH}, + {(void*)_m, "primitiveCos\000\000\003", (void*)primitiveCos}, + {(void*)_m, "primitiveCosH\000\000\003", (void*)primitiveCosH}, + {(void*)_m, "primitiveExp\000\000\003", (void*)primitiveExp}, + {(void*)_m, "primitiveFMod\000\000\003", (void*)primitiveFMod}, + {(void*)_m, "primitiveFractionalPart\000\000\003", (void*)primitiveFractionalPart}, + {(void*)_m, "primitiveHypot\000\000\003", (void*)primitiveHypot}, + {(void*)_m, "primitiveLog10\000\000\003", (void*)primitiveLog10}, + {(void*)_m, "primitiveLogN\000\000\003", (void*)primitiveLogN}, + {(void*)_m, "primitiveRaisedToPower\000\000\003", (void*)primitiveRaisedToPower}, + {(void*)_m, "primitiveSin\000\000\003", (void*)primitiveSin}, + {(void*)_m, "primitiveSinH\000\000\003", (void*)primitiveSinH}, + {(void*)_m, "primitiveSqrt\000\000\003", (void*)primitiveSqrt}, + {(void*)_m, "primitiveTan\000\000\003", (void*)primitiveTan}, + {(void*)_m, "primitiveTanH\000\000\003", (void*)primitiveTanH}, + {(void*)_m, "primitiveTimesTwoPower\000\000\003", (void*)primitiveTimesTwoPower}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveArcCosAccessorDepth = 0; -EXPORT(signed char) primitiveArcCosHAccessorDepth = 0; -EXPORT(signed char) primitiveArcSinAccessorDepth = 0; -EXPORT(signed char) primitiveArcSinHAccessorDepth = 0; -EXPORT(signed char) primitiveArcTanAccessorDepth = 0; -EXPORT(signed char) primitiveArcTan2AccessorDepth = 0; -EXPORT(signed char) primitiveArcTanHAccessorDepth = 0; -EXPORT(signed char) primitiveCosAccessorDepth = 0; -EXPORT(signed char) primitiveCosHAccessorDepth = 0; -EXPORT(signed char) primitiveExpAccessorDepth = 0; -EXPORT(signed char) primitiveFModAccessorDepth = 0; -EXPORT(signed char) primitiveFractionalPartAccessorDepth = 0; -EXPORT(signed char) primitiveHypotAccessorDepth = 0; -EXPORT(signed char) primitiveLog10AccessorDepth = 0; -EXPORT(signed char) primitiveLogNAccessorDepth = 0; -EXPORT(signed char) primitiveRaisedToPowerAccessorDepth = 0; -EXPORT(signed char) primitiveSinAccessorDepth = 0; -EXPORT(signed char) primitiveSinHAccessorDepth = 0; -EXPORT(signed char) primitiveSqrtAccessorDepth = 0; -EXPORT(signed char) primitiveTanAccessorDepth = 0; -EXPORT(signed char) primitiveTanHAccessorDepth = 0; -EXPORT(signed char) primitiveTimesTwoPowerAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveArcCosMetadata = 3; +EXPORT(signed short) primitiveArcCosHMetadata = 3; +EXPORT(signed short) primitiveArcSinMetadata = 3; +EXPORT(signed short) primitiveArcSinHMetadata = 3; +EXPORT(signed short) primitiveArcTanMetadata = 3; +EXPORT(signed short) primitiveArcTan2Metadata = 3; +EXPORT(signed short) primitiveArcTanHMetadata = 3; +EXPORT(signed short) primitiveCosMetadata = 3; +EXPORT(signed short) primitiveCosHMetadata = 3; +EXPORT(signed short) primitiveExpMetadata = 3; +EXPORT(signed short) primitiveFModMetadata = 3; +EXPORT(signed short) primitiveFractionalPartMetadata = 3; +EXPORT(signed short) primitiveHypotMetadata = 3; +EXPORT(signed short) primitiveLog10Metadata = 3; +EXPORT(signed short) primitiveLogNMetadata = 3; +EXPORT(signed short) primitiveRaisedToPowerMetadata = 3; +EXPORT(signed short) primitiveSinMetadata = 3; +EXPORT(signed short) primitiveSinHMetadata = 3; +EXPORT(signed short) primitiveSqrtMetadata = 3; +EXPORT(signed short) primitiveTanMetadata = 3; +EXPORT(signed short) primitiveTanHMetadata = 3; +EXPORT(signed short) primitiveTimesTwoPowerMetadata = 3; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/GdbARMPlugin/GdbARMPlugin.c b/src/plugins/GdbARMPlugin/GdbARMPlugin.c index 2cc57180b2..4605c3e4d3 100644 --- a/src/plugins/GdbARMPlugin/GdbARMPlugin.c +++ b/src/plugins/GdbARMPlugin/GdbARMPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - GdbARMv6Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 + GdbARMv6Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 */ -static char __buildInfo[] = "GdbARMv6Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 " __DATE__ ; +static char __buildInfo[] = "GdbARMv6Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 " __DATE__ ; #include "config.h" @@ -171,7 +171,7 @@ extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePo extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "GdbARMPlugin Cog-eem.435 " INT_EXT; +static const char *moduleName = "GdbARMPlugin Cog-eem.438 " INT_EXT; /* ProcessorSimulatorPlugin>>#forceStopOnInterrupt */ @@ -228,15 +228,11 @@ primitiveDisassembleAtInMemory(void) logLen = 0; if (!((isIntegerObject((address = stackValue(1)))) && (isWordsOrBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } address = integerValueOf(address); memory = ((char *) (firstIndexableField(stackValue(0)))); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -313,15 +309,11 @@ primitiveFlushICacheFromTo(void) if (!((isIntegerObject((startAddress = stackValue(1)))) && (isIntegerObject((endAddress = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } startAddress = integerValueOf(startAddress); endAddress = integerValueOf(endAddress); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -351,9 +343,6 @@ primitiveIntegerRegisterState(void) sqInt registerStateVector; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -400,9 +389,6 @@ primitiveResetCPU(void) sqInt maybeErr; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -446,17 +432,13 @@ primitiveRunInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -507,16 +489,12 @@ primitiveRunInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -568,17 +546,13 @@ primitiveRunInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -630,17 +604,13 @@ primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -685,16 +655,12 @@ primitiveSingleStepInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -740,17 +706,13 @@ primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -873,33 +835,35 @@ startOfData(sqInt alienOop) static char _m[] = "GdbARMPlugin"; void* GdbARMPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDisassembleAtInMemory\000\000", (void*)primitiveDisassembleAtInMemory}, - {(void*)_m, "primitiveErrorAndLog\000\377", (void*)primitiveErrorAndLog}, - {(void*)_m, "primitiveFlushICacheFromTo\000\000", (void*)primitiveFlushICacheFromTo}, - {(void*)_m, "primitiveIntegerRegisterState\000\000", (void*)primitiveIntegerRegisterState}, - {(void*)_m, "primitiveNewCPU\000\377", (void*)primitiveNewCPU}, - {(void*)_m, "primitiveResetCPU\000\000", (void*)primitiveResetCPU}, - {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveDisassembleAtInMemory\000\000\000", (void*)primitiveDisassembleAtInMemory}, + {(void*)_m, "primitiveErrorAndLog\000\377\000", (void*)primitiveErrorAndLog}, + {(void*)_m, "primitiveFlushICacheFromTo\000\000\000", (void*)primitiveFlushICacheFromTo}, + {(void*)_m, "primitiveIntegerRegisterState\000\000\000", (void*)primitiveIntegerRegisterState}, + {(void*)_m, "primitiveNewCPU\000\377\000", (void*)primitiveNewCPU}, + {(void*)_m, "primitiveResetCPU\000\000\000", (void*)primitiveResetCPU}, + {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveDisassembleAtInMemoryAccessorDepth = 0; -EXPORT(signed char) primitiveFlushICacheFromToAccessorDepth = 0; -EXPORT(signed char) primitiveIntegerRegisterStateAccessorDepth = 0; -EXPORT(signed char) primitiveResetCPUAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveDisassembleAtInMemoryMetadata = 0; +EXPORT(signed short) primitiveFlushICacheFromToMetadata = 0; +EXPORT(signed short) primitiveIntegerRegisterStateMetadata = 0; +EXPORT(signed short) primitiveResetCPUMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/GdbARMv8Plugin/GdbARMv8Plugin.c b/src/plugins/GdbARMv8Plugin/GdbARMv8Plugin.c index 3621e256a2..8eb16d8a3b 100644 --- a/src/plugins/GdbARMv8Plugin/GdbARMv8Plugin.c +++ b/src/plugins/GdbARMv8Plugin/GdbARMv8Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - GdbARMv8Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 + GdbARMv8Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 */ -static char __buildInfo[] = "GdbARMv8Plugin Cog-eem.435 uuid: d02b8a08-b3b8-40f2-afa7-992cd048c258 " __DATE__ ; +static char __buildInfo[] = "GdbARMv8Plugin Cog-eem.438 uuid: 9ba20ae6-d5e7-4ef0-be5b-cdb949b42283 " __DATE__ ; #include "config.h" @@ -171,7 +171,7 @@ extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePo extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "GdbARMv8Plugin Cog-eem.435 " INT_EXT; +static const char *moduleName = "GdbARMv8Plugin Cog-eem.438 " INT_EXT; /* ProcessorSimulatorPlugin>>#forceStopOnInterrupt */ @@ -228,15 +228,11 @@ primitiveDisassembleAtInMemory(void) logLen = 0; if (!((isIntegerObject((address = stackValue(1)))) && (isWordsOrBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } address = integerValueOf(address); memory = ((char *) (firstIndexableField(stackValue(0)))); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -313,15 +309,11 @@ primitiveFlushICacheFromTo(void) if (!((isIntegerObject((startAddress = stackValue(1)))) && (isIntegerObject((endAddress = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } startAddress = integerValueOf(startAddress); endAddress = integerValueOf(endAddress); cpuAlien = stackValue(2); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -351,9 +343,6 @@ primitiveIntegerRegisterState(void) sqInt registerStateVector; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -400,9 +389,6 @@ primitiveResetCPU(void) sqInt maybeErr; cpuAlien = stackValue(0); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -446,17 +432,13 @@ primitiveRunInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -507,16 +489,12 @@ primitiveRunInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -568,17 +546,13 @@ primitiveRunInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -630,17 +604,13 @@ primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite(void) && ((isIntegerObject((minAddress = stackValue(2)))) && ((isIntegerObject((maxAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); minAddress = integerValueOf(minAddress); maxAddress = integerValueOf(maxAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -685,16 +655,12 @@ primitiveSingleStepInMemoryMinimumAddressReadWrite(void) if (!((isWordsOrBytes(stackValue(2))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(2)))); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(3); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -740,17 +706,13 @@ primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite(void) && ((isIntegerObject((offset = stackValue(2)))) && ((isIntegerObject((minAddress = stackValue(1)))) && (isIntegerObject((minWriteMaxExecAddress = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } memory = ((char *) (firstIndexableField(stackValue(3)))); offset = integerValueOf(offset); minAddress = integerValueOf(minAddress); minWriteMaxExecAddress = integerValueOf(minWriteMaxExecAddress); cpuAlien = stackValue(4); - if (failed()) { - return null; - } if (((cpu = ((void *) (((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))))) == 0) { @@ -873,33 +835,35 @@ startOfData(sqInt alienOop) static char _m[] = "GdbARMv8Plugin"; void* GdbARMv8Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDisassembleAtInMemory\000\000", (void*)primitiveDisassembleAtInMemory}, - {(void*)_m, "primitiveErrorAndLog\000\377", (void*)primitiveErrorAndLog}, - {(void*)_m, "primitiveFlushICacheFromTo\000\000", (void*)primitiveFlushICacheFromTo}, - {(void*)_m, "primitiveIntegerRegisterState\000\000", (void*)primitiveIntegerRegisterState}, - {(void*)_m, "primitiveNewCPU\000\377", (void*)primitiveNewCPU}, - {(void*)_m, "primitiveResetCPU\000\000", (void*)primitiveResetCPU}, - {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, - {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveDisassembleAtInMemory\000\000\000", (void*)primitiveDisassembleAtInMemory}, + {(void*)_m, "primitiveErrorAndLog\000\377\000", (void*)primitiveErrorAndLog}, + {(void*)_m, "primitiveFlushICacheFromTo\000\000\000", (void*)primitiveFlushICacheFromTo}, + {(void*)_m, "primitiveIntegerRegisterState\000\000\000", (void*)primitiveIntegerRegisterState}, + {(void*)_m, "primitiveNewCPU\000\377\000", (void*)primitiveNewCPU}, + {(void*)_m, "primitiveResetCPU\000\000\000", (void*)primitiveResetCPU}, + {(void*)_m, "primitiveRunInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveRunInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveRunInMemoryOffsetMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinAddressMaxAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryMinimumAddressReadWrite}, + {(void*)_m, "primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite\000\000\000", (void*)primitiveSingleStepInMemoryOffsetMinimumAddressReadWrite}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveDisassembleAtInMemoryAccessorDepth = 0; -EXPORT(signed char) primitiveFlushICacheFromToAccessorDepth = 0; -EXPORT(signed char) primitiveIntegerRegisterStateAccessorDepth = 0; -EXPORT(signed char) primitiveResetCPUAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveRunInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryMinimumAddressReadWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveDisassembleAtInMemoryMetadata = 0; +EXPORT(signed short) primitiveFlushICacheFromToMetadata = 0; +EXPORT(signed short) primitiveIntegerRegisterStateMetadata = 0; +EXPORT(signed short) primitiveResetCPUMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveRunInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinAddressMaxAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryMinimumAddressReadWriteMetadata = 0; +EXPORT(signed short) primitiveSingleStepInMemoryOffsetMinimumAddressReadWriteMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/GeniePlugin/GeniePlugin.c b/src/plugins/GeniePlugin/GeniePlugin.c index a9402a0ee3..393e73d417 100644 --- a/src/plugins/GeniePlugin/GeniePlugin.c +++ b/src/plugins/GeniePlugin/GeniePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - GeniePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + GeniePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "GeniePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "GeniePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -94,7 +94,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "GeniePlugin v2.0 12 April 2021 VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "GeniePlugin v2.0 3 August 2021 VMMaker.oscog-eem.3024 " INT_EXT; @@ -223,8 +223,7 @@ primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_m sqInt _return_value; if (!(isIntegerObject((maxSizeAndRefFlag = stackValue(3))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } myPointsOop = stackValue(11); otherPointsOop = stackValue(10); @@ -238,9 +237,6 @@ primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_m rowBaseOop = stackValue(2); rowInsertRemoveOop = stackValue(1); rowInsertRemoveCountOop = stackValue(0); - if (failed()) { - return null; - } if (failed()) { msg("failed 1"); return null; @@ -449,14 +445,16 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "GeniePlugin"; void* GeniePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_mySquaredLengths_otherSquaredLengths_myAngles_otherAngles_maxSizeAndReferenceFlag_rowBase_rowInsertRemove_rowInsertRemoveCount\000\001", (void*)primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_mySquaredLengths_otherSquaredLengths_myAngles_otherAngles_maxSizeAndReferenceFlag_rowBase_rowInsertRemove_rowInsertRemoveCount}, - {(void*)_m, "primVersionNO\000\377", (void*)primVersionNO}, + {(void*)_m, "primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_mySquaredLengths_otherSquaredLengths_myAngles_otherAngles_maxSizeAndReferenceFlag_rowBase_rowInsertRemove_rowInsertRemoveCount\000\001\000", (void*)primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_mySquaredLengths_otherSquaredLengths_myAngles_otherAngles_maxSizeAndReferenceFlag_rowBase_rowInsertRemove_rowInsertRemoveCount}, + {(void*)_m, "primVersionNO\000\377\000", (void*)primVersionNO}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_mySquaredLengths_otherSquaredLengths_myAngles_otherAngles_maxSizeAndReferenceFlag_rowBase_rowInsertRemove_rowInsertRemoveCountAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primSameClassAbsoluteStrokeDistanceMyPoints_otherPoints_myVectors_otherVectors_mySquaredLengths_otherSquaredLengths_myAngles_otherAngles_maxSizeAndReferenceFlag_rowBase_rowInsertRemove_rowInsertRemoveCountMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/HostWindowPlugin/HostWindowPlugin.c b/src/plugins/HostWindowPlugin/HostWindowPlugin.c index dc1460e16c..ce8872e57d 100644 --- a/src/plugins/HostWindowPlugin/HostWindowPlugin.c +++ b/src/plugins/HostWindowPlugin/HostWindowPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - HostWindowPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + HostWindowPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "HostWindowPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "HostWindowPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -136,7 +136,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "HostWindowPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "HostWindowPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -166,13 +166,9 @@ primitiveCloseHostWindow(void) sqInt windowIndex; if (!(isIntegerObject((windowIndex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowIndex = integerValueOf(windowIndex); - if (failed()) { - return null; - } ok = closeWindow(windowIndex); if (!ok) { primitiveFail(); @@ -207,17 +203,13 @@ primitiveCreateHostWindow(void) && ((isIntegerObject((x = stackValue(2)))) && ((isIntegerObject((y = stackValue(1)))) && (isBytes(stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } w = integerValueOf(w); h = integerValueOf(h); x = integerValueOf(x); y = integerValueOf(y); list = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } listLength = slotSizeOf(((sqInt)(sqIntptr_t)(list) - BaseHeaderSize)); windowIndex = createWindowWidthheightoriginXyattrlength(w, h, x, y, list, listLength); if (windowIndex > 0) { @@ -246,14 +238,10 @@ primitiveHostWindowIcon(void) if (!((isIntegerObject((id = stackValue(1)))) && (isBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } id = integerValueOf(id); pathString = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } pathLength = slotSizeOf(((sqInt)(sqIntptr_t)(pathString) - BaseHeaderSize)); res = ioSetIconOfWindow(id, pathString, pathLength); if (res == 0) { @@ -283,13 +271,9 @@ primitiveHostWindowPosition(void) sqInt _return_value; if (!(isIntegerObject((windowIndex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowIndex = integerValueOf(windowIndex); - if (failed()) { - return null; - } pos = ioPositionOfWindow(windowIndex); if (pos == -1) { return primitiveFail(); @@ -324,15 +308,11 @@ primitiveHostWindowPositionSet(void) if (!((isIntegerObject((windowIndex = stackValue(2)))) && ((isIntegerObject((x = stackValue(1)))) && (isIntegerObject((y = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowIndex = integerValueOf(windowIndex); x = integerValueOf(x); y = integerValueOf(y); - if (failed()) { - return null; - } pos = ioPositionOfWindowSetxy(windowIndex, x, y); if (pos == -1) { return primitiveFail(); @@ -362,13 +342,9 @@ primitiveHostWindowScreenWorkAreaPosition(void) sqInt _return_value; if (!(isIntegerObject((windex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windex = integerValueOf(windex); - if (failed()) { - return null; - } size = ioPositionOfScreenWorkArea(windex); if (size == -1) { return primitiveFail(); @@ -399,13 +375,9 @@ primitiveHostWindowScreenWorkAreaSize(void) sqInt _return_value; if (!(isIntegerObject((windex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windex = integerValueOf(windex); - if (failed()) { - return null; - } size = ioSizeOfScreenWorkArea(windex); if (size == -1) { return primitiveFail(); @@ -436,13 +408,9 @@ primitiveHostWindowSize(void) sqInt _return_value; if (!(isIntegerObject((windowIndex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowIndex = integerValueOf(windowIndex); - if (failed()) { - return null; - } size = ioSizeOfWindow(windowIndex); if (size == -1) { return primitiveFail(); @@ -476,15 +444,11 @@ primitiveHostWindowSizeSet(void) if (!((isIntegerObject((windowIndex = stackValue(2)))) && ((isIntegerObject((x = stackValue(1)))) && (isIntegerObject((y = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowIndex = integerValueOf(windowIndex); x = integerValueOf(x); y = integerValueOf(y); - if (failed()) { - return null; - } size = ioSizeOfWindowSetxy(windowIndex, x, y); if (size == -1) { return primitiveFail(); @@ -514,14 +478,10 @@ primitiveHostWindowTitle(void) if (!((isIntegerObject((id = stackValue(1)))) && (isBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } id = integerValueOf(id); titleString = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } titleLength = slotSizeOf(((sqInt)(sqIntptr_t)(titleString) - BaseHeaderSize)); if ((ioSetTitleOfWindow(id, titleString, titleLength)) == -1) { primitiveFail(); @@ -549,15 +509,11 @@ primitiveNativeDisplayPosition(void) sqInt _return_value; if (!(isPositiveMachineIntegerObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowHandle = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(0)) : positive64BitValueOf(stackValue(0))); - if (failed()) { - return null; - } pos = ioPositionOfNativeDisplay(windowHandle); if (pos == -1) { return primitiveFail(); @@ -588,15 +544,11 @@ primitiveNativeDisplaySize(void) sqInt _return_value; if (!(isPositiveMachineIntegerObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowHandle = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(0)) : positive64BitValueOf(stackValue(0))); - if (failed()) { - return null; - } size = ioSizeOfNativeDisplay(windowHandle); if (size == -1) { return primitiveFail(); @@ -629,15 +581,11 @@ primitiveNativeWindowPosition(void) sqInt _return_value; if (!(isPositiveMachineIntegerObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowHandle = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(0)) : positive64BitValueOf(stackValue(0))); - if (failed()) { - return null; - } pos = ioPositionOfNativeWindow(windowHandle); if (pos == -1) { return primitiveFail(); @@ -668,15 +616,11 @@ primitiveNativeWindowSize(void) sqInt _return_value; if (!(isPositiveMachineIntegerObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowHandle = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(0)) : positive64BitValueOf(stackValue(0))); - if (failed()) { - return null; - } size = ioSizeOfNativeWindow(windowHandle); if (size == -1) { return primitiveFail(); @@ -730,14 +674,10 @@ primitiveSetCursorPosition(void) if (!((isIntegerObject((x = stackValue(1)))) && (isIntegerObject((y = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } x = integerValueOf(x); y = integerValueOf(y); - if (failed()) { - return null; - } result = ioSetCursorPositionXY(x, y); if (result == -1) { return primitiveFail(); @@ -779,8 +719,7 @@ primitiveShowHostWindowRect(void) && ((isIntegerObject((right = stackValue(2)))) && ((isIntegerObject((top = stackValue(1)))) && (isIntegerObject((bottom = stackValue(0))))))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } windowIndex = integerValueOf(windowIndex); dispBits = ((unsigned *) (firstIndexableField(stackValue(7)))); @@ -791,9 +730,6 @@ primitiveShowHostWindowRect(void) right = integerValueOf(right); top = integerValueOf(top); bottom = integerValueOf(bottom); - if (failed()) { - return null; - } if (!(ioShowDisplayOnWindow(dispBits, w, h, d, left, right, top, bottom, windowIndex))) { primitiveFail(); } @@ -902,62 +838,64 @@ shutdownModule(void) static char _m[] = "HostWindowPlugin"; void* HostWindowPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveCloseHostWindow\000\000", (void*)primitiveCloseHostWindow}, - {(void*)_m, "primitiveCreateHostWindow\000\000", (void*)primitiveCreateHostWindow}, - {(void*)_m, "primitiveHostWindowIcon\000\000", (void*)primitiveHostWindowIcon}, - {(void*)_m, "primitiveHostWindowPosition\000\000", (void*)primitiveHostWindowPosition}, - {(void*)_m, "primitiveHostWindowPositionSet\000\000", (void*)primitiveHostWindowPositionSet}, + {(void*)_m, "primitiveCloseHostWindow\000\000\000", (void*)primitiveCloseHostWindow}, + {(void*)_m, "primitiveCreateHostWindow\000\000\000", (void*)primitiveCreateHostWindow}, + {(void*)_m, "primitiveHostWindowIcon\000\000\000", (void*)primitiveHostWindowIcon}, + {(void*)_m, "primitiveHostWindowPosition\000\000\000", (void*)primitiveHostWindowPosition}, + {(void*)_m, "primitiveHostWindowPositionSet\000\000\000", (void*)primitiveHostWindowPositionSet}, #if TerfVM - {(void*)_m, "primitiveHostWindowScreenWorkAreaPosition\000\000", (void*)primitiveHostWindowScreenWorkAreaPosition}, + {(void*)_m, "primitiveHostWindowScreenWorkAreaPosition\000\000\000", (void*)primitiveHostWindowScreenWorkAreaPosition}, #endif /* TerfVM */ #if TerfVM - {(void*)_m, "primitiveHostWindowScreenWorkAreaSize\000\000", (void*)primitiveHostWindowScreenWorkAreaSize}, + {(void*)_m, "primitiveHostWindowScreenWorkAreaSize\000\000\000", (void*)primitiveHostWindowScreenWorkAreaSize}, #endif /* TerfVM */ - {(void*)_m, "primitiveHostWindowSize\000\000", (void*)primitiveHostWindowSize}, - {(void*)_m, "primitiveHostWindowSizeSet\000\000", (void*)primitiveHostWindowSizeSet}, - {(void*)_m, "primitiveHostWindowTitle\000\000", (void*)primitiveHostWindowTitle}, + {(void*)_m, "primitiveHostWindowSize\000\000\000", (void*)primitiveHostWindowSize}, + {(void*)_m, "primitiveHostWindowSizeSet\000\000\000", (void*)primitiveHostWindowSizeSet}, + {(void*)_m, "primitiveHostWindowTitle\000\000\000", (void*)primitiveHostWindowTitle}, #if TerfVM - {(void*)_m, "primitiveNativeDisplayPosition\000\377", (void*)primitiveNativeDisplayPosition}, + {(void*)_m, "primitiveNativeDisplayPosition\000\377\000", (void*)primitiveNativeDisplayPosition}, #endif /* TerfVM */ #if TerfVM - {(void*)_m, "primitiveNativeDisplaySize\000\377", (void*)primitiveNativeDisplaySize}, + {(void*)_m, "primitiveNativeDisplaySize\000\377\000", (void*)primitiveNativeDisplaySize}, #endif /* TerfVM */ #if TerfVM - {(void*)_m, "primitiveNativeWindowPosition\000\377", (void*)primitiveNativeWindowPosition}, + {(void*)_m, "primitiveNativeWindowPosition\000\377\000", (void*)primitiveNativeWindowPosition}, #endif /* TerfVM */ #if TerfVM - {(void*)_m, "primitiveNativeWindowSize\000\377", (void*)primitiveNativeWindowSize}, + {(void*)_m, "primitiveNativeWindowSize\000\377\000", (void*)primitiveNativeWindowSize}, #endif /* TerfVM */ #if TerfVM - {(void*)_m, "primitiveScreenRectangles\000\377", (void*)primitiveScreenRectangles}, + {(void*)_m, "primitiveScreenRectangles\000\377\000", (void*)primitiveScreenRectangles}, #endif /* TerfVM */ - {(void*)_m, "primitiveSetCursorPosition\000\000", (void*)primitiveSetCursorPosition}, - {(void*)_m, "primitiveShowHostWindowRect\000\000", (void*)primitiveShowHostWindowRect}, + {(void*)_m, "primitiveSetCursorPosition\000\000\000", (void*)primitiveSetCursorPosition}, + {(void*)_m, "primitiveShowHostWindowRect\000\000\000", (void*)primitiveShowHostWindowRect}, #if TerfVM - {(void*)_m, "primitiveSqueakWindowHandle\000\377", (void*)primitiveSqueakWindowHandle}, + {(void*)_m, "primitiveSqueakWindowHandle\000\377\000", (void*)primitiveSqueakWindowHandle}, #endif /* TerfVM */ {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveCloseHostWindowAccessorDepth = 0; -EXPORT(signed char) primitiveCreateHostWindowAccessorDepth = 0; -EXPORT(signed char) primitiveHostWindowIconAccessorDepth = 0; -EXPORT(signed char) primitiveHostWindowPositionAccessorDepth = 0; -EXPORT(signed char) primitiveHostWindowPositionSetAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveCloseHostWindowMetadata = 0; +EXPORT(signed short) primitiveCreateHostWindowMetadata = 0; +EXPORT(signed short) primitiveHostWindowIconMetadata = 0; +EXPORT(signed short) primitiveHostWindowPositionMetadata = 0; +EXPORT(signed short) primitiveHostWindowPositionSetMetadata = 0; #if TerfVM -EXPORT(signed char) primitiveHostWindowScreenWorkAreaPositionAccessorDepth = 0; +EXPORT(signed short) primitiveHostWindowScreenWorkAreaPositionMetadata = 0; #endif /* TerfVM */ #if TerfVM -EXPORT(signed char) primitiveHostWindowScreenWorkAreaSizeAccessorDepth = 0; +EXPORT(signed short) primitiveHostWindowScreenWorkAreaSizeMetadata = 0; #endif /* TerfVM */ -EXPORT(signed char) primitiveHostWindowSizeAccessorDepth = 0; -EXPORT(signed char) primitiveHostWindowSizeSetAccessorDepth = 0; -EXPORT(signed char) primitiveHostWindowTitleAccessorDepth = 0; -EXPORT(signed char) primitiveSetCursorPositionAccessorDepth = 0; -EXPORT(signed char) primitiveShowHostWindowRectAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +EXPORT(signed short) primitiveHostWindowSizeMetadata = 0; +EXPORT(signed short) primitiveHostWindowSizeSetMetadata = 0; +EXPORT(signed short) primitiveHostWindowTitleMetadata = 0; +EXPORT(signed short) primitiveSetCursorPositionMetadata = 0; +EXPORT(signed short) primitiveShowHostWindowRectMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/IA32ABI/IA32ABI.c b/src/plugins/IA32ABI/IA32ABI.c index ea166ec575..6df15b0e7e 100644 --- a/src/plugins/IA32ABI/IA32ABI.c +++ b/src/plugins/IA32ABI/IA32ABI.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2988 uuid: 9e67581e-33d5-403f-bc83-f4af6a2e1c70 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - IA32ABIPlugin VMMaker.oscog-eem.2988 uuid: 9e67581e-33d5-403f-bc83-f4af6a2e1c70 + IA32ABIPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "IA32ABIPlugin VMMaker.oscog-eem.2988 uuid: 9e67581e-33d5-403f-bc83-f4af6a2e1c70 " __DATE__ ; +static char __buildInfo[] = "IA32ABIPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -284,7 +284,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "IA32ABI VMMaker.oscog-eem.2988 " INT_EXT; +static const char *moduleName = "IA32ABI VMMaker.oscog-eem.3024 " INT_EXT; @@ -2464,116 +2464,118 @@ startOfDatawithSize(sqInt rcvr, sqInt sizeField) static char _m[] = "IA32ABI"; void* IA32ABI_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primAddressField\000\000", (void*)primAddressField}, - {(void*)_m, "primAddressFieldPut\000\000", (void*)primAddressFieldPut}, - {(void*)_m, "primAlienCopyInto\000\000", (void*)primAlienCopyInto}, - {(void*)_m, "primAlienReplace\000\000", (void*)primAlienReplace}, - {(void*)_m, "primAllocateExecutablePage\000\377", (void*)primAllocateExecutablePage}, - {(void*)_m, "primBoxedFree\000\001", (void*)primBoxedFree}, - {(void*)_m, "primCallOutDoubleReturn\000\000", (void*)primCallOutDoubleReturn}, - {(void*)_m, "primCallOutFloatReturn\000\000", (void*)primCallOutFloatReturn}, - {(void*)_m, "primCallOutIntegralReturn\000\000", (void*)primCallOutIntegralReturn}, - {(void*)_m, "primCalloc\000\000", (void*)primCalloc}, - {(void*)_m, "primDoubleAt\000\000", (void*)primDoubleAt}, - {(void*)_m, "primDoubleAtPut\000\000", (void*)primDoubleAtPut}, - {(void*)_m, "primDrainOSEventQueue\000\377", (void*)primDrainOSEventQueue}, - {(void*)_m, "primFloatAt\000\000", (void*)primFloatAt}, - {(void*)_m, "primFloatAtPut\000\000", (void*)primFloatAtPut}, - {(void*)_m, "primFree\000\000", (void*)primFree}, - {(void*)_m, "primInIOProcessEventsFlagAddress\000\377", (void*)primInIOProcessEventsFlagAddress}, - {(void*)_m, "primInLibraryFindSymbol\000\000", (void*)primInLibraryFindSymbol}, - {(void*)_m, "primLoadLibrary\000\000", (void*)primLoadLibrary}, - {(void*)_m, "primMalloc\000\000", (void*)primMalloc}, - {(void*)_m, "primMostRecentCallbackContext\000\377", (void*)primMostRecentCallbackContext}, - {(void*)_m, "primOopAt\000\000", (void*)primOopAt}, - {(void*)_m, "primOopAtPut\000\000", (void*)primOopAtPut}, - {(void*)_m, "primReturnAsFromContextThrough\000\000", (void*)primReturnAsFromContextThrough}, + {(void*)_m, "primAddressField\000\000\000", (void*)primAddressField}, + {(void*)_m, "primAddressFieldPut\000\000\000", (void*)primAddressFieldPut}, + {(void*)_m, "primAlienCopyInto\000\001\000", (void*)primAlienCopyInto}, + {(void*)_m, "primAlienReplace\000\001\000", (void*)primAlienReplace}, + {(void*)_m, "primAllocateExecutablePage\000\377\000", (void*)primAllocateExecutablePage}, + {(void*)_m, "primBoxedFree\000\001\000", (void*)primBoxedFree}, + {(void*)_m, "primCallOutDoubleReturn\000\000\000", (void*)primCallOutDoubleReturn}, + {(void*)_m, "primCallOutFloatReturn\000\000\000", (void*)primCallOutFloatReturn}, + {(void*)_m, "primCallOutIntegralReturn\000\000\000", (void*)primCallOutIntegralReturn}, + {(void*)_m, "primCalloc\000\000\000", (void*)primCalloc}, + {(void*)_m, "primDoubleAt\000\001\000", (void*)primDoubleAt}, + {(void*)_m, "primDoubleAtPut\000\001\000", (void*)primDoubleAtPut}, + {(void*)_m, "primDrainOSEventQueue\000\377\000", (void*)primDrainOSEventQueue}, + {(void*)_m, "primFloatAt\000\001\000", (void*)primFloatAt}, + {(void*)_m, "primFloatAtPut\000\001\000", (void*)primFloatAtPut}, + {(void*)_m, "primFree\000\000\000", (void*)primFree}, + {(void*)_m, "primInIOProcessEventsFlagAddress\000\377\000", (void*)primInIOProcessEventsFlagAddress}, + {(void*)_m, "primInLibraryFindSymbol\000\000\000", (void*)primInLibraryFindSymbol}, + {(void*)_m, "primLoadLibrary\000\000\000", (void*)primLoadLibrary}, + {(void*)_m, "primMalloc\000\000\000", (void*)primMalloc}, + {(void*)_m, "primMostRecentCallbackContext\000\377\000", (void*)primMostRecentCallbackContext}, + {(void*)_m, "primOopAt\000\001\000", (void*)primOopAt}, + {(void*)_m, "primOopAtPut\000\001\000", (void*)primOopAtPut}, + {(void*)_m, "primReturnAsFromContextThrough\000\000\000", (void*)primReturnAsFromContextThrough}, #if OBSOLETE_ALIEN_PRIMITIVES - {(void*)_m, "primReturnFromContextThrough\000\000", (void*)primReturnFromContextThrough}, + {(void*)_m, "primReturnFromContextThrough\000\000\000", (void*)primReturnFromContextThrough}, #endif /* OBSOLETE_ALIEN_PRIMITIVES */ - {(void*)_m, "primSignedByteAt\000\000", (void*)primSignedByteAt}, - {(void*)_m, "primSignedByteAtPut\000\000", (void*)primSignedByteAtPut}, - {(void*)_m, "primSignedLongAt\000\000", (void*)primSignedLongAt}, - {(void*)_m, "primSignedLongAtPut\000\000", (void*)primSignedLongAtPut}, - {(void*)_m, "primSignedLongLongAt\000\000", (void*)primSignedLongLongAt}, - {(void*)_m, "primSignedLongLongAtPut\000\000", (void*)primSignedLongLongAtPut}, - {(void*)_m, "primSignedShortAt\000\000", (void*)primSignedShortAt}, - {(void*)_m, "primSignedShortAtPut\000\000", (void*)primSignedShortAtPut}, - {(void*)_m, "primSignedWordAt\000\000", (void*)primSignedWordAt}, - {(void*)_m, "primSignedWordAtPut\000\000", (void*)primSignedWordAtPut}, - {(void*)_m, "primSizeField\000\000", (void*)primSizeField}, - {(void*)_m, "primSizeFieldPut\000\000", (void*)primSizeFieldPut}, - {(void*)_m, "primStrlenFromStartIndex\000\000", (void*)primStrlenFromStartIndex}, - {(void*)_m, "primStrlenThroughPointerAtIndex\000\000", (void*)primStrlenThroughPointerAtIndex}, - {(void*)_m, "primThunkEntryAddress\000\377", (void*)primThunkEntryAddress}, - {(void*)_m, "primUnsignedByteAt\000\000", (void*)primUnsignedByteAt}, - {(void*)_m, "primUnsignedByteAtPut\000\000", (void*)primUnsignedByteAtPut}, - {(void*)_m, "primUnsignedLongAt\000\000", (void*)primUnsignedLongAt}, - {(void*)_m, "primUnsignedLongAtPut\000\000", (void*)primUnsignedLongAtPut}, - {(void*)_m, "primUnsignedLongLongAt\000\000", (void*)primUnsignedLongLongAt}, - {(void*)_m, "primUnsignedLongLongAtPut\000\000", (void*)primUnsignedLongLongAtPut}, - {(void*)_m, "primUnsignedShortAt\000\000", (void*)primUnsignedShortAt}, - {(void*)_m, "primUnsignedShortAtPut\000\000", (void*)primUnsignedShortAtPut}, - {(void*)_m, "primUnsignedWordAt\000\000", (void*)primUnsignedWordAt}, - {(void*)_m, "primUnsignedWordAtPut\000\000", (void*)primUnsignedWordAtPut}, - {(void*)_m, "primVarArgsCallOutDoubleReturn\000\000", (void*)primVarArgsCallOutDoubleReturn}, - {(void*)_m, "primVarArgsCallOutFloatReturn\000\000", (void*)primVarArgsCallOutFloatReturn}, - {(void*)_m, "primVarArgsCallOutIntegralReturn\000\000", (void*)primVarArgsCallOutIntegralReturn}, + {(void*)_m, "primSignedByteAt\000\001\000", (void*)primSignedByteAt}, + {(void*)_m, "primSignedByteAtPut\000\001\000", (void*)primSignedByteAtPut}, + {(void*)_m, "primSignedLongAt\000\001\000", (void*)primSignedLongAt}, + {(void*)_m, "primSignedLongAtPut\000\001\000", (void*)primSignedLongAtPut}, + {(void*)_m, "primSignedLongLongAt\000\001\000", (void*)primSignedLongLongAt}, + {(void*)_m, "primSignedLongLongAtPut\000\001\000", (void*)primSignedLongLongAtPut}, + {(void*)_m, "primSignedShortAt\000\001\000", (void*)primSignedShortAt}, + {(void*)_m, "primSignedShortAtPut\000\001\000", (void*)primSignedShortAtPut}, + {(void*)_m, "primSignedWordAt\000\001\000", (void*)primSignedWordAt}, + {(void*)_m, "primSignedWordAtPut\000\001\000", (void*)primSignedWordAtPut}, + {(void*)_m, "primSizeField\000\000\000", (void*)primSizeField}, + {(void*)_m, "primSizeFieldPut\000\000\000", (void*)primSizeFieldPut}, + {(void*)_m, "primStrlenFromStartIndex\000\001\000", (void*)primStrlenFromStartIndex}, + {(void*)_m, "primStrlenThroughPointerAtIndex\000\001\000", (void*)primStrlenThroughPointerAtIndex}, + {(void*)_m, "primThunkEntryAddress\000\377\000", (void*)primThunkEntryAddress}, + {(void*)_m, "primUnsignedByteAt\000\001\000", (void*)primUnsignedByteAt}, + {(void*)_m, "primUnsignedByteAtPut\000\001\000", (void*)primUnsignedByteAtPut}, + {(void*)_m, "primUnsignedLongAt\000\001\000", (void*)primUnsignedLongAt}, + {(void*)_m, "primUnsignedLongAtPut\000\001\000", (void*)primUnsignedLongAtPut}, + {(void*)_m, "primUnsignedLongLongAt\000\001\000", (void*)primUnsignedLongLongAt}, + {(void*)_m, "primUnsignedLongLongAtPut\000\001\000", (void*)primUnsignedLongLongAtPut}, + {(void*)_m, "primUnsignedShortAt\000\001\000", (void*)primUnsignedShortAt}, + {(void*)_m, "primUnsignedShortAtPut\000\001\000", (void*)primUnsignedShortAtPut}, + {(void*)_m, "primUnsignedWordAt\000\001\000", (void*)primUnsignedWordAt}, + {(void*)_m, "primUnsignedWordAtPut\000\001\000", (void*)primUnsignedWordAtPut}, + {(void*)_m, "primVarArgsCallOutDoubleReturn\000\000\000", (void*)primVarArgsCallOutDoubleReturn}, + {(void*)_m, "primVarArgsCallOutFloatReturn\000\000\000", (void*)primVarArgsCallOutFloatReturn}, + {(void*)_m, "primVarArgsCallOutIntegralReturn\000\000\000", (void*)primVarArgsCallOutIntegralReturn}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primAddressFieldAccessorDepth = 0; -EXPORT(signed char) primAddressFieldPutAccessorDepth = 0; -EXPORT(signed char) primAlienCopyIntoAccessorDepth = 0; -EXPORT(signed char) primAlienReplaceAccessorDepth = 0; -EXPORT(signed char) primBoxedFreeAccessorDepth = 1; -EXPORT(signed char) primCallOutDoubleReturnAccessorDepth = 0; -EXPORT(signed char) primCallOutFloatReturnAccessorDepth = 0; -EXPORT(signed char) primCallOutIntegralReturnAccessorDepth = 0; -EXPORT(signed char) primCallocAccessorDepth = 0; -EXPORT(signed char) primDoubleAtAccessorDepth = 0; -EXPORT(signed char) primDoubleAtPutAccessorDepth = 0; -EXPORT(signed char) primFloatAtAccessorDepth = 0; -EXPORT(signed char) primFloatAtPutAccessorDepth = 0; -EXPORT(signed char) primFreeAccessorDepth = 0; -EXPORT(signed char) primInLibraryFindSymbolAccessorDepth = 0; -EXPORT(signed char) primLoadLibraryAccessorDepth = 0; -EXPORT(signed char) primMallocAccessorDepth = 0; -EXPORT(signed char) primOopAtAccessorDepth = 0; -EXPORT(signed char) primOopAtPutAccessorDepth = 0; -EXPORT(signed char) primReturnAsFromContextThroughAccessorDepth = 0; +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primAddressFieldMetadata = 0; +EXPORT(signed short) primAddressFieldPutMetadata = 0; +EXPORT(signed short) primAlienCopyIntoMetadata = 0x100; +EXPORT(signed short) primAlienReplaceMetadata = 0x100; +EXPORT(signed short) primBoxedFreeMetadata = 0x100; +EXPORT(signed short) primCallOutDoubleReturnMetadata = 0; +EXPORT(signed short) primCallOutFloatReturnMetadata = 0; +EXPORT(signed short) primCallOutIntegralReturnMetadata = 0; +EXPORT(signed short) primCallocMetadata = 0; +EXPORT(signed short) primDoubleAtMetadata = 0x100; +EXPORT(signed short) primDoubleAtPutMetadata = 0x100; +EXPORT(signed short) primFloatAtMetadata = 0x100; +EXPORT(signed short) primFloatAtPutMetadata = 0x100; +EXPORT(signed short) primFreeMetadata = 0; +EXPORT(signed short) primInLibraryFindSymbolMetadata = 0; +EXPORT(signed short) primLoadLibraryMetadata = 0; +EXPORT(signed short) primMallocMetadata = 0; +EXPORT(signed short) primOopAtMetadata = 0x100; +EXPORT(signed short) primOopAtPutMetadata = 0x100; +EXPORT(signed short) primReturnAsFromContextThroughMetadata = 0; #if OBSOLETE_ALIEN_PRIMITIVES -EXPORT(signed char) primReturnFromContextThroughAccessorDepth = 0; +EXPORT(signed short) primReturnFromContextThroughMetadata = 0; #endif /* OBSOLETE_ALIEN_PRIMITIVES */ -EXPORT(signed char) primSignedByteAtAccessorDepth = 0; -EXPORT(signed char) primSignedByteAtPutAccessorDepth = 0; -EXPORT(signed char) primSignedLongAtAccessorDepth = 0; -EXPORT(signed char) primSignedLongAtPutAccessorDepth = 0; -EXPORT(signed char) primSignedLongLongAtAccessorDepth = 0; -EXPORT(signed char) primSignedLongLongAtPutAccessorDepth = 0; -EXPORT(signed char) primSignedShortAtAccessorDepth = 0; -EXPORT(signed char) primSignedShortAtPutAccessorDepth = 0; -EXPORT(signed char) primSignedWordAtAccessorDepth = 0; -EXPORT(signed char) primSignedWordAtPutAccessorDepth = 0; -EXPORT(signed char) primSizeFieldAccessorDepth = 0; -EXPORT(signed char) primSizeFieldPutAccessorDepth = 0; -EXPORT(signed char) primStrlenFromStartIndexAccessorDepth = 0; -EXPORT(signed char) primStrlenThroughPointerAtIndexAccessorDepth = 0; -EXPORT(signed char) primUnsignedByteAtAccessorDepth = 0; -EXPORT(signed char) primUnsignedByteAtPutAccessorDepth = 0; -EXPORT(signed char) primUnsignedLongAtAccessorDepth = 0; -EXPORT(signed char) primUnsignedLongAtPutAccessorDepth = 0; -EXPORT(signed char) primUnsignedLongLongAtAccessorDepth = 0; -EXPORT(signed char) primUnsignedLongLongAtPutAccessorDepth = 0; -EXPORT(signed char) primUnsignedShortAtAccessorDepth = 0; -EXPORT(signed char) primUnsignedShortAtPutAccessorDepth = 0; -EXPORT(signed char) primUnsignedWordAtAccessorDepth = 0; -EXPORT(signed char) primUnsignedWordAtPutAccessorDepth = 0; -EXPORT(signed char) primVarArgsCallOutDoubleReturnAccessorDepth = 0; -EXPORT(signed char) primVarArgsCallOutFloatReturnAccessorDepth = 0; -EXPORT(signed char) primVarArgsCallOutIntegralReturnAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +EXPORT(signed short) primSignedByteAtMetadata = 0x100; +EXPORT(signed short) primSignedByteAtPutMetadata = 0x100; +EXPORT(signed short) primSignedLongAtMetadata = 0x100; +EXPORT(signed short) primSignedLongAtPutMetadata = 0x100; +EXPORT(signed short) primSignedLongLongAtMetadata = 0x100; +EXPORT(signed short) primSignedLongLongAtPutMetadata = 0x100; +EXPORT(signed short) primSignedShortAtMetadata = 0x100; +EXPORT(signed short) primSignedShortAtPutMetadata = 0x100; +EXPORT(signed short) primSignedWordAtMetadata = 0x100; +EXPORT(signed short) primSignedWordAtPutMetadata = 0x100; +EXPORT(signed short) primSizeFieldMetadata = 0; +EXPORT(signed short) primSizeFieldPutMetadata = 0; +EXPORT(signed short) primStrlenFromStartIndexMetadata = 0x100; +EXPORT(signed short) primStrlenThroughPointerAtIndexMetadata = 0x100; +EXPORT(signed short) primUnsignedByteAtMetadata = 0x100; +EXPORT(signed short) primUnsignedByteAtPutMetadata = 0x100; +EXPORT(signed short) primUnsignedLongAtMetadata = 0x100; +EXPORT(signed short) primUnsignedLongAtPutMetadata = 0x100; +EXPORT(signed short) primUnsignedLongLongAtMetadata = 0x100; +EXPORT(signed short) primUnsignedLongLongAtPutMetadata = 0x100; +EXPORT(signed short) primUnsignedShortAtMetadata = 0x100; +EXPORT(signed short) primUnsignedShortAtPutMetadata = 0x100; +EXPORT(signed short) primUnsignedWordAtMetadata = 0x100; +EXPORT(signed short) primUnsignedWordAtPutMetadata = 0x100; +EXPORT(signed short) primVarArgsCallOutDoubleReturnMetadata = 0; +EXPORT(signed short) primVarArgsCallOutFloatReturnMetadata = 0; +EXPORT(signed short) primVarArgsCallOutIntegralReturnMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/ImmX11Plugin/ImmX11Plugin.c b/src/plugins/ImmX11Plugin/ImmX11Plugin.c index 082bdae615..134a35dbf8 100644 --- a/src/plugins/ImmX11Plugin/ImmX11Plugin.c +++ b/src/plugins/ImmX11Plugin/ImmX11Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - ImmX11Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + ImmX11Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "ImmX11Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "ImmX11Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -121,7 +121,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ImmX11Plugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "ImmX11Plugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -261,13 +261,9 @@ primSetCompositionFocus(void) sqInt _return_value; if (!(isBooleanObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aBoolean = booleanValueOf(stackValue(0)); - if (failed()) { - return null; - } ret = setCompositionFocus(aBoolean); if (ret == 0) { primitiveFail(); @@ -293,14 +289,10 @@ primSetCompositionWindowPosition(void) if (!((isIntegerObject((x = stackValue(1)))) && (isIntegerObject((y = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } x = integerValueOf(x); y = integerValueOf(y); - if (failed()) { - return null; - } ret = setCompositionWindowPosition(x, y); if (ret == 0) { primitiveFail(); @@ -444,13 +436,9 @@ primSetTextEncUTF8(void) sqInt _return_value; if (!(isBooleanObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aBoolean = booleanValueOf(stackValue(0)); - if (failed()) { - return null; - } textEncodingUTF8 = aBoolean; if (!(failed())) { _return_value = ((aBoolean) ? trueObject() : falseObject()); @@ -562,32 +550,34 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "ImmX11Plugin"; void* ImmX11Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primGetEncoding\000\377", (void*)primGetEncoding}, - {(void*)_m, "primGetLocale\000\377", (void*)primGetLocale}, - {(void*)_m, "primGetLocaleEncoding\000\377", (void*)primGetLocaleEncoding}, - {(void*)_m, "primGetPathEnc\000\377", (void*)primGetPathEnc}, - {(void*)_m, "primGetTextEnc\000\377", (void*)primGetTextEnc}, - {(void*)_m, "primGetXWinEnc\000\377", (void*)primGetXWinEnc}, - {(void*)_m, "primIsTextEncUTF8\000\377", (void*)primIsTextEncUTF8}, - {(void*)_m, "primSetCompositionFocus\000\377", (void*)primSetCompositionFocus}, - {(void*)_m, "primSetCompositionWindowPosition\000\000", (void*)primSetCompositionWindowPosition}, - {(void*)_m, "primSetEncodingToLocale\000\377", (void*)primSetEncodingToLocale}, - {(void*)_m, "primSetEncoding", (void*)primSetEncoding}, - {(void*)_m, "primSetLocaleEncoding", (void*)primSetLocaleEncoding}, - {(void*)_m, "primSetLocale", (void*)primSetLocale}, - {(void*)_m, "primSetPathEncToLocale\000\377", (void*)primSetPathEncToLocale}, - {(void*)_m, "primSetPathEnc", (void*)primSetPathEnc}, - {(void*)_m, "primSetTextEncToLocale\000\377", (void*)primSetTextEncToLocale}, - {(void*)_m, "primSetTextEncUTF8\000\377", (void*)primSetTextEncUTF8}, - {(void*)_m, "primSetTextEnc", (void*)primSetTextEnc}, - {(void*)_m, "primSetXWinEncToLocale\000\377", (void*)primSetXWinEncToLocale}, - {(void*)_m, "primSetXWinEnc", (void*)primSetXWinEnc}, + {(void*)_m, "primGetEncoding\000\377\000", (void*)primGetEncoding}, + {(void*)_m, "primGetLocale\000\377\000", (void*)primGetLocale}, + {(void*)_m, "primGetLocaleEncoding\000\377\000", (void*)primGetLocaleEncoding}, + {(void*)_m, "primGetPathEnc\000\377\000", (void*)primGetPathEnc}, + {(void*)_m, "primGetTextEnc\000\377\000", (void*)primGetTextEnc}, + {(void*)_m, "primGetXWinEnc\000\377\000", (void*)primGetXWinEnc}, + {(void*)_m, "primIsTextEncUTF8\000\377\000", (void*)primIsTextEncUTF8}, + {(void*)_m, "primSetCompositionFocus\000\377\000", (void*)primSetCompositionFocus}, + {(void*)_m, "primSetCompositionWindowPosition\000\000\000", (void*)primSetCompositionWindowPosition}, + {(void*)_m, "primSetEncodingToLocale\000\377\000", (void*)primSetEncodingToLocale}, + {(void*)_m, "primSetEncoding\000\377\000", (void*)primSetEncoding}, + {(void*)_m, "primSetLocaleEncoding\000\377\000", (void*)primSetLocaleEncoding}, + {(void*)_m, "primSetLocale\000\377\000", (void*)primSetLocale}, + {(void*)_m, "primSetPathEncToLocale\000\377\000", (void*)primSetPathEncToLocale}, + {(void*)_m, "primSetPathEnc\000\377\000", (void*)primSetPathEnc}, + {(void*)_m, "primSetTextEncToLocale\000\377\000", (void*)primSetTextEncToLocale}, + {(void*)_m, "primSetTextEncUTF8\000\377\000", (void*)primSetTextEncUTF8}, + {(void*)_m, "primSetTextEnc\000\377\000", (void*)primSetTextEnc}, + {(void*)_m, "primSetXWinEncToLocale\000\377\000", (void*)primSetXWinEncToLocale}, + {(void*)_m, "primSetXWinEnc\000\377\000", (void*)primSetXWinEnc}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primSetCompositionWindowPositionAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primSetCompositionWindowPositionMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/InternetConfigPlugin/InternetConfigPlugin.c b/src/plugins/InternetConfigPlugin/InternetConfigPlugin.c index bc04c7ca2c..afba08e8c5 100644 --- a/src/plugins/InternetConfigPlugin/InternetConfigPlugin.c +++ b/src/plugins/InternetConfigPlugin/InternetConfigPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - InternetConfigPlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + InternetConfigPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "InternetConfigPlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 " __DATE__ ; +static char __buildInfo[] = "InternetConfigPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -72,7 +72,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "InternetConfigPlugin VMMaker.oscog-eem.2944 " INT_EXT; +static const char *moduleName = "InternetConfigPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -107,13 +107,9 @@ primitiveGetMacintoshFileTypeAndCreatorFrom(void) char *ptr; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aFileName = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } keyLength = byteSizeOf(((sqInt)(sqIntptr_t)(aFileName) - BaseHeaderSize)); sqInternetGetMacintoshFileTypeAndCreatorFromkeySizeinto(aFileName, keyLength, creator); oop = instantiateClassindexableSize(classString(), 8); @@ -140,13 +136,9 @@ primitiveGetStringKeyedBy(void) sqInt size; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aKey = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } keyLength = byteSizeOf(((sqInt)(sqIntptr_t)(aKey) - BaseHeaderSize)); size = sqInternetConfigurationGetStringKeyedBykeySizeinto(aKey, keyLength, aString); oop = instantiateClassindexableSize(classString(), size); @@ -206,14 +198,16 @@ static char _m[] = "InternetConfigPlugin"; void* InternetConfigPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveGetMacintoshFileTypeAndCreatorFrom\000\377", (void*)primitiveGetMacintoshFileTypeAndCreatorFrom}, - {(void*)_m, "primitiveGetStringKeyedBy\000\377", (void*)primitiveGetStringKeyedBy}, + {(void*)_m, "primitiveGetMacintoshFileTypeAndCreatorFrom\000\377\000", (void*)primitiveGetMacintoshFileTypeAndCreatorFrom}, + {(void*)_m, "primitiveGetStringKeyedBy\000\377\000", (void*)primitiveGetStringKeyedBy}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN +#if SPURVM +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/JPEGReadWriter2Plugin/JPEGReadWriter2Plugin.c b/src/plugins/JPEGReadWriter2Plugin/JPEGReadWriter2Plugin.c index 163ad026fa..03839bb0d7 100644 --- a/src/plugins/JPEGReadWriter2Plugin/JPEGReadWriter2Plugin.c +++ b/src/plugins/JPEGReadWriter2Plugin/JPEGReadWriter2Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - JPEGReadWriter2Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + JPEGReadWriter2Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "JPEGReadWriter2Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "JPEGReadWriter2Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -121,7 +121,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "JPEGReadWriter2Plugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "JPEGReadWriter2Plugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -145,13 +145,9 @@ primImageHeight(void) sqInt _return_value; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aJPEGDecompressStruct = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!((byteSizeOf(((sqInt)(sqIntptr_t)(aJPEGDecompressStruct) - BaseHeaderSize))) >= (sizeof(struct jpeg_decompress_struct)))) { return primitiveFail(); } @@ -172,13 +168,9 @@ primImageNumComponents(void) sqInt _return_value; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aJPEGDecompressStruct = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!((byteSizeOf(((sqInt)(sqIntptr_t)(aJPEGDecompressStruct) - BaseHeaderSize))) >= (sizeof(struct jpeg_decompress_struct)))) { return primitiveFail(); } @@ -199,13 +191,9 @@ primImageWidth(void) sqInt _return_value; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aJPEGDecompressStruct = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!((byteSizeOf(((sqInt)(sqIntptr_t)(aJPEGDecompressStruct) - BaseHeaderSize))) >= (sizeof(struct jpeg_decompress_struct)))) { return primitiveFail(); } @@ -282,15 +270,11 @@ primJPEGReadHeaderfromByteArrayerrorMgr(void) if (!((isBytes(stackValue(2))) && ((isBytes(stackValue(1))) && (isBytes(stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aJPEGDecompressStruct = ((char *) (firstIndexableField(stackValue(2)))); source = ((char *) (firstIndexableField(stackValue(1)))); aJPEGErrorMgr2Struct = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!(((byteSizeOf(((sqInt)(sqIntptr_t)(aJPEGDecompressStruct) - BaseHeaderSize))) >= (sizeof(struct jpeg_decompress_struct))) && ((byteSizeOf(((sqInt)(sqIntptr_t)(aJPEGErrorMgr2Struct) - BaseHeaderSize))) >= (sizeof(struct error_mgr2))))) { return primitiveFail(); @@ -333,17 +317,13 @@ primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgr(void) && ((isKindOf(stackValue(2), "Form")) && ((isBooleanObject(stackValue(1))) && (isBytes(stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aJPEGDecompressStruct = ((char *) (firstIndexableField(stackValue(4)))); source = ((char *) (firstIndexableField(stackValue(3)))); form = stackValue(2); ditherFlag = booleanValueOf(stackValue(1)); aJPEGErrorMgr2Struct = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } formBitmapOOP = fetchPointerofObject(0, form); formNativeDepth = fetchIntegerofObject(3, form); formWidth = fetchIntegerofObject(1, form); @@ -414,8 +394,7 @@ primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr(void) && ((isIntegerObject((quality = stackValue(2)))) && ((isBooleanObject(stackValue(1))) && (isBytes(stackValue(0))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aJPEGCompressStruct = ((char *) (firstIndexableField(stackValue(5)))); destination = ((char *) (firstIndexableField(stackValue(4)))); @@ -423,9 +402,6 @@ primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr(void) quality = integerValueOf(quality); progressiveFlag = booleanValueOf(stackValue(1)); aJPEGErrorMgr2Struct = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } formBitmapOOP = fetchPointerofObject(0, form); formWidth = fetchIntegerofObject(1, form); formHeight = fetchIntegerofObject(2, form); @@ -542,24 +518,26 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "JPEGReadWriter2Plugin"; void* JPEGReadWriter2Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primImageHeight\000\377", (void*)primImageHeight}, - {(void*)_m, "primImageNumComponents\000\377", (void*)primImageNumComponents}, - {(void*)_m, "primImageWidth\000\377", (void*)primImageWidth}, - {(void*)_m, "primJPEGCompressStructSize\000\377", (void*)primJPEGCompressStructSize}, - {(void*)_m, "primJPEGDecompressStructSize\000\377", (void*)primJPEGDecompressStructSize}, - {(void*)_m, "primJPEGErrorMgr2StructSize\000\377", (void*)primJPEGErrorMgr2StructSize}, - {(void*)_m, "primJPEGPluginIsPresent\000\377", (void*)primJPEGPluginIsPresent}, - {(void*)_m, "primJPEGReadHeaderfromByteArrayerrorMgr\000\377", (void*)primJPEGReadHeaderfromByteArrayerrorMgr}, - {(void*)_m, "primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgr\000\002", (void*)primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgr}, - {(void*)_m, "primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr\000\002", (void*)primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr}, - {(void*)_m, "primSupports8BitGrayscaleJPEGs\000\377", (void*)primSupports8BitGrayscaleJPEGs}, + {(void*)_m, "primImageHeight\000\377\000", (void*)primImageHeight}, + {(void*)_m, "primImageNumComponents\000\377\000", (void*)primImageNumComponents}, + {(void*)_m, "primImageWidth\000\377\000", (void*)primImageWidth}, + {(void*)_m, "primJPEGCompressStructSize\000\377\000", (void*)primJPEGCompressStructSize}, + {(void*)_m, "primJPEGDecompressStructSize\000\377\000", (void*)primJPEGDecompressStructSize}, + {(void*)_m, "primJPEGErrorMgr2StructSize\000\377\000", (void*)primJPEGErrorMgr2StructSize}, + {(void*)_m, "primJPEGPluginIsPresent\000\377\000", (void*)primJPEGPluginIsPresent}, + {(void*)_m, "primJPEGReadHeaderfromByteArrayerrorMgr\000\377\000", (void*)primJPEGReadHeaderfromByteArrayerrorMgr}, + {(void*)_m, "primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgr\000\002\000", (void*)primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgr}, + {(void*)_m, "primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr\000\002\000", (void*)primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgr}, + {(void*)_m, "primSupports8BitGrayscaleJPEGs\000\377\000", (void*)primSupports8BitGrayscaleJPEGs}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgrAccessorDepth = 2; -EXPORT(signed char) primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgrAccessorDepth = 2; +#if SPURVM +EXPORT(signed short) primJPEGReadImagefromByteArrayonFormdoDitheringerrorMgrMetadata = 0x200; +EXPORT(signed short) primJPEGWriteImageonByteArrayformqualityprogressiveJPEGerrorMgrMetadata = 0x200; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c b/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c index 85ae283ea5..4c452bc0b2 100644 --- a/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c +++ b/src/plugins/JPEGReaderPlugin/JPEGReaderPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - JPEGReaderPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + JPEGReaderPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -168,7 +168,7 @@ static sqInt jsBitCount; static unsigned char *jsCollection; static sqInt jsPosition; static sqInt jsReadLimit; -static const char *moduleName = "JPEGReaderPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "JPEGReaderPlugin VMMaker.oscog-eem.3024 " INT_EXT; static int *residuals; static int *yBlocks[128]; static int yComponent[11]; @@ -1803,19 +1803,21 @@ yColorComponentFrom(sqInt oop) static char _m[] = "JPEGReaderPlugin"; void* JPEGReaderPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveColorConvertGrayscaleMCU\000\002", (void*)primitiveColorConvertGrayscaleMCU}, - {(void*)_m, "primitiveColorConvertMCU\000\003", (void*)primitiveColorConvertMCU}, - {(void*)_m, "primitiveDecodeMCU\000\002", (void*)primitiveDecodeMCU}, - {(void*)_m, "primitiveIdctInt\000\001", (void*)primitiveIdctInt}, + {(void*)_m, "primitiveColorConvertGrayscaleMCU\000\002\000", (void*)primitiveColorConvertGrayscaleMCU}, + {(void*)_m, "primitiveColorConvertMCU\000\003\000", (void*)primitiveColorConvertMCU}, + {(void*)_m, "primitiveDecodeMCU\000\003\000", (void*)primitiveDecodeMCU}, + {(void*)_m, "primitiveIdctInt\000\001\000", (void*)primitiveIdctInt}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveColorConvertGrayscaleMCUAccessorDepth = 2; -EXPORT(signed char) primitiveColorConvertMCUAccessorDepth = 3; -EXPORT(signed char) primitiveDecodeMCUAccessorDepth = 2; -EXPORT(signed char) primitiveIdctIntAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveColorConvertGrayscaleMCUMetadata = 0x200; +EXPORT(signed short) primitiveColorConvertMCUMetadata = 0x300; +EXPORT(signed short) primitiveDecodeMCUMetadata = 0x300; +EXPORT(signed short) primitiveIdctIntMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/JoystickTabletPlugin/JoystickTabletPlugin.c b/src/plugins/JoystickTabletPlugin/JoystickTabletPlugin.c index b828c82df7..3656d71cd5 100644 --- a/src/plugins/JoystickTabletPlugin/JoystickTabletPlugin.c +++ b/src/plugins/JoystickTabletPlugin/JoystickTabletPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - JoystickTabletPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + JoystickTabletPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "JoystickTabletPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "JoystickTabletPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -85,7 +85,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "JoystickTabletPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "JoystickTabletPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -124,13 +124,9 @@ primitiveGetTabletParameters(void) sqInt resultSize; if (!(isIntegerObject((cursorIndex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } cursorIndex = integerValueOf(cursorIndex); - if (failed()) { - return null; - } resultSize = tabletResultSize(); result = instantiateClassindexableSize(classBitmap(), resultSize); resultPtr = ((int *)firstIndexableField(result)); @@ -151,13 +147,9 @@ primitiveReadJoystick(void) sqInt index; if (!(isIntegerObject((index = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } index = integerValueOf(index); - if (failed()) { - return null; - } if (!(failed())) { methodReturnValue(positive32BitIntegerFor((joystickRead(index)))); } @@ -181,13 +173,9 @@ primitiveReadTablet(void) sqInt resultSize; if (!(isIntegerObject((cursorIndex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } cursorIndex = integerValueOf(cursorIndex); - if (failed()) { - return null; - } resultSize = tabletResultSize(); result = instantiateClassindexableSize(classBitmap(), resultSize); resultPtr = ((int *)firstIndexableField(result)); @@ -250,18 +238,20 @@ static char _m[] = "JoystickTabletPlugin"; void* JoystickTabletPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveGetTabletParameters\000\000", (void*)primitiveGetTabletParameters}, - {(void*)_m, "primitiveReadJoystick\000\000", (void*)primitiveReadJoystick}, - {(void*)_m, "primitiveReadTablet\000\000", (void*)primitiveReadTablet}, + {(void*)_m, "primitiveGetTabletParameters\000\000\000", (void*)primitiveGetTabletParameters}, + {(void*)_m, "primitiveReadJoystick\000\000\000", (void*)primitiveReadJoystick}, + {(void*)_m, "primitiveReadTablet\000\000\000", (void*)primitiveReadTablet}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveGetTabletParametersAccessorDepth = 0; -EXPORT(signed char) primitiveReadJoystickAccessorDepth = 0; -EXPORT(signed char) primitiveReadTabletAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveGetTabletParametersMetadata = 0; +EXPORT(signed short) primitiveReadJoystickMetadata = 0; +EXPORT(signed short) primitiveReadTabletMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/Klatt/Klatt.c b/src/plugins/Klatt/Klatt.c index 4afc0715b2..3ee5f262d0 100644 --- a/src/plugins/Klatt/Klatt.c +++ b/src/plugins/Klatt/Klatt.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - KlattSynthesizerPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + KlattSynthesizerPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "KlattSynthesizerPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "KlattSynthesizerPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -201,7 +201,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "Klatt VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "Klatt VMMaker.oscog-eem.3024 " INT_EXT; static sqInt nmod; static sqInt nopen; static sqInt nper; @@ -3148,13 +3148,15 @@ zeroQphicosphisinphirphid(float phi, float cosphi, float sinphi, float rphid) static char _m[] = "Klatt"; void* Klatt_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveSynthesizeFrameIntoStartingAt\000\001", (void*)primitiveSynthesizeFrameIntoStartingAt}, + {(void*)_m, "primitiveSynthesizeFrameIntoStartingAt\000\001\000", (void*)primitiveSynthesizeFrameIntoStartingAt}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveSynthesizeFrameIntoStartingAtAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveSynthesizeFrameIntoStartingAtMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/LargeIntegers/LargeIntegers.c b/src/plugins/LargeIntegers/LargeIntegers.c index 67a75feda7..181c88a56d 100644 --- a/src/plugins/LargeIntegers/LargeIntegers.c +++ b/src/plugins/LargeIntegers/LargeIntegers.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - LargeIntegersPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + LargeIntegersPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -130,6 +130,7 @@ extern sqInt classIndexOf(sqInt); #if !defined(SQUEAK_BUILTIN_PLUGIN) static sqInt (*booleanValueOf)(sqInt obj); +static sqInt (*byteSizeOf)(sqInt oop); static sqInt (*classArray)(void); static sqInt (*classLargeNegativeInteger)(void); static sqInt (*classLargePositiveInteger)(void); @@ -155,13 +156,12 @@ static usqInt (*positive32BitValueOf)(sqInt oop); static sqInt (*primitiveFail)(void); static sqInt (*primitiveFailFor)(sqInt reasonCode); static sqInt (*pushRemappableOop)(sqInt oop); -static sqInt (*slotSizeOf)(sqInt oop); static sqInt (*stObjectatput)(sqInt array, sqInt index, sqInt value); static sqInt (*stackValue)(sqInt offset); -static sqInt (*success)(sqInt aBoolean); static sqInt (*trueObject)(void); #else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ extern sqInt booleanValueOf(sqInt obj); +extern sqInt byteSizeOf(sqInt oop); extern sqInt classArray(void); extern sqInt classLargeNegativeInteger(void); extern sqInt classLargePositiveInteger(void); @@ -191,15 +191,13 @@ extern usqInt positive32BitValueOf(sqInt oop); extern sqInt primitiveFail(void); extern sqInt primitiveFailFor(sqInt reasonCode); extern sqInt pushRemappableOop(sqInt oop); -extern sqInt slotSizeOf(sqInt oop); extern sqInt stObjectatput(sqInt array, sqInt index, sqInt value); extern sqInt stackValue(sqInt offset); -extern sqInt success(sqInt aBoolean); extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "LargeIntegers v2.0 VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "LargeIntegers v2.0 VMMaker.oscog-eem.3024 " INT_EXT; static const int andOpIndex = 0; static const int orOpIndex = 1; static const int xorOpIndex = 2; @@ -225,7 +223,7 @@ anyBitOfLargeIntfromto(sqInt anOop, sqInt start, sqInt stopArg) sqInt zeroBasedDigitIndex; magnitude = anOop; - stop = ((stopArg < (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((slotSizeOf(magnitude)) + 3) / 4))) ? stopArg : (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((slotSizeOf(magnitude)) + 3) / 4))); + stop = ((stopArg < (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((byteSizeOf(magnitude)) + 3) / 4))) ? stopArg : (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((byteSizeOf(magnitude)) + 3) / 4))); if (start > stop) { return 0; } @@ -1006,8 +1004,8 @@ digitAddLargewith(sqInt firstInteger, sqInt secondInteger) sqInt shortInt; sqInt sum; - firstDigitLen = ((slotSizeOf(firstInteger)) + 3) / 4; - secondDigitLen = ((slotSizeOf(secondInteger)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstInteger)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondInteger)) + 3) / 4; neg = isLargeNegativeIntegerObject(firstInteger); if (firstDigitLen <= secondDigitLen) { shortInt = firstInteger; @@ -1156,10 +1154,8 @@ digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, sqInt opIx) } secondLarge = secondInteger; } - /* begin byteSizeOfLargeInt: */ - firstLen = slotSizeOf(firstLarge); - /* begin byteSizeOfLargeInt: */ - secondLen = slotSizeOf(secondLarge); + firstLen = byteSizeOf(firstLarge); + secondLen = byteSizeOf(secondLarge); if (firstLen < secondLen) { shortLen = firstLen; shortLarge = firstLarge; @@ -1198,7 +1194,7 @@ digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, sqInt opIx) for (i = ((shortLen + 3) / 4); i <= limit; i += 1) { pWordRes[i] = 0; } - goto l3; + goto l1; } if (opIx == orOpIndex) { for (i = 0; i <= limit; i += 1) { @@ -1208,7 +1204,7 @@ digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, sqInt opIx) for (i = ((shortLen + 3) / 4); i <= limit; i += 1) { pWordRes[i] = (pWordLong[i]); } - goto l3; + goto l1; } if (opIx == xorOpIndex) { for (i = 0; i <= limit; i += 1) { @@ -1218,10 +1214,10 @@ digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, sqInt opIx) for (i = ((shortLen + 3) / 4); i <= limit; i += 1) { pWordRes[i] = (pWordLong[i]); } - goto l3; + goto l1; } primitiveFail(); - l3: /* end cDigitOp:short:len:long:len:into: */; + l1: /* end cDigitOp:short:len:long:len:into: */; if (failed()) { return 0; } @@ -1239,8 +1235,8 @@ digitCompareLargewith(sqInt firstInteger, sqInt secondInteger) sqInt firstDigitLen; sqInt secondDigitLen; - firstDigitLen = ((slotSizeOf(firstInteger)) + 3) / 4; - secondDigitLen = ((slotSizeOf(secondInteger)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstInteger)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondInteger)) + 3) / 4; if (secondDigitLen != firstDigitLen) { if (secondDigitLen > firstDigitLen) { return integerObjectOf(-1); @@ -1293,8 +1289,8 @@ digitDivLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt neg) sqInt secondDigitLen; unsigned long long t; - firstDigitLen = ((slotSizeOf(firstInteger)) + 3) / 4; - secondDigitLen = ((slotSizeOf(secondInteger)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstInteger)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondInteger)) + 3) / 4; quoDigitLen = (firstDigitLen - secondDigitLen) + 1; if (quoDigitLen <= 0) { @@ -1316,7 +1312,7 @@ digitDivLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt neg) #if SPURVM div = digitLshift(secondInteger, d); if (!(div == null)) { - div = largeIntgrowTo(div, ((((slotSizeOf(div)) + 3) / 4) + 1) * 4); + div = largeIntgrowTo(div, ((((byteSizeOf(div)) + 3) / 4) + 1) * 4); } if (!div) { return div; @@ -1325,7 +1321,7 @@ digitDivLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt neg) pushRemappableOop(firstInteger); div = digitLshift(secondInteger, d); if (!(div == null)) { - div = largeIntgrowTo(div, ((((slotSizeOf(div)) + 3) / 4) + 1) * 4); + div = largeIntgrowTo(div, ((((byteSizeOf(div)) + 3) / 4) + 1) * 4); } if (!div) { return div; @@ -1336,7 +1332,7 @@ digitDivLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt neg) #if SPURVM rem = digitLshift(firstInteger, d); if (!(rem == null)) { - if ((((slotSizeOf(rem)) + 3) / 4) == firstDigitLen) { + if ((((byteSizeOf(rem)) + 3) / 4) == firstDigitLen) { rem = largeIntgrowTo(rem, (firstDigitLen + 1) * 4); } } @@ -1347,7 +1343,7 @@ digitDivLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt neg) pushRemappableOop(div); rem = digitLshift(firstInteger, d); if (!(rem == null)) { - if ((((slotSizeOf(rem)) + 3) / 4) == firstDigitLen) { + if ((((byteSizeOf(rem)) + 3) / 4) == firstDigitLen) { rem = largeIntgrowTo(rem, (firstDigitLen + 1) * 4); } } @@ -1382,11 +1378,11 @@ digitDivLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt neg) #endif /* SPURVM */ /* begin cDigitDiv:len:rem:len:quo:len: */ pDiv = ((unsigned int *) (firstIndexableField(div))); - divLen = ((slotSizeOf(div)) + 3) / 4; + divLen = ((byteSizeOf(div)) + 3) / 4; pRem = ((unsigned int *) (firstIndexableField(rem))); - remLen = ((slotSizeOf(rem)) + 3) / 4; + remLen = ((byteSizeOf(rem)) + 3) / 4; pQuo = ((unsigned int *) (firstIndexableField(quo))); - quoLen = ((slotSizeOf(quo)) + 3) / 4; + quoLen = ((byteSizeOf(quo)) + 3) / 4; /* Last actual byte of data (ST ix) */ dl = divLen - 1; @@ -1489,10 +1485,10 @@ digitDivLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt neg) } #if SPURVM - rem = digitRshiftlookfirst(rem, d, (((slotSizeOf(div)) + 3) / 4) - 1); + rem = digitRshiftlookfirst(rem, d, (((byteSizeOf(div)) + 3) / 4) - 1); #else /* SPURVM */ pushRemappableOop(quo); - rem = digitRshiftlookfirst(rem, d, (((slotSizeOf(div)) + 3) / 4) - 1); + rem = digitRshiftlookfirst(rem, d, (((byteSizeOf(div)) + 3) / 4) - 1); quo = popRemappableOop(); #endif /* SPURVM */ @@ -1535,9 +1531,9 @@ digitMontgomerytimesmodulomInvModB(sqInt firstLarge, sqInt secondLarge, sqInt th sqInt thirdLen; unsigned long long u; - firstLen = ((slotSizeOf(firstLarge)) + 3) / 4; - secondLen = ((slotSizeOf(secondLarge)) + 3) / 4; - thirdLen = ((slotSizeOf(thirdLarge)) + 3) / 4; + firstLen = ((byteSizeOf(firstLarge)) + 3) / 4; + secondLen = ((byteSizeOf(secondLarge)) + 3) / 4; + thirdLen = ((byteSizeOf(thirdLarge)) + 3) / 4; if (!((firstLen <= thirdLen) && (secondLen <= thirdLen))) { return primitiveFail(); @@ -1646,10 +1642,8 @@ digitMultiplyLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt ne sqInt shortInt; sqInt shortLen; - /* begin byteSizeOfLargeInt: */ - firstLen = slotSizeOf(firstInteger); - /* begin byteSizeOfLargeInt: */ - secondLen = slotSizeOf(secondInteger); + firstLen = byteSizeOf(firstInteger); + secondLen = byteSizeOf(secondInteger); if (firstLen <= secondLen) { shortInt = firstInteger; shortLen = firstLen; @@ -1687,11 +1681,11 @@ digitMultiplyLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt ne pWordRes = ((unsigned int *) (firstIndexableField(prod))); if ((((shortLen + 3) / 4) == 1) && ((pWordShort[0]) == 0)) { - goto l4; + goto l2; } if ((((longLen + 3) / 4) == 1) && ((pWordLong[0]) == 0)) { - goto l4; + goto l2; } limitShort = ((shortLen + 3) / 4) - 1; limitLong = ((longLen + 3) / 4) - 1; @@ -1714,7 +1708,7 @@ digitMultiplyLargewithnegative(sqInt firstInteger, sqInt secondInteger, sqInt ne } } } - l4: /* end cDigitMultiply:len:with:len:into:len: */; + l2: /* end cDigitMultiply:len:with:len:into:len: */; return (neg ? normalizeNegative(prod) : normalizePositive(prod)); @@ -1742,7 +1736,7 @@ digitOfLargeIntat(sqInt aBytesOop, sqInt ix) { unsigned int *cPointer; - if (ix > (((slotSizeOf(aBytesOop)) + 3) / 4)) { + if (ix > (((byteSizeOf(aBytesOop)) + 3) / 4)) { return 0; } else { @@ -1776,7 +1770,7 @@ digitSizeOfCSI(sqInt csi) static sqInt digitSizeOfLargeInt(sqInt anOop) { - return ((slotSizeOf(anOop)) + 3) / 4; + return ((byteSizeOf(anOop)) + 3) / 4; } @@ -1804,9 +1798,9 @@ digitSubLargewith(sqInt firstInteger, sqInt secondInteger) firstNeg = isLargeNegativeIntegerObject(firstInteger); /* begin digitSizeOfLargeInt: */ - firstDigitLen = ((slotSizeOf(firstInteger)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstInteger)) + 3) / 4; /* begin digitSizeOfLargeInt: */ - secondDigitLen = ((slotSizeOf(secondInteger)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondInteger)) + 3) / 4; if (firstDigitLen == secondDigitLen) { while ((firstDigitLen > 1) && ((cDigitOfat(((unsigned int *) (firstIndexableField(firstInteger))), firstDigitLen - 1)) == (cDigitOfat(((unsigned int *) (firstIndexableField(secondInteger))), firstDigitLen - 1)))) { @@ -1899,7 +1893,7 @@ digitLshift(sqInt anOop, sqInt shiftCount) sqInt rshift; /* begin digitSizeOfLargeInt: */ - oldDigitLen = ((slotSizeOf(anOop)) + 3) / 4; + oldDigitLen = ((byteSizeOf(anOop)) + 3) / 4; if (((highBit = cDigitHighBitlen(((unsigned int *) (firstIndexableField(anOop))), oldDigitLen))) == 0) { return instantiateClassindexableSize(fetchClassOf(anOop), 1); } @@ -2075,7 +2069,7 @@ highBitOfLargeInt(sqInt anOop) /* begin cDigitHighBit:len: */ pUint32 = ((unsigned int *) (firstIndexableField(anOop))); - len = ((slotSizeOf(anOop)) + 3) / 4; + len = ((byteSizeOf(anOop)) + 3) / 4; realLength = len; do { if (realLength == 0) { @@ -2094,8 +2088,7 @@ isNormalized(sqInt aLargeInteger) { sqInt len; - /* begin byteSizeOfLargeInt: */ - len = slotSizeOf(aLargeInteger); + len = byteSizeOf(aLargeInteger); if (len == 0) { return 0; } @@ -2141,7 +2134,7 @@ largeIntgrowTo(sqInt aBytesObject, sqInt newByteLen) #endif /* SPURVM */ newDigitLen = (newByteLen + 3) / 4; /* begin digitSizeOfLargeInt: */ - oldDigitLen = ((slotSizeOf(aBytesObject)) + 3) / 4; + oldDigitLen = ((byteSizeOf(aBytesObject)) + 3) / 4; copyLen = (oldDigitLen < newDigitLen ? oldDigitLen : newDigitLen); @@ -2180,7 +2173,7 @@ normalizeNegative(sqInt aLargeNegativeInteger) usqInt val2; /* begin digitSizeOfLargeInt: */ - digitLen = ((slotSizeOf(aLargeNegativeInteger)) + 3) / 4; + digitLen = ((byteSizeOf(aLargeNegativeInteger)) + 3) / 4; while ((digitLen != 0) && ((cDigitOfat(((unsigned int *) (firstIndexableField(aLargeNegativeInteger))), digitLen - 1)) == 0)) { digitLen -= 1; @@ -2216,8 +2209,7 @@ normalizeNegative(sqInt aLargeNegativeInteger) if (val <= 0xFF) { byteLen -= 1; } - /* begin byteSizeOfLargeInt: */ - oldByteLen = slotSizeOf(aLargeNegativeInteger); + oldByteLen = byteSizeOf(aLargeNegativeInteger); if (byteLen < oldByteLen) { return largeIntgrowTo(aLargeNegativeInteger, byteLen); } @@ -2244,7 +2236,7 @@ normalizePositive(sqInt aLargePositiveInteger) usqInt val2; /* begin digitSizeOfLargeInt: */ - digitLen = ((slotSizeOf(aLargePositiveInteger)) + 3) / 4; + digitLen = ((byteSizeOf(aLargePositiveInteger)) + 3) / 4; while ((digitLen != 0) && ((cDigitOfat(((unsigned int *) (firstIndexableField(aLargePositiveInteger))), digitLen - 1)) == 0)) { digitLen -= 1; @@ -2283,8 +2275,7 @@ normalizePositive(sqInt aLargePositiveInteger) if (val <= 0xFF) { byteLen -= 1; } - /* begin byteSizeOfLargeInt: */ - oldByteLen = slotSizeOf(aLargePositiveInteger); + oldByteLen = byteSizeOf(aLargePositiveInteger); if (byteLen < oldByteLen) { return largeIntgrowTo(aLargePositiveInteger, byteLen); } @@ -2332,15 +2323,13 @@ primAnyBitFromTo(void) if (!((isIntegerObject((from = stackValue(1)))) && (isIntegerObject((to = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } from = integerValueOf(from); to = integerValueOf(to); - success(isKindOfInteger(stackValue(2))); integer = stackValue(2); - if (failed()) { - return null; + if (!(isKindOfInteger(integer))) { + return primitiveFailFor(PrimErrBadArgument); } if ((from < 1) || (to < 1)) { return primitiveFail(); @@ -2365,7 +2354,7 @@ primAnyBitFromTo(void) else { /* begin anyBitOfLargeInt:from:to: */ magnitude = integer; - stop = ((to < (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((slotSizeOf(magnitude)) + 3) / 4))) ? to : (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((slotSizeOf(magnitude)) + 3) / 4))); + stop = ((to < (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((byteSizeOf(magnitude)) + 3) / 4))) ? to : (cDigitHighBitlen(((unsigned int *) (firstIndexableField(magnitude))), ((byteSizeOf(magnitude)) + 3) / 4))); if (from > stop) { someBitIsSet = 0; goto l2; @@ -2438,14 +2427,12 @@ primDigitAdd(void) sqInt _return_value; if (!(isKindOfInteger(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(0); - success(isKindOfInteger(stackValue(1))); firstInteger = stackValue(1); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (isIntegerObject(firstInteger)) { @@ -2479,8 +2466,8 @@ primDigitAdd(void) } if (!(failed())) { /* begin digitAddLarge:with: */ - firstDigitLen = ((slotSizeOf(firstLarge)) + 3) / 4; - secondDigitLen = ((slotSizeOf(secondLarge)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstLarge)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondLarge)) + 3) / 4; neg = isLargeNegativeIntegerObject(firstLarge); if (firstDigitLen <= secondDigitLen) { shortInt = firstLarge; @@ -2589,14 +2576,12 @@ primDigitBitAnd(void) sqInt _return_value; if (!(isKindOfInteger(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(0); - success(isKindOfInteger(stackValue(1))); firstInteger = stackValue(1); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (!(failed())) { _return_value = digitBitLogicwithopIndex(firstInteger, secondInteger, andOpIndex); @@ -2620,14 +2605,12 @@ primDigitBitOr(void) sqInt _return_value; if (!(isKindOfInteger(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(0); - success(isKindOfInteger(stackValue(1))); firstInteger = stackValue(1); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (!(failed())) { _return_value = digitBitLogicwithopIndex(firstInteger, secondInteger, orOpIndex); @@ -2650,14 +2633,12 @@ primDigitBitShiftMagnitude(void) sqInt _return_value; if (!(isIntegerObject((shiftCount = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } shiftCount = integerValueOf(shiftCount); - success(isKindOfInteger(stackValue(1))); anInteger = stackValue(1); - if (failed()) { - return null; + if (!(isKindOfInteger(anInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (isIntegerObject(anInteger)) { @@ -2674,26 +2655,24 @@ primDigitBitShiftMagnitude(void) } return null; } - else { - rShift = 0 - shiftCount; - if (!(failed())) { - /* begin normalize: */ - aLargeInteger = digitRshiftlookfirst(aLarge, rShift, ((slotSizeOf(aLarge)) + 3) / 4); - if (isLargePositiveIntegerObject(aLargeInteger)) { - _return_value = normalizePositive(aLargeInteger); - goto l1; - } - else { - _return_value = normalizeNegative(aLargeInteger); - goto l1; - } + rShift = 0 - shiftCount; + if (!(failed())) { + /* begin normalize: */ + aLargeInteger = digitRshiftlookfirst(aLarge, rShift, ((byteSizeOf(aLarge)) + 3) / 4); + if (isLargePositiveIntegerObject(aLargeInteger)) { + _return_value = normalizePositive(aLargeInteger); + goto l1; + } + else { + _return_value = normalizeNegative(aLargeInteger); + goto l1; + } l1: /* end normalize: */; - if (!(failed())) { - methodReturnValue(_return_value); - } + if (!(failed())) { + methodReturnValue(_return_value); } - return null; } + return null; } @@ -2709,14 +2688,12 @@ primDigitBitXor(void) sqInt _return_value; if (!(isKindOfInteger(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(0); - success(isKindOfInteger(stackValue(1))); firstInteger = stackValue(1); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (!(failed())) { _return_value = digitBitLogicwithopIndex(firstInteger, secondInteger, xorOpIndex); @@ -2744,14 +2721,12 @@ primDigitCompare(void) sqInt _return_value; if (!(isKindOfInteger(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(0); - success(isKindOfInteger(stackValue(1))); firstInteger = stackValue(1); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (isIntegerObject(firstInteger)) { if (isIntegerObject(secondInteger)) { @@ -2796,8 +2771,8 @@ primDigitCompare(void) } if (!(failed())) { /* begin digitCompareLarge:with: */ - firstDigitLen = ((slotSizeOf(firstInteger)) + 3) / 4; - secondDigitLen = ((slotSizeOf(secondInteger)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstInteger)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondInteger)) + 3) / 4; if (secondDigitLen != firstDigitLen) { if (secondDigitLen > firstDigitLen) { _return_value = integerObjectOf(-1); @@ -2819,8 +2794,9 @@ primDigitCompare(void) /* Answer the result of dividing firstInteger by secondInteger. - Fail if parameters are not integers, not normalized or secondInteger is - zero. */ + Fail if parameters are not integers, not normalized or secondInteger is + zero. + */ /* LargeIntegersPlugin>>#primDigitDiv:negative: */ EXPORT(sqInt) @@ -2867,15 +2843,13 @@ primDigitDivNegative(void) if (!((isKindOfInteger(stackValue(1))) && (isBooleanObject(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(1); neg = booleanValueOf(stackValue(0)); - success(isKindOfInteger(stackValue(2))); firstInteger = stackValue(2); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (isIntegerObject(firstInteger)) { @@ -2924,8 +2898,8 @@ primDigitDivNegative(void) } if (!(failed())) { /* begin digitDivLarge:with:negative: */ - firstDigitLen = ((slotSizeOf(firstAsLargeInteger)) + 3) / 4; - secondDigitLen = ((slotSizeOf(secondAsLargeInteger)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstAsLargeInteger)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondAsLargeInteger)) + 3) / 4; quoDigitLen = (firstDigitLen - secondDigitLen) + 1; if (quoDigitLen <= 0) { @@ -2948,7 +2922,7 @@ primDigitDivNegative(void) #if SPURVM div = digitLshift(secondAsLargeInteger, d); if (!(div == null)) { - div = largeIntgrowTo(div, ((((slotSizeOf(div)) + 3) / 4) + 1) * 4); + div = largeIntgrowTo(div, ((((byteSizeOf(div)) + 3) / 4) + 1) * 4); } if (!div) { _return_value = div; @@ -2958,7 +2932,7 @@ primDigitDivNegative(void) pushRemappableOop(firstAsLargeInteger); div = digitLshift(secondAsLargeInteger, d); if (!(div == null)) { - div = largeIntgrowTo(div, ((((slotSizeOf(div)) + 3) / 4) + 1) * 4); + div = largeIntgrowTo(div, ((((byteSizeOf(div)) + 3) / 4) + 1) * 4); } if (!div) { _return_value = div; @@ -2970,7 +2944,7 @@ primDigitDivNegative(void) #if SPURVM rem = digitLshift(firstAsLargeInteger, d); if (!(rem == null)) { - if ((((slotSizeOf(rem)) + 3) / 4) == firstDigitLen) { + if ((((byteSizeOf(rem)) + 3) / 4) == firstDigitLen) { rem = largeIntgrowTo(rem, (firstDigitLen + 1) * 4); } } @@ -2982,7 +2956,7 @@ primDigitDivNegative(void) pushRemappableOop(div); rem = digitLshift(firstAsLargeInteger, d); if (!(rem == null)) { - if ((((slotSizeOf(rem)) + 3) / 4) == firstDigitLen) { + if ((((byteSizeOf(rem)) + 3) / 4) == firstDigitLen) { rem = largeIntgrowTo(rem, (firstDigitLen + 1) * 4); } } @@ -3020,11 +2994,11 @@ primDigitDivNegative(void) #endif /* SPURVM */ /* begin cDigitDiv:len:rem:len:quo:len: */ pDiv = ((unsigned int *) (firstIndexableField(div))); - divLen = ((slotSizeOf(div)) + 3) / 4; + divLen = ((byteSizeOf(div)) + 3) / 4; pRem = ((unsigned int *) (firstIndexableField(rem))); - remLen = ((slotSizeOf(rem)) + 3) / 4; + remLen = ((byteSizeOf(rem)) + 3) / 4; pQuo = ((unsigned int *) (firstIndexableField(quo))); - quoLen = ((slotSizeOf(quo)) + 3) / 4; + quoLen = ((byteSizeOf(quo)) + 3) / 4; /* Last actual byte of data (ST ix) */ dl = divLen - 1; @@ -3127,10 +3101,10 @@ primDigitDivNegative(void) } #if SPURVM - rem = digitRshiftlookfirst(rem, d, (((slotSizeOf(div)) + 3) / 4) - 1); + rem = digitRshiftlookfirst(rem, d, (((byteSizeOf(div)) + 3) / 4) - 1); #else /* SPURVM */ pushRemappableOop(quo); - rem = digitRshiftlookfirst(rem, d, (((slotSizeOf(div)) + 3) / 4) - 1); + rem = digitRshiftlookfirst(rem, d, (((byteSizeOf(div)) + 3) / 4) - 1); quo = popRemappableOop(); #endif /* SPURVM */ @@ -3187,15 +3161,13 @@ primDigitMultiplyNegative(void) if (!((isKindOfInteger(stackValue(1))) && (isBooleanObject(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(1); neg = booleanValueOf(stackValue(0)); - success(isKindOfInteger(stackValue(2))); firstInteger = stackValue(2); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (isIntegerObject(firstInteger)) { @@ -3229,9 +3201,8 @@ primDigitMultiplyNegative(void) } if (!(failed())) { /* begin digitMultiplyLarge:with:negative: */ - firstLen = slotSizeOf(firstLarge); - /* begin byteSizeOfLargeInt: */ - secondLen = slotSizeOf(secondLarge); + firstLen = byteSizeOf(firstLarge); + secondLen = byteSizeOf(secondLarge); if (firstLen <= secondLen) { shortInt = firstLarge; shortLen = firstLen; @@ -3262,7 +3233,7 @@ primDigitMultiplyNegative(void) #endif /* SPURVM */ if (!prod) { _return_value = primitiveFailFor(PrimErrNoMemory); - goto l5; + goto l3; } /* begin cDigitMultiply:len:with:len:into:len: */ pWordShort = ((unsigned int *) (firstIndexableField(shortInt))); @@ -3270,11 +3241,11 @@ primDigitMultiplyNegative(void) pWordRes = ((unsigned int *) (firstIndexableField(prod))); if ((((shortLen + 3) / 4) == 1) && ((pWordShort[0]) == 0)) { - goto l4; + goto l2; } if ((((longLen + 3) / 4) == 1) && ((pWordLong[0]) == 0)) { - goto l4; + goto l2; } limitShort = ((shortLen + 3) / 4) - 1; limitLong = ((longLen + 3) / 4) - 1; @@ -3297,11 +3268,11 @@ primDigitMultiplyNegative(void) } } } - l4: /* end cDigitMultiply:len:with:len:into:len: */; + l2: /* end cDigitMultiply:len:with:len:into:len: */; _return_value = (neg ? normalizeNegative(prod) : normalizePositive(prod)); - l5: /* end digitMultiplyLarge:with:negative: */; + l3: /* end digitMultiplyLarge:with:negative: */; if (!(failed())) { methodReturnValue(_return_value); } @@ -3335,14 +3306,12 @@ primDigitSubtract(void) unsigned long long z; if (!(isKindOfInteger(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondInteger = stackValue(0); - success(isKindOfInteger(stackValue(1))); firstInteger = stackValue(1); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } if (isIntegerObject(firstInteger)) { @@ -3378,9 +3347,9 @@ primDigitSubtract(void) /* begin digitSubLarge:with: */ firstNeg = isLargeNegativeIntegerObject(firstLarge); /* begin digitSizeOfLargeInt: */ - firstDigitLen = ((slotSizeOf(firstLarge)) + 3) / 4; + firstDigitLen = ((byteSizeOf(firstLarge)) + 3) / 4; /* begin digitSizeOfLargeInt: */ - secondDigitLen = ((slotSizeOf(secondLarge)) + 3) / 4; + secondDigitLen = ((byteSizeOf(secondLarge)) + 3) / 4; if (firstDigitLen == secondDigitLen) { while ((firstDigitLen > 1) && ((cDigitOfat(((unsigned int *) (firstIndexableField(firstLarge))), firstDigitLen - 1)) == (cDigitOfat(((unsigned int *) (firstIndexableField(secondLarge))), firstDigitLen - 1)))) { @@ -3520,16 +3489,14 @@ primMontgomeryTimesModulo(void) if (!((isKindOfInteger(stackValue(2))) && ((isKindOfInteger(stackValue(1))) && (isKindOfInteger(stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } secondOperandInteger = stackValue(2); thirdModuloInteger = stackValue(1); mInverseInteger = stackValue(0); - success(isKindOfInteger(stackValue(3))); firstInteger = stackValue(3); - if (failed()) { - return null; + if (!(isKindOfInteger(firstInteger))) { + return primitiveFailFor(PrimErrBadArgument); } mInv = positive32BitValueOf(mInverseInteger); if (isIntegerObject(firstInteger)) { @@ -3585,9 +3552,9 @@ primMontgomeryTimesModulo(void) } if (!(failed())) { /* begin digitMontgomery:times:modulo:mInvModB: */ - firstLen = ((slotSizeOf(firstLarge)) + 3) / 4; - secondLen = ((slotSizeOf(secondLarge)) + 3) / 4; - thirdLen = ((slotSizeOf(thirdLarge)) + 3) / 4; + firstLen = ((byteSizeOf(firstLarge)) + 3) / 4; + secondLen = ((byteSizeOf(secondLarge)) + 3) / 4; + thirdLen = ((byteSizeOf(thirdLarge)) + 3) / 4; if (!((firstLen <= thirdLen) && (secondLen <= thirdLen))) { _return_value = primitiveFail(); @@ -3685,10 +3652,9 @@ primNormalizeNegative(void) sqInt rcvr; sqInt _return_value; - success(isLargeNegativeIntegerObject(stackValue(0))); rcvr = stackValue(0); - if (failed()) { - return null; + if (!(isLargeNegativeIntegerObject(rcvr))) { + return primitiveFailFor(PrimErrBadArgument); } if (!(failed())) { _return_value = normalizeNegative(rcvr); @@ -3706,10 +3672,9 @@ primNormalizePositive(void) sqInt rcvr; sqInt _return_value; - success(isLargePositiveIntegerObject(stackValue(0))); rcvr = stackValue(0); - if (failed()) { - return null; + if (!(isLargePositiveIntegerObject(rcvr))) { + return primitiveFailFor(PrimErrBadArgument); } if (!(failed())) { _return_value = normalizePositive(rcvr); @@ -3739,6 +3704,7 @@ setInterpreter(struct VirtualMachine *anInterpreter) #if !defined(SQUEAK_BUILTIN_PLUGIN) booleanValueOf = interpreterProxy->booleanValueOf; + byteSizeOf = interpreterProxy->byteSizeOf; classArray = interpreterProxy->classArray; classLargeNegativeInteger = interpreterProxy->classLargeNegativeInteger; classLargePositiveInteger = interpreterProxy->classLargePositiveInteger; @@ -3770,10 +3736,8 @@ setInterpreter(struct VirtualMachine *anInterpreter) primitiveFail = interpreterProxy->primitiveFail; primitiveFailFor = interpreterProxy->primitiveFailFor; pushRemappableOop = interpreterProxy->pushRemappableOop; - slotSizeOf = interpreterProxy->slotSizeOf; stObjectatput = interpreterProxy->stObjectatput; stackValue = interpreterProxy->stackValue; - success = interpreterProxy->success; trueObject = interpreterProxy->trueObject; #endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ } @@ -3796,39 +3760,42 @@ unsafeByteOfLargeIntat(sqInt bytesObj, sqInt ix) static char _m[] = "LargeIntegers"; void* LargeIntegers_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primAnyBitFromTo\000\000", (void*)primAnyBitFromTo}, - {(void*)_m, "primDigitAdd\000\001", (void*)primDigitAdd}, - {(void*)_m, "primDigitBitAnd\000\001", (void*)primDigitBitAnd}, - {(void*)_m, "primDigitBitOr\000\001", (void*)primDigitBitOr}, - {(void*)_m, "primDigitBitShiftMagnitude\000\003", (void*)primDigitBitShiftMagnitude}, - {(void*)_m, "primDigitBitXor\000\001", (void*)primDigitBitXor}, - {(void*)_m, "primDigitCompare\000\000", (void*)primDigitCompare}, - {(void*)_m, "primDigitDivNegative\000\002", (void*)primDigitDivNegative}, - {(void*)_m, "primDigitMultiplyNegative\000\001", (void*)primDigitMultiplyNegative}, - {(void*)_m, "primDigitSubtract\000\001", (void*)primDigitSubtract}, - {(void*)_m, "primGetModuleName\000\377", (void*)primGetModuleName}, - {(void*)_m, "primMontgomeryDigitLength\000\377", (void*)primMontgomeryDigitLength}, - {(void*)_m, "primMontgomeryTimesModulo\000\001", (void*)primMontgomeryTimesModulo}, - {(void*)_m, "primNormalizeNegative\000\001", (void*)primNormalizeNegative}, - {(void*)_m, "primNormalizePositive\000\001", (void*)primNormalizePositive}, + {(void*)_m, "primAnyBitFromTo\000\002\001", (void*)primAnyBitFromTo}, + {(void*)_m, "primDigitAdd\000\003\001", (void*)primDigitAdd}, + {(void*)_m, "primDigitBitAnd\000\001\001", (void*)primDigitBitAnd}, + {(void*)_m, "primDigitBitOr\000\001\001", (void*)primDigitBitOr}, + {(void*)_m, "primDigitBitShiftMagnitude\000\003\001", (void*)primDigitBitShiftMagnitude}, + {(void*)_m, "primDigitBitXor\000\001\001", (void*)primDigitBitXor}, + {(void*)_m, "primDigitCompare\000\001\001", (void*)primDigitCompare}, + {(void*)_m, "primDigitDivNegative\000\002\001", (void*)primDigitDivNegative}, + {(void*)_m, "primDigitMultiplyNegative\000\002\001", (void*)primDigitMultiplyNegative}, + {(void*)_m, "primDigitSubtract\000\004\001", (void*)primDigitSubtract}, + {(void*)_m, "primGetModuleName\000\377\000", (void*)primGetModuleName}, + {(void*)_m, "primMontgomeryDigitLength\000\377\001", (void*)primMontgomeryDigitLength}, + {(void*)_m, "primMontgomeryTimesModulo\000\003\001", (void*)primMontgomeryTimesModulo}, + {(void*)_m, "primNormalizeNegative\000\001\001", (void*)primNormalizeNegative}, + {(void*)_m, "primNormalizePositive\000\001\001", (void*)primNormalizePositive}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primAnyBitFromToAccessorDepth = 0; -EXPORT(signed char) primDigitAddAccessorDepth = 1; -EXPORT(signed char) primDigitBitAndAccessorDepth = 1; -EXPORT(signed char) primDigitBitOrAccessorDepth = 1; -EXPORT(signed char) primDigitBitShiftMagnitudeAccessorDepth = 3; -EXPORT(signed char) primDigitBitXorAccessorDepth = 1; -EXPORT(signed char) primDigitCompareAccessorDepth = 0; -EXPORT(signed char) primDigitDivNegativeAccessorDepth = 2; -EXPORT(signed char) primDigitMultiplyNegativeAccessorDepth = 1; -EXPORT(signed char) primDigitSubtractAccessorDepth = 1; -EXPORT(signed char) primMontgomeryTimesModuloAccessorDepth = 1; -EXPORT(signed char) primNormalizeNegativeAccessorDepth = 1; -EXPORT(signed char) primNormalizePositiveAccessorDepth = 1; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primAnyBitFromToMetadata = 513; +EXPORT(signed short) primDigitAddMetadata = 769; +EXPORT(signed short) primDigitBitAndMetadata = 0x101; +EXPORT(signed short) primDigitBitOrMetadata = 0x101; +EXPORT(signed short) primDigitBitShiftMagnitudeMetadata = 769; +EXPORT(signed short) primDigitBitXorMetadata = 0x101; +EXPORT(signed short) primDigitCompareMetadata = 0x101; +EXPORT(signed short) primDigitDivNegativeMetadata = 513; +EXPORT(signed short) primDigitMultiplyNegativeMetadata = 513; +EXPORT(signed short) primDigitSubtractMetadata = 1025; +EXPORT(signed short) primMontgomeryDigitLengthMetadata = -255; +EXPORT(signed short) primMontgomeryTimesModuloMetadata = 769; +EXPORT(signed short) primNormalizeNegativeMetadata = 0x101; +EXPORT(signed short) primNormalizePositiveMetadata = 0x101; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/LocalePlugin/LocalePlugin.c b/src/plugins/LocalePlugin/LocalePlugin.c index 89043d25d4..47bbf6fc63 100644 --- a/src/plugins/LocalePlugin/LocalePlugin.c +++ b/src/plugins/LocalePlugin/LocalePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - LocalePlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + LocalePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "LocalePlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 " __DATE__ ; +static char __buildInfo[] = "LocalePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -76,7 +76,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "LocalePlugin VMMaker.oscog-eem.2944 " INT_EXT; +static const char *moduleName = "LocalePlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -386,24 +386,26 @@ static char _m[] = "LocalePlugin"; void* LocalePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveCountry\000\377", (void*)primitiveCountry}, - {(void*)_m, "primitiveCurrencyNotation\000\377", (void*)primitiveCurrencyNotation}, - {(void*)_m, "primitiveCurrencySymbol\000\377", (void*)primitiveCurrencySymbol}, - {(void*)_m, "primitiveDaylightSavings\000\377", (void*)primitiveDaylightSavings}, - {(void*)_m, "primitiveDecimalSymbol\000\377", (void*)primitiveDecimalSymbol}, - {(void*)_m, "primitiveDigitGroupingSymbol\000\377", (void*)primitiveDigitGroupingSymbol}, - {(void*)_m, "primitiveLanguage\000\377", (void*)primitiveLanguage}, - {(void*)_m, "primitiveLongDateFormat\000\377", (void*)primitiveLongDateFormat}, - {(void*)_m, "primitiveMeasurementMetric\000\377", (void*)primitiveMeasurementMetric}, - {(void*)_m, "primitiveShortDateFormat\000\377", (void*)primitiveShortDateFormat}, - {(void*)_m, "primitiveTimeFormat\000\377", (void*)primitiveTimeFormat}, - {(void*)_m, "primitiveTimezoneOffset\000\377", (void*)primitiveTimezoneOffset}, - {(void*)_m, "primitiveVMOffsetToUTC\000\377", (void*)primitiveVMOffsetToUTC}, + {(void*)_m, "primitiveCountry\000\377\000", (void*)primitiveCountry}, + {(void*)_m, "primitiveCurrencyNotation\000\377\000", (void*)primitiveCurrencyNotation}, + {(void*)_m, "primitiveCurrencySymbol\000\377\000", (void*)primitiveCurrencySymbol}, + {(void*)_m, "primitiveDaylightSavings\000\377\000", (void*)primitiveDaylightSavings}, + {(void*)_m, "primitiveDecimalSymbol\000\377\000", (void*)primitiveDecimalSymbol}, + {(void*)_m, "primitiveDigitGroupingSymbol\000\377\000", (void*)primitiveDigitGroupingSymbol}, + {(void*)_m, "primitiveLanguage\000\377\000", (void*)primitiveLanguage}, + {(void*)_m, "primitiveLongDateFormat\000\377\000", (void*)primitiveLongDateFormat}, + {(void*)_m, "primitiveMeasurementMetric\000\377\000", (void*)primitiveMeasurementMetric}, + {(void*)_m, "primitiveShortDateFormat\000\377\000", (void*)primitiveShortDateFormat}, + {(void*)_m, "primitiveTimeFormat\000\377\000", (void*)primitiveTimeFormat}, + {(void*)_m, "primitiveTimezoneOffset\000\377\000", (void*)primitiveTimezoneOffset}, + {(void*)_m, "primitiveVMOffsetToUTC\000\377\000", (void*)primitiveVMOffsetToUTC}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN +#if SPURVM +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/MD5Plugin/MD5Plugin.c b/src/plugins/MD5Plugin/MD5Plugin.c index 70fec43684..1715e132dd 100644 --- a/src/plugins/MD5Plugin/MD5Plugin.c +++ b/src/plugins/MD5Plugin/MD5Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - MD5Plugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee + MD5Plugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d */ -static char __buildInfo[] = "MD5Plugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee " __DATE__ ; +static char __buildInfo[] = "MD5Plugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d " __DATE__ ; #include "config.h" @@ -73,7 +73,7 @@ extern sqInt stackObjectValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "MD5Plugin CryptographyPlugins-ul.22 " INT_EXT; +static const char *moduleName = "MD5Plugin CryptographyPlugins-eem.23 " INT_EXT; @@ -362,18 +362,21 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "MD5Plugin"; void* MD5Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDecodeState\000\001", (void*)primitiveDecodeState}, - {(void*)_m, "primitiveInitializeState\000\001", (void*)primitiveInitializeState}, - {(void*)_m, "primitivePluginAvailable\000\377", (void*)primitivePluginAvailable}, - {(void*)_m, "primitiveProcessBufferWithState\000\001", (void*)primitiveProcessBufferWithState}, + {(void*)_m, "primitiveDecodeState\000\001\001", (void*)primitiveDecodeState}, + {(void*)_m, "primitiveInitializeState\000\001\001", (void*)primitiveInitializeState}, + {(void*)_m, "primitivePluginAvailable\000\377\001", (void*)primitivePluginAvailable}, + {(void*)_m, "primitiveProcessBufferWithState\000\001\001", (void*)primitiveProcessBufferWithState}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDecodeStateAccessorDepth = 1; -EXPORT(signed char) primitiveInitializeStateAccessorDepth = 1; -EXPORT(signed char) primitiveProcessBufferWithStateAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveDecodeStateMetadata = 0x101; +EXPORT(signed short) primitiveInitializeStateMetadata = 0x101; +EXPORT(signed short) primitivePluginAvailableMetadata = -255; +EXPORT(signed short) primitiveProcessBufferWithStateMetadata = 0x101; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/MIDIPlugin/MIDIPlugin.c b/src/plugins/MIDIPlugin/MIDIPlugin.c index 16ccf8b0a8..186baaaa75 100644 --- a/src/plugins/MIDIPlugin/MIDIPlugin.c +++ b/src/plugins/MIDIPlugin/MIDIPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - MIDIPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + MIDIPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "MIDIPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "MIDIPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -99,7 +99,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "MIDIPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "MIDIPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -129,13 +129,9 @@ primitiveMIDIClosePort(void) sqInt portNum; if (!(isIntegerObject((portNum = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); - if (failed()) { - return null; - } sqMIDIClosePort(portNum); if (!(failed())) { pop(1); @@ -184,13 +180,9 @@ primitiveMIDIGetPortDirectionality(void) sqInt portNum; if (!(isIntegerObject((portNum = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); - if (failed()) { - return null; - } dir = sqMIDIGetPortDirectionality(portNum); if (!(failed())) { methodReturnInteger(dir); @@ -208,13 +200,9 @@ primitiveMIDIGetPortName(void) sqInt sz; if (!(isIntegerObject((portNum = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); - if (failed()) { - return null; - } sz = sqMIDIGetPortName(portNum, portName, 0xFF); nameObj = instantiateClassindexableSize(classString(), sz); if (failed()) { @@ -238,15 +226,11 @@ primitiveMIDIOpenPort(void) if (!((isIntegerObject((portNum = stackValue(2)))) && ((isIntegerObject((semaIndex = stackValue(1)))) && (isIntegerObject((clockRate = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); semaIndex = integerValueOf(semaIndex); clockRate = integerValueOf(clockRate); - if (failed()) { - return null; - } sqMIDIOpenPort(portNum, semaIndex, clockRate); if (!(failed())) { pop(3); @@ -265,13 +249,9 @@ primitiveMIDIParameterGet(void) sqInt whichParameter; if (!(isIntegerObject((whichParameter = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } whichParameter = integerValueOf(whichParameter); - if (failed()) { - return null; - } currentValue = sqMIDIParameterGet(whichParameter); if (!(failed())) { methodReturnInteger(currentValue); @@ -306,14 +286,10 @@ primitiveMIDIParameterSet(void) if (!((isIntegerObject((whichParameter = stackValue(1)))) && (isIntegerObject((newValue = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } whichParameter = integerValueOf(whichParameter); newValue = integerValueOf(newValue); - if (failed()) { - return null; - } sqMIDIParameterSet(whichParameter, newValue); if (!(failed())) { pop(2); @@ -332,14 +308,10 @@ primitiveMIDIRead(void) if (!((isIntegerObject((portNum = stackValue(1)))) && (isBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); array = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } arrayLength = byteSizeOf(((sqInt)(sqIntptr_t)(array) - BaseHeaderSize)); bytesRead = sqMIDIPortReadInto(portNum, arrayLength, array); if (!(failed())) { @@ -361,15 +333,11 @@ primitiveMIDIWrite(void) if (!((isIntegerObject((portNum = stackValue(2)))) && ((isBytes(stackValue(1))) && (isIntegerObject((time = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); array = ((char *) (firstIndexableField(stackValue(1)))); time = integerValueOf(time); - if (failed()) { - return null; - } arrayLength = byteSizeOf(((sqInt)(sqIntptr_t)(array) - BaseHeaderSize)); bytesWritten = sqMIDIPortWriteFromAt(portNum, arrayLength, array, time); if (!(failed())) { @@ -433,32 +401,33 @@ static char _m[] = "MIDIPlugin"; void* MIDIPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveMIDIClosePort\000\000", (void*)primitiveMIDIClosePort}, - {(void*)_m, "primitiveMIDIGetClock\000\377", (void*)primitiveMIDIGetClock}, - {(void*)_m, "primitiveMIDIGetPortCount\000\377", (void*)primitiveMIDIGetPortCount}, - {(void*)_m, "primitiveMIDIGetPortDirectionality\000\000", (void*)primitiveMIDIGetPortDirectionality}, - {(void*)_m, "primitiveMIDIGetPortName\000\000", (void*)primitiveMIDIGetPortName}, - {(void*)_m, "primitiveMIDIOpenPort\000\000", (void*)primitiveMIDIOpenPort}, - {(void*)_m, "primitiveMIDIParameterGet\000\000", (void*)primitiveMIDIParameterGet}, - {(void*)_m, "primitiveMIDIParameterGetOrSet\000\000", (void*)primitiveMIDIParameterGetOrSet}, - {(void*)_m, "primitiveMIDIParameterSet\000\000", (void*)primitiveMIDIParameterSet}, - {(void*)_m, "primitiveMIDIRead\000\000", (void*)primitiveMIDIRead}, - {(void*)_m, "primitiveMIDIWrite\000\000", (void*)primitiveMIDIWrite}, + {(void*)_m, "primitiveMIDIClosePort\000\000\000", (void*)primitiveMIDIClosePort}, + {(void*)_m, "primitiveMIDIGetClock\000\377\000", (void*)primitiveMIDIGetClock}, + {(void*)_m, "primitiveMIDIGetPortCount\000\377\000", (void*)primitiveMIDIGetPortCount}, + {(void*)_m, "primitiveMIDIGetPortDirectionality\000\000\000", (void*)primitiveMIDIGetPortDirectionality}, + {(void*)_m, "primitiveMIDIGetPortName\000\000\000", (void*)primitiveMIDIGetPortName}, + {(void*)_m, "primitiveMIDIOpenPort\000\000\000", (void*)primitiveMIDIOpenPort}, + {(void*)_m, "primitiveMIDIParameterGet\000\000\000", (void*)primitiveMIDIParameterGet}, + {(void*)_m, "primitiveMIDIParameterGetOrSet\000\377\000", (void*)primitiveMIDIParameterGetOrSet}, + {(void*)_m, "primitiveMIDIParameterSet\000\000\000", (void*)primitiveMIDIParameterSet}, + {(void*)_m, "primitiveMIDIRead\000\000\000", (void*)primitiveMIDIRead}, + {(void*)_m, "primitiveMIDIWrite\000\000\000", (void*)primitiveMIDIWrite}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveMIDIClosePortAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIGetPortDirectionalityAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIGetPortNameAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIOpenPortAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIParameterGetAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIParameterGetOrSetAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIParameterSetAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIReadAccessorDepth = 0; -EXPORT(signed char) primitiveMIDIWriteAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveMIDIClosePortMetadata = 0; +EXPORT(signed short) primitiveMIDIGetPortDirectionalityMetadata = 0; +EXPORT(signed short) primitiveMIDIGetPortNameMetadata = 0; +EXPORT(signed short) primitiveMIDIOpenPortMetadata = 0; +EXPORT(signed short) primitiveMIDIParameterGetMetadata = 0; +EXPORT(signed short) primitiveMIDIParameterSetMetadata = 0; +EXPORT(signed short) primitiveMIDIReadMetadata = 0; +EXPORT(signed short) primitiveMIDIWriteMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c b/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c index 8ab2957c5e..99fbbc891d 100644 --- a/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c +++ b/src/plugins/MacMenubarPlugin/MacMenubarPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - MacMenubarPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + MacMenubarPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "MacMenubarPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "MacMenubarPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -167,7 +167,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "MacMenubarPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "MacMenubarPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -193,14 +193,10 @@ primitiveAppendMenu(void) char *str255; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); str255 = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -220,14 +216,10 @@ primitiveAppendMenuItemText(void) char *str255; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); str255 = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -248,15 +240,11 @@ primitiveCheckMenuItem(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isBooleanObject(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); aBoolean = booleanValueOf(stackValue(0)); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -282,9 +270,6 @@ primitiveCountMenuItems(void) sqInt returnValue; menuHandleOop = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -306,13 +291,9 @@ primitiveCreateStandardWindowMenu(void) sqInt _return_value; if (!(isIntegerObject((inOptions = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } inOptions = integerValueOf(inOptions); - if (failed()) { - return null; - } # if TARGET_API_MAC_CARBON result = CreateStandardWindowMenu(inOptions,&menuHandle); # endif @@ -335,13 +316,9 @@ primitiveDeleteMenu(void) MenuID menuID; if (!(isIntegerObject((menuID = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuID = integerValueOf(menuID); - if (failed()) { - return null; - } DeleteMenu(menuID); return null; } @@ -355,14 +332,10 @@ primitiveDeleteMenuItem(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -382,9 +355,6 @@ primitiveDisableMenuCommand(void) menuHandleOop = stackValue(1); anInteger = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); commandID = ((MenuCommand) (positive32BitValueOf(anInteger))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -405,14 +375,10 @@ primitiveDisableMenuItem(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -430,14 +396,10 @@ primitiveDisableMenuItemIcon(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -454,9 +416,6 @@ primitiveDisposeMenu(void) sqInt menuHandleOop; menuHandleOop = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -473,9 +432,6 @@ primitiveDisposeMenuBar(void) sqInt menuHandleOop; menuHandleOop = stackValue(0); - if (failed()) { - return null; - } menuBarHandle = ((Handle) (positiveMachineIntegerValueOf(menuHandleOop))); # if TARGET_API_MAC_CARBON DisposeMenuBar(menuBarHandle); @@ -504,9 +460,6 @@ primitiveEnableMenuCommand(void) menuHandleOop = stackValue(1); anInteger = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); commandID = ((MenuCommand) (positive32BitValueOf(anInteger))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -527,14 +480,10 @@ primitiveEnableMenuItem(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -552,14 +501,10 @@ primitiveEnableMenuItemIcon(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -581,9 +526,6 @@ primitiveGetIndMenuItemWithCommandID(void) menuHandleOop = stackValue(1); aCommandID = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); commandID = ((MenuCommand) (positive32BitValueOf(aCommandID))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -613,9 +555,6 @@ primitiveGetIndMenuWithCommandID(void) menuHandleOop = stackValue(1); aCommandID = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); commandID = ((MenuCommand) (positive32BitValueOf(aCommandID))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -648,14 +587,10 @@ primitiveGetItemCmd(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -678,14 +613,10 @@ primitiveGetItemIcon(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -708,14 +639,10 @@ primitiveGetItemMark(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -738,14 +665,10 @@ primitiveGetItemStyle(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -787,13 +710,9 @@ primitiveGetMenuHandle(void) sqInt _return_value; if (!(isIntegerObject((menuID = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuID = integerValueOf(menuID); - if (failed()) { - return null; - } menuHandle = GetMenuHandle(menuID); if (!(failed())) { /* begin positiveMachineIntegerFor: */ @@ -816,9 +735,6 @@ primitiveGetMenuID(void) MenuID menuID; menuHandleOop = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -841,14 +757,10 @@ primitiveGetMenuItemCommandID(void) sqInt _return_value; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } outCommandID = 0; menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -874,14 +786,10 @@ primitiveGetMenuItemFontID(void) SInt16 outFontID; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } outFontID = 0; menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -904,14 +812,10 @@ primitiveGetMenuItemHierarchicalID(void) MenuID outHierID; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -935,14 +839,10 @@ primitiveGetMenuItemKeyGlyph(void) sqInt _return_value; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } outGlyph = 0; menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -968,14 +868,10 @@ primitiveGetMenuItemModifiers(void) Style outModifers; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1002,14 +898,10 @@ primitiveGetMenuItemText(void) sqInt size; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1039,14 +931,10 @@ primitiveGetMenuItemTextEncoding(void) sqInt _return_value; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1074,9 +962,6 @@ primitiveGetMenuTitle(void) sqInt size; menuHandleOop = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1110,13 +995,9 @@ primitiveHiliteMenu(void) MenuID menuID; if (!(isIntegerObject((menuID = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuID = integerValueOf(menuID); - if (failed()) { - return null; - } HiliteMenu(menuID); return null; } @@ -1132,15 +1013,11 @@ primitiveInsertFontResMenu(void) if (!((isIntegerObject((afterItemInteger = stackValue(1)))) && (isIntegerObject((scriptFilterInteger = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); afterItemInteger = integerValueOf(afterItemInteger); scriptFilterInteger = integerValueOf(scriptFilterInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1163,16 +1040,12 @@ primitiveInsertIntlResMenu(void) if (!((isIntegerObject((aResType = stackValue(2)))) && ((isIntegerObject((afterItemInteger = stackValue(1)))) && (isIntegerObject((scriptFilterInteger = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(3); aResType = integerValueOf(aResType); afterItemInteger = integerValueOf(afterItemInteger); scriptFilterInteger = integerValueOf(scriptFilterInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1191,14 +1064,10 @@ primitiveInsertMenu(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1219,15 +1088,11 @@ primitiveInsertMenuItem(void) if (!((isBytes(stackValue(1))) && (isIntegerObject((anInteger = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); str255 = ((char *) (firstIndexableField(stackValue(1)))); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1273,14 +1138,10 @@ primitiveIsMenuItemEnabled(void) sqInt _return_value; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1306,14 +1167,10 @@ primitiveIsMenuItemIconEnabled(void) sqInt _return_value; if (!(isIntegerObject((anInteger = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); anInteger = integerValueOf(anInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1340,14 +1197,10 @@ primitiveNewMenu(void) if (!((isIntegerObject((menuID = stackValue(1)))) && (isBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuID = integerValueOf(menuID); menuTitle = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } constStr255 = ((ConstStr255Param) menuTitle); menuHandle = NewMenu(menuID,constStr255); if (!(failed())) { @@ -1374,15 +1227,11 @@ primitiveSetItemCmd(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((anIntegerCmdChar = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); anIntegerCmdChar = integerValueOf(anIntegerCmdChar); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1403,15 +1252,11 @@ primitiveSetItemIcon(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((aIconIndexInteger = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); aIconIndexInteger = integerValueOf(aIconIndexInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1432,15 +1277,11 @@ primitiveSetItemMark(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((aMarkChar = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); aMarkChar = integerValueOf(aMarkChar); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1461,15 +1302,11 @@ primitiveSetItemStyle(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((chStyleInteger = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); chStyleInteger = integerValueOf(chStyleInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1486,9 +1323,6 @@ primitiveSetMenuBar(void) sqInt menuHandleOop; menuHandleOop = stackValue(0); - if (failed()) { - return null; - } menuBarHandle = ((MenuBarHandle) (positiveMachineIntegerValueOf(menuHandleOop))); SetMenuBar(menuBarHandle); return null; @@ -1505,15 +1339,11 @@ primitiveSetMenuItemCommandID(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(1))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); inCommandID = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); commandID = ((MenuCommand) (positive32BitValueOf(inCommandID))); if (!(ioCheckMenuHandle(menuHandle))) { @@ -1534,15 +1364,11 @@ primitiveSetMenuItemFontID(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((aFontIDInteger = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); aFontIDInteger = integerValueOf(aFontIDInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1562,15 +1388,11 @@ primitiveSetMenuItemHierarchicalID(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((aMenuID = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); aMenuID = integerValueOf(aMenuID); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1590,15 +1412,11 @@ primitiveSetMenuItemKeyGlyph(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((inGlyphInteger = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); inGlyphInteger = integerValueOf(inGlyphInteger); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1618,15 +1436,11 @@ primitiveSetMenuItemModifiers(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isIntegerObject((aUInt8 = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); aUInt8 = integerValueOf(aUInt8); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1647,15 +1461,11 @@ primitiveSetMenuItemText(void) if (!((isIntegerObject((anInteger = stackValue(1)))) && (isBytes(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); str255 = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1676,15 +1486,11 @@ primitiveSetMenuItemTextEncoding(void) sqInt menuHandleOop; if (!(isIntegerObject((anInteger = stackValue(1))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(2); anInteger = integerValueOf(anInteger); aTextEncodingOop = stackValue(0); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1704,14 +1510,10 @@ primitiveSetMenuTitle(void) char *str255; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } menuHandleOop = stackValue(1); str255 = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } menuHandle = ((MenuHandle) (positiveMachineIntegerValueOf(menuHandleOop))); if (!(ioCheckMenuHandle(menuHandle))) { return success(0); @@ -1791,122 +1593,124 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "MacMenubarPlugin"; void* MacMenubarPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveAppendMenu\000\000", (void*)primitiveAppendMenu}, - {(void*)_m, "primitiveAppendMenuItemText\000\000", (void*)primitiveAppendMenuItemText}, - {(void*)_m, "primitiveCheckMenuItem\000\000", (void*)primitiveCheckMenuItem}, - {(void*)_m, "primitiveClearMenuBar\000\377", (void*)primitiveClearMenuBar}, - {(void*)_m, "primitiveCountMenuItems\000\000", (void*)primitiveCountMenuItems}, - {(void*)_m, "primitiveCreateStandardWindowMenu\000\000", (void*)primitiveCreateStandardWindowMenu}, - {(void*)_m, "primitiveDeleteMenu\000\000", (void*)primitiveDeleteMenu}, - {(void*)_m, "primitiveDeleteMenuItem\000\000", (void*)primitiveDeleteMenuItem}, - {(void*)_m, "primitiveDisableMenuCommand\000\000", (void*)primitiveDisableMenuCommand}, - {(void*)_m, "primitiveDisableMenuItem\000\000", (void*)primitiveDisableMenuItem}, - {(void*)_m, "primitiveDisableMenuItemIcon\000\000", (void*)primitiveDisableMenuItemIcon}, - {(void*)_m, "primitiveDisposeMenu\000\000", (void*)primitiveDisposeMenu}, - {(void*)_m, "primitiveDisposeMenuBar\000\000", (void*)primitiveDisposeMenuBar}, - {(void*)_m, "primitiveDrawMenuBar\000\377", (void*)primitiveDrawMenuBar}, - {(void*)_m, "primitiveEnableMenuCommand\000\000", (void*)primitiveEnableMenuCommand}, - {(void*)_m, "primitiveEnableMenuItem\000\000", (void*)primitiveEnableMenuItem}, - {(void*)_m, "primitiveEnableMenuItemIcon\000\000", (void*)primitiveEnableMenuItemIcon}, - {(void*)_m, "primitiveGetIndMenuItemWithCommandID\000\000", (void*)primitiveGetIndMenuItemWithCommandID}, - {(void*)_m, "primitiveGetIndMenuWithCommandID\000\000", (void*)primitiveGetIndMenuWithCommandID}, - {(void*)_m, "primitiveGetItemCmd\000\000", (void*)primitiveGetItemCmd}, - {(void*)_m, "primitiveGetItemIcon\000\000", (void*)primitiveGetItemIcon}, - {(void*)_m, "primitiveGetItemMark\000\000", (void*)primitiveGetItemMark}, - {(void*)_m, "primitiveGetItemStyle\000\000", (void*)primitiveGetItemStyle}, - {(void*)_m, "primitiveGetMenuBar\000\377", (void*)primitiveGetMenuBar}, - {(void*)_m, "primitiveGetMenuHandle\000\000", (void*)primitiveGetMenuHandle}, - {(void*)_m, "primitiveGetMenuID\000\000", (void*)primitiveGetMenuID}, - {(void*)_m, "primitiveGetMenuItemCommandID\000\000", (void*)primitiveGetMenuItemCommandID}, - {(void*)_m, "primitiveGetMenuItemFontID\000\000", (void*)primitiveGetMenuItemFontID}, - {(void*)_m, "primitiveGetMenuItemHierarchicalID\000\000", (void*)primitiveGetMenuItemHierarchicalID}, - {(void*)_m, "primitiveGetMenuItemKeyGlyph\000\000", (void*)primitiveGetMenuItemKeyGlyph}, - {(void*)_m, "primitiveGetMenuItemModifiers\000\000", (void*)primitiveGetMenuItemModifiers}, - {(void*)_m, "primitiveGetMenuItemText\000\000", (void*)primitiveGetMenuItemText}, - {(void*)_m, "primitiveGetMenuItemTextEncoding\000\000", (void*)primitiveGetMenuItemTextEncoding}, - {(void*)_m, "primitiveGetMenuTitle\000\000", (void*)primitiveGetMenuTitle}, - {(void*)_m, "primitiveHideMenuBar\000\377", (void*)primitiveHideMenuBar}, - {(void*)_m, "primitiveHiliteMenu\000\000", (void*)primitiveHiliteMenu}, - {(void*)_m, "primitiveInsertFontResMenu\000\000", (void*)primitiveInsertFontResMenu}, - {(void*)_m, "primitiveInsertIntlResMenu\000\000", (void*)primitiveInsertIntlResMenu}, - {(void*)_m, "primitiveInsertMenu\000\000", (void*)primitiveInsertMenu}, - {(void*)_m, "primitiveInsertMenuItem\000\000", (void*)primitiveInsertMenuItem}, - {(void*)_m, "primitiveInvalMenuBar\000\377", (void*)primitiveInvalMenuBar}, - {(void*)_m, "primitiveIsMenuBarVisible\000\377", (void*)primitiveIsMenuBarVisible}, - {(void*)_m, "primitiveIsMenuItemEnabled\000\000", (void*)primitiveIsMenuItemEnabled}, - {(void*)_m, "primitiveIsMenuItemIconEnabled\000\000", (void*)primitiveIsMenuItemIconEnabled}, - {(void*)_m, "primitiveNewMenu\000\000", (void*)primitiveNewMenu}, - {(void*)_m, "primitiveSetItemCmd\000\000", (void*)primitiveSetItemCmd}, - {(void*)_m, "primitiveSetItemIcon\000\000", (void*)primitiveSetItemIcon}, - {(void*)_m, "primitiveSetItemMark\000\000", (void*)primitiveSetItemMark}, - {(void*)_m, "primitiveSetItemStyle\000\000", (void*)primitiveSetItemStyle}, - {(void*)_m, "primitiveSetMenuBar\000\000", (void*)primitiveSetMenuBar}, - {(void*)_m, "primitiveSetMenuItemCommandID\000\000", (void*)primitiveSetMenuItemCommandID}, - {(void*)_m, "primitiveSetMenuItemFontID\000\000", (void*)primitiveSetMenuItemFontID}, - {(void*)_m, "primitiveSetMenuItemHierarchicalID\000\000", (void*)primitiveSetMenuItemHierarchicalID}, - {(void*)_m, "primitiveSetMenuItemKeyGlyph\000\000", (void*)primitiveSetMenuItemKeyGlyph}, - {(void*)_m, "primitiveSetMenuItemModifiers\000\000", (void*)primitiveSetMenuItemModifiers}, - {(void*)_m, "primitiveSetMenuItemText\000\000", (void*)primitiveSetMenuItemText}, - {(void*)_m, "primitiveSetMenuItemTextEncoding\000\000", (void*)primitiveSetMenuItemTextEncoding}, - {(void*)_m, "primitiveSetMenuTitle\000\000", (void*)primitiveSetMenuTitle}, - {(void*)_m, "primitiveShowMenuBar\000\377", (void*)primitiveShowMenuBar}, + {(void*)_m, "primitiveAppendMenu\000\000\000", (void*)primitiveAppendMenu}, + {(void*)_m, "primitiveAppendMenuItemText\000\000\000", (void*)primitiveAppendMenuItemText}, + {(void*)_m, "primitiveCheckMenuItem\000\000\000", (void*)primitiveCheckMenuItem}, + {(void*)_m, "primitiveClearMenuBar\000\377\000", (void*)primitiveClearMenuBar}, + {(void*)_m, "primitiveCountMenuItems\000\000\000", (void*)primitiveCountMenuItems}, + {(void*)_m, "primitiveCreateStandardWindowMenu\000\000\000", (void*)primitiveCreateStandardWindowMenu}, + {(void*)_m, "primitiveDeleteMenu\000\000\000", (void*)primitiveDeleteMenu}, + {(void*)_m, "primitiveDeleteMenuItem\000\000\000", (void*)primitiveDeleteMenuItem}, + {(void*)_m, "primitiveDisableMenuCommand\000\000\000", (void*)primitiveDisableMenuCommand}, + {(void*)_m, "primitiveDisableMenuItem\000\000\000", (void*)primitiveDisableMenuItem}, + {(void*)_m, "primitiveDisableMenuItemIcon\000\000\000", (void*)primitiveDisableMenuItemIcon}, + {(void*)_m, "primitiveDisposeMenu\000\000\000", (void*)primitiveDisposeMenu}, + {(void*)_m, "primitiveDisposeMenuBar\000\000\000", (void*)primitiveDisposeMenuBar}, + {(void*)_m, "primitiveDrawMenuBar\000\377\000", (void*)primitiveDrawMenuBar}, + {(void*)_m, "primitiveEnableMenuCommand\000\000\000", (void*)primitiveEnableMenuCommand}, + {(void*)_m, "primitiveEnableMenuItem\000\000\000", (void*)primitiveEnableMenuItem}, + {(void*)_m, "primitiveEnableMenuItemIcon\000\000\000", (void*)primitiveEnableMenuItemIcon}, + {(void*)_m, "primitiveGetIndMenuItemWithCommandID\000\000\000", (void*)primitiveGetIndMenuItemWithCommandID}, + {(void*)_m, "primitiveGetIndMenuWithCommandID\000\000\000", (void*)primitiveGetIndMenuWithCommandID}, + {(void*)_m, "primitiveGetItemCmd\000\000\000", (void*)primitiveGetItemCmd}, + {(void*)_m, "primitiveGetItemIcon\000\000\000", (void*)primitiveGetItemIcon}, + {(void*)_m, "primitiveGetItemMark\000\000\000", (void*)primitiveGetItemMark}, + {(void*)_m, "primitiveGetItemStyle\000\000\000", (void*)primitiveGetItemStyle}, + {(void*)_m, "primitiveGetMenuBar\000\377\000", (void*)primitiveGetMenuBar}, + {(void*)_m, "primitiveGetMenuHandle\000\000\000", (void*)primitiveGetMenuHandle}, + {(void*)_m, "primitiveGetMenuID\000\000\000", (void*)primitiveGetMenuID}, + {(void*)_m, "primitiveGetMenuItemCommandID\000\000\000", (void*)primitiveGetMenuItemCommandID}, + {(void*)_m, "primitiveGetMenuItemFontID\000\000\000", (void*)primitiveGetMenuItemFontID}, + {(void*)_m, "primitiveGetMenuItemHierarchicalID\000\000\000", (void*)primitiveGetMenuItemHierarchicalID}, + {(void*)_m, "primitiveGetMenuItemKeyGlyph\000\000\000", (void*)primitiveGetMenuItemKeyGlyph}, + {(void*)_m, "primitiveGetMenuItemModifiers\000\000\000", (void*)primitiveGetMenuItemModifiers}, + {(void*)_m, "primitiveGetMenuItemText\000\000\000", (void*)primitiveGetMenuItemText}, + {(void*)_m, "primitiveGetMenuItemTextEncoding\000\000\000", (void*)primitiveGetMenuItemTextEncoding}, + {(void*)_m, "primitiveGetMenuTitle\000\000\000", (void*)primitiveGetMenuTitle}, + {(void*)_m, "primitiveHideMenuBar\000\377\000", (void*)primitiveHideMenuBar}, + {(void*)_m, "primitiveHiliteMenu\000\000\000", (void*)primitiveHiliteMenu}, + {(void*)_m, "primitiveInsertFontResMenu\000\000\000", (void*)primitiveInsertFontResMenu}, + {(void*)_m, "primitiveInsertIntlResMenu\000\000\000", (void*)primitiveInsertIntlResMenu}, + {(void*)_m, "primitiveInsertMenu\000\000\000", (void*)primitiveInsertMenu}, + {(void*)_m, "primitiveInsertMenuItem\000\000\000", (void*)primitiveInsertMenuItem}, + {(void*)_m, "primitiveInvalMenuBar\000\377\000", (void*)primitiveInvalMenuBar}, + {(void*)_m, "primitiveIsMenuBarVisible\000\377\000", (void*)primitiveIsMenuBarVisible}, + {(void*)_m, "primitiveIsMenuItemEnabled\000\000\000", (void*)primitiveIsMenuItemEnabled}, + {(void*)_m, "primitiveIsMenuItemIconEnabled\000\000\000", (void*)primitiveIsMenuItemIconEnabled}, + {(void*)_m, "primitiveNewMenu\000\000\000", (void*)primitiveNewMenu}, + {(void*)_m, "primitiveSetItemCmd\000\000\000", (void*)primitiveSetItemCmd}, + {(void*)_m, "primitiveSetItemIcon\000\000\000", (void*)primitiveSetItemIcon}, + {(void*)_m, "primitiveSetItemMark\000\000\000", (void*)primitiveSetItemMark}, + {(void*)_m, "primitiveSetItemStyle\000\000\000", (void*)primitiveSetItemStyle}, + {(void*)_m, "primitiveSetMenuBar\000\000\000", (void*)primitiveSetMenuBar}, + {(void*)_m, "primitiveSetMenuItemCommandID\000\000\000", (void*)primitiveSetMenuItemCommandID}, + {(void*)_m, "primitiveSetMenuItemFontID\000\000\000", (void*)primitiveSetMenuItemFontID}, + {(void*)_m, "primitiveSetMenuItemHierarchicalID\000\000\000", (void*)primitiveSetMenuItemHierarchicalID}, + {(void*)_m, "primitiveSetMenuItemKeyGlyph\000\000\000", (void*)primitiveSetMenuItemKeyGlyph}, + {(void*)_m, "primitiveSetMenuItemModifiers\000\000\000", (void*)primitiveSetMenuItemModifiers}, + {(void*)_m, "primitiveSetMenuItemText\000\000\000", (void*)primitiveSetMenuItemText}, + {(void*)_m, "primitiveSetMenuItemTextEncoding\000\000\000", (void*)primitiveSetMenuItemTextEncoding}, + {(void*)_m, "primitiveSetMenuTitle\000\000\000", (void*)primitiveSetMenuTitle}, + {(void*)_m, "primitiveShowMenuBar\000\377\000", (void*)primitiveShowMenuBar}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveAppendMenuAccessorDepth = 0; -EXPORT(signed char) primitiveAppendMenuItemTextAccessorDepth = 0; -EXPORT(signed char) primitiveCheckMenuItemAccessorDepth = 0; -EXPORT(signed char) primitiveCountMenuItemsAccessorDepth = 0; -EXPORT(signed char) primitiveCreateStandardWindowMenuAccessorDepth = 0; -EXPORT(signed char) primitiveDeleteMenuAccessorDepth = 0; -EXPORT(signed char) primitiveDeleteMenuItemAccessorDepth = 0; -EXPORT(signed char) primitiveDisableMenuCommandAccessorDepth = 0; -EXPORT(signed char) primitiveDisableMenuItemAccessorDepth = 0; -EXPORT(signed char) primitiveDisableMenuItemIconAccessorDepth = 0; -EXPORT(signed char) primitiveDisposeMenuAccessorDepth = 0; -EXPORT(signed char) primitiveDisposeMenuBarAccessorDepth = 0; -EXPORT(signed char) primitiveEnableMenuCommandAccessorDepth = 0; -EXPORT(signed char) primitiveEnableMenuItemAccessorDepth = 0; -EXPORT(signed char) primitiveEnableMenuItemIconAccessorDepth = 0; -EXPORT(signed char) primitiveGetIndMenuItemWithCommandIDAccessorDepth = 0; -EXPORT(signed char) primitiveGetIndMenuWithCommandIDAccessorDepth = 0; -EXPORT(signed char) primitiveGetItemCmdAccessorDepth = 0; -EXPORT(signed char) primitiveGetItemIconAccessorDepth = 0; -EXPORT(signed char) primitiveGetItemMarkAccessorDepth = 0; -EXPORT(signed char) primitiveGetItemStyleAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuHandleAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuIDAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuItemCommandIDAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuItemFontIDAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuItemHierarchicalIDAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuItemKeyGlyphAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuItemModifiersAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuItemTextAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuItemTextEncodingAccessorDepth = 0; -EXPORT(signed char) primitiveGetMenuTitleAccessorDepth = 0; -EXPORT(signed char) primitiveHiliteMenuAccessorDepth = 0; -EXPORT(signed char) primitiveInsertFontResMenuAccessorDepth = 0; -EXPORT(signed char) primitiveInsertIntlResMenuAccessorDepth = 0; -EXPORT(signed char) primitiveInsertMenuAccessorDepth = 0; -EXPORT(signed char) primitiveInsertMenuItemAccessorDepth = 0; -EXPORT(signed char) primitiveIsMenuItemEnabledAccessorDepth = 0; -EXPORT(signed char) primitiveIsMenuItemIconEnabledAccessorDepth = 0; -EXPORT(signed char) primitiveNewMenuAccessorDepth = 0; -EXPORT(signed char) primitiveSetItemCmdAccessorDepth = 0; -EXPORT(signed char) primitiveSetItemIconAccessorDepth = 0; -EXPORT(signed char) primitiveSetItemMarkAccessorDepth = 0; -EXPORT(signed char) primitiveSetItemStyleAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuBarAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuItemCommandIDAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuItemFontIDAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuItemHierarchicalIDAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuItemKeyGlyphAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuItemModifiersAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuItemTextAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuItemTextEncodingAccessorDepth = 0; -EXPORT(signed char) primitiveSetMenuTitleAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveAppendMenuMetadata = 0; +EXPORT(signed short) primitiveAppendMenuItemTextMetadata = 0; +EXPORT(signed short) primitiveCheckMenuItemMetadata = 0; +EXPORT(signed short) primitiveCountMenuItemsMetadata = 0; +EXPORT(signed short) primitiveCreateStandardWindowMenuMetadata = 0; +EXPORT(signed short) primitiveDeleteMenuMetadata = 0; +EXPORT(signed short) primitiveDeleteMenuItemMetadata = 0; +EXPORT(signed short) primitiveDisableMenuCommandMetadata = 0; +EXPORT(signed short) primitiveDisableMenuItemMetadata = 0; +EXPORT(signed short) primitiveDisableMenuItemIconMetadata = 0; +EXPORT(signed short) primitiveDisposeMenuMetadata = 0; +EXPORT(signed short) primitiveDisposeMenuBarMetadata = 0; +EXPORT(signed short) primitiveEnableMenuCommandMetadata = 0; +EXPORT(signed short) primitiveEnableMenuItemMetadata = 0; +EXPORT(signed short) primitiveEnableMenuItemIconMetadata = 0; +EXPORT(signed short) primitiveGetIndMenuItemWithCommandIDMetadata = 0; +EXPORT(signed short) primitiveGetIndMenuWithCommandIDMetadata = 0; +EXPORT(signed short) primitiveGetItemCmdMetadata = 0; +EXPORT(signed short) primitiveGetItemIconMetadata = 0; +EXPORT(signed short) primitiveGetItemMarkMetadata = 0; +EXPORT(signed short) primitiveGetItemStyleMetadata = 0; +EXPORT(signed short) primitiveGetMenuHandleMetadata = 0; +EXPORT(signed short) primitiveGetMenuIDMetadata = 0; +EXPORT(signed short) primitiveGetMenuItemCommandIDMetadata = 0; +EXPORT(signed short) primitiveGetMenuItemFontIDMetadata = 0; +EXPORT(signed short) primitiveGetMenuItemHierarchicalIDMetadata = 0; +EXPORT(signed short) primitiveGetMenuItemKeyGlyphMetadata = 0; +EXPORT(signed short) primitiveGetMenuItemModifiersMetadata = 0; +EXPORT(signed short) primitiveGetMenuItemTextMetadata = 0; +EXPORT(signed short) primitiveGetMenuItemTextEncodingMetadata = 0; +EXPORT(signed short) primitiveGetMenuTitleMetadata = 0; +EXPORT(signed short) primitiveHiliteMenuMetadata = 0; +EXPORT(signed short) primitiveInsertFontResMenuMetadata = 0; +EXPORT(signed short) primitiveInsertIntlResMenuMetadata = 0; +EXPORT(signed short) primitiveInsertMenuMetadata = 0; +EXPORT(signed short) primitiveInsertMenuItemMetadata = 0; +EXPORT(signed short) primitiveIsMenuItemEnabledMetadata = 0; +EXPORT(signed short) primitiveIsMenuItemIconEnabledMetadata = 0; +EXPORT(signed short) primitiveNewMenuMetadata = 0; +EXPORT(signed short) primitiveSetItemCmdMetadata = 0; +EXPORT(signed short) primitiveSetItemIconMetadata = 0; +EXPORT(signed short) primitiveSetItemMarkMetadata = 0; +EXPORT(signed short) primitiveSetItemStyleMetadata = 0; +EXPORT(signed short) primitiveSetMenuBarMetadata = 0; +EXPORT(signed short) primitiveSetMenuItemCommandIDMetadata = 0; +EXPORT(signed short) primitiveSetMenuItemFontIDMetadata = 0; +EXPORT(signed short) primitiveSetMenuItemHierarchicalIDMetadata = 0; +EXPORT(signed short) primitiveSetMenuItemKeyGlyphMetadata = 0; +EXPORT(signed short) primitiveSetMenuItemModifiersMetadata = 0; +EXPORT(signed short) primitiveSetMenuItemTextMetadata = 0; +EXPORT(signed short) primitiveSetMenuItemTextEncodingMetadata = 0; +EXPORT(signed short) primitiveSetMenuTitleMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c b/src/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c index 32a9bcd844..3c769be7a7 100644 --- a/src/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c +++ b/src/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - Matrix2x3Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + Matrix2x3Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "Matrix2x3Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "Matrix2x3Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -107,7 +107,7 @@ extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePo extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "Matrix2x3Plugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "Matrix2x3Plugin VMMaker.oscog-eem.3024 " INT_EXT; static double m23ArgX; static double m23ArgY; static double m23ResultX; @@ -715,25 +715,27 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "Matrix2x3Plugin"; void* Matrix2x3Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveComposeMatrix\000\000", (void*)primitiveComposeMatrix}, - {(void*)_m, "primitiveInvertPoint\000\001", (void*)primitiveInvertPoint}, - {(void*)_m, "primitiveInvertRectInto\000\002", (void*)primitiveInvertRectInto}, - {(void*)_m, "primitiveIsIdentity\000\000", (void*)primitiveIsIdentity}, - {(void*)_m, "primitiveIsPureTranslation\000\000", (void*)primitiveIsPureTranslation}, - {(void*)_m, "primitiveTransformPoint\000\001", (void*)primitiveTransformPoint}, - {(void*)_m, "primitiveTransformRectInto\000\002", (void*)primitiveTransformRectInto}, + {(void*)_m, "primitiveComposeMatrix\000\000\000", (void*)primitiveComposeMatrix}, + {(void*)_m, "primitiveInvertPoint\000\001\000", (void*)primitiveInvertPoint}, + {(void*)_m, "primitiveInvertRectInto\000\002\000", (void*)primitiveInvertRectInto}, + {(void*)_m, "primitiveIsIdentity\000\000\000", (void*)primitiveIsIdentity}, + {(void*)_m, "primitiveIsPureTranslation\000\000\000", (void*)primitiveIsPureTranslation}, + {(void*)_m, "primitiveTransformPoint\000\001\000", (void*)primitiveTransformPoint}, + {(void*)_m, "primitiveTransformRectInto\000\002\000", (void*)primitiveTransformRectInto}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveComposeMatrixAccessorDepth = 0; -EXPORT(signed char) primitiveInvertPointAccessorDepth = 1; -EXPORT(signed char) primitiveInvertRectIntoAccessorDepth = 2; -EXPORT(signed char) primitiveIsIdentityAccessorDepth = 0; -EXPORT(signed char) primitiveIsPureTranslationAccessorDepth = 0; -EXPORT(signed char) primitiveTransformPointAccessorDepth = 1; -EXPORT(signed char) primitiveTransformRectIntoAccessorDepth = 2; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#if SPURVM +EXPORT(signed short) primitiveComposeMatrixMetadata = 0; +EXPORT(signed short) primitiveInvertPointMetadata = 0x100; +EXPORT(signed short) primitiveInvertRectIntoMetadata = 0x200; +EXPORT(signed short) primitiveIsIdentityMetadata = 0; +EXPORT(signed short) primitiveIsPureTranslationMetadata = 0; +EXPORT(signed short) primitiveTransformPointMetadata = 0x100; +EXPORT(signed short) primitiveTransformRectIntoMetadata = 0x200; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c b/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c index 00dca2e55e..20c34d937a 100644 --- a/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c +++ b/src/plugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - MiscPrimitivePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + MiscPrimitivePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -111,7 +111,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "MiscPrimitivePlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "MiscPrimitivePlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -824,28 +824,31 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "MiscPrimitivePlugin"; void* MiscPrimitivePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveCompareString\000\002", (void*)primitiveCompareString}, - {(void*)_m, "primitiveCompressToByteArray\000\377", (void*)primitiveCompressToByteArray}, - {(void*)_m, "primitiveConvert8BitSigned\000\002", (void*)primitiveConvert8BitSigned}, - {(void*)_m, "primitiveDecompressFromByteArray\000\000", (void*)primitiveDecompressFromByteArray}, - {(void*)_m, "primitiveFindFirstInString\000\002", (void*)primitiveFindFirstInString}, - {(void*)_m, "primitiveFindSubstring\000\002", (void*)primitiveFindSubstring}, - {(void*)_m, "primitiveIndexOfAsciiInString\000\002", (void*)primitiveIndexOfAsciiInString}, - {(void*)_m, "primitiveStringHash\000\001", (void*)primitiveStringHash}, - {(void*)_m, "primitiveTranslateStringWithTable\000\001", (void*)primitiveTranslateStringWithTable}, + {(void*)_m, "primitiveCompareString\000\002\001", (void*)primitiveCompareString}, + {(void*)_m, "primitiveCompressToByteArray\000\377\001", (void*)primitiveCompressToByteArray}, + {(void*)_m, "primitiveConvert8BitSigned\000\002\001", (void*)primitiveConvert8BitSigned}, + {(void*)_m, "primitiveDecompressFromByteArray\000\000\001", (void*)primitiveDecompressFromByteArray}, + {(void*)_m, "primitiveFindFirstInString\000\002\001", (void*)primitiveFindFirstInString}, + {(void*)_m, "primitiveFindSubstring\000\002\001", (void*)primitiveFindSubstring}, + {(void*)_m, "primitiveIndexOfAsciiInString\000\002\001", (void*)primitiveIndexOfAsciiInString}, + {(void*)_m, "primitiveStringHash\000\001\001", (void*)primitiveStringHash}, + {(void*)_m, "primitiveTranslateStringWithTable\000\001\001", (void*)primitiveTranslateStringWithTable}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveCompareStringAccessorDepth = 2; -EXPORT(signed char) primitiveConvert8BitSignedAccessorDepth = 2; -EXPORT(signed char) primitiveDecompressFromByteArrayAccessorDepth = 0; -EXPORT(signed char) primitiveFindFirstInStringAccessorDepth = 2; -EXPORT(signed char) primitiveFindSubstringAccessorDepth = 2; -EXPORT(signed char) primitiveIndexOfAsciiInStringAccessorDepth = 2; -EXPORT(signed char) primitiveStringHashAccessorDepth = 1; -EXPORT(signed char) primitiveTranslateStringWithTableAccessorDepth = 1; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveCompareStringMetadata = 513; +EXPORT(signed short) primitiveCompressToByteArrayMetadata = -255; +EXPORT(signed short) primitiveConvert8BitSignedMetadata = 513; +EXPORT(signed short) primitiveDecompressFromByteArrayMetadata = 1; +EXPORT(signed short) primitiveFindFirstInStringMetadata = 513; +EXPORT(signed short) primitiveFindSubstringMetadata = 513; +EXPORT(signed short) primitiveIndexOfAsciiInStringMetadata = 513; +EXPORT(signed short) primitiveStringHashMetadata = 0x101; +EXPORT(signed short) primitiveTranslateStringWithTableMetadata = 0x101; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c b/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c index 70e0945e19..cf22e03d15 100644 --- a/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c +++ b/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - Mpeg3Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + Mpeg3Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "Mpeg3Plugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "Mpeg3Plugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -150,7 +150,7 @@ extern #endif struct VirtualMachine* interpreterProxy; static sqInt maximumNumberOfFilesToWatch; -static const char *moduleName = "Mpeg3Plugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "Mpeg3Plugin VMMaker.oscog-eem.3024 " INT_EXT; static mpeg3_t *mpegFiles[1024+1]; @@ -249,14 +249,10 @@ primitiveMPEG3AudioChannels(void) sqInt result; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -298,14 +294,10 @@ primitiveMPEG3AudioSamples(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -347,13 +339,9 @@ primitiveMPEG3CheckSig(void) result = 0; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } path = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } sz = byteSizeOf(((sqInt)(sqIntptr_t)(path) - BaseHeaderSize)); ioFilenamefromStringofLengthresolveAliases(storage, path, sz, 1); result = mpeg3_check_sig(storage); @@ -378,9 +366,6 @@ primitiveMPEG3Close(void) mpeg3_t **index; fileHandle = stackValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -410,15 +395,11 @@ primitiveMPEG3DropFrames(void) result = 0; if (!((isIntegerObject((aFrameNumber = stackValue(1)))) && (isIntegerObject((aNumber = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(2); aFrameNumber = integerValueOf(aFrameNumber); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -457,14 +438,10 @@ primitiveMPEG3EndOfAudio(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -506,14 +483,10 @@ primitiveMPEG3EndOfVideo(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -554,14 +527,10 @@ primitiveMPEG3FrameRate(void) sqInt _return_value; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -607,16 +576,12 @@ primitiveMPEG3GenerateToc(void) if (!((isIntegerObject((timecode = stackValue(2)))) && ((isBooleanObject(stackValue(1))) && (isBytes(stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(3); timecode = integerValueOf(timecode); streams = booleanValueOf(stackValue(1)); aString = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -644,14 +609,10 @@ primitiveMPEG3GetFrame(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -693,14 +654,10 @@ primitiveMPEG3GetSample(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -740,9 +697,6 @@ primitiveMPEG3GetTime(void) sqInt _return_value; fileHandle = stackValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -771,9 +725,6 @@ primitiveMPEG3HasAudio(void) result = 0; fileHandle = stackValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -802,9 +753,6 @@ primitiveMPEG3HasVideo(void) result = 0; fileHandle = stackValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -833,13 +781,9 @@ primitiveMPEG3Open(void) sqInt sz; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } path = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } sz = byteSizeOf(((sqInt)(sqIntptr_t)(path) - BaseHeaderSize)); ioFilenamefromStringofLengthresolveAliases(storage, path, sz, 1); mpeg3Oop = instantiateClassindexableSize(classByteArray(), 4); @@ -862,14 +806,10 @@ primitiveMPEG3OpenABuffer(void) if (!((isBytes(stackValue(1))) && (isIntegerObject((size = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } path = ((char *) (firstIndexableField(stackValue(1)))); size = integerValueOf(size); - if (failed()) { - return null; - } mpeg3Oop = instantiateClassindexableSize(classByteArray(), 4); index = ((mpeg3_t **) (firstIndexableField(mpeg3Oop))); *index = mpeg3_open(path,size); makeFileEntry(*index); @@ -893,14 +833,10 @@ primitiveMPEG3PreviousFrame(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (aNumber < 0) { success(0); @@ -949,17 +885,13 @@ primitiveMPEG3ReadAudio(void) && ((isIntegerObject((aChannelNumber = stackValue(2)))) && ((isIntegerObject((aSampleNumber = stackValue(1)))) && (isIntegerObject((aNumber = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(4); anArray = ((unsigned *) (firstIndexableField(stackValue(3)))); aChannelNumber = integerValueOf(aChannelNumber); aSampleNumber = integerValueOf(aSampleNumber); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1031,8 +963,7 @@ primitiveMPEG3ReadFrame(void) && ((isIntegerObject((model = stackValue(2)))) && ((isIntegerObject((aNumber = stackValue(1)))) && (isIntegerObject((aByteNumber = stackValue(0)))))))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(10); aBuffer = ((unsigned *) (firstIndexableField(stackValue(9)))); @@ -1045,9 +976,6 @@ primitiveMPEG3ReadFrame(void) model = integerValueOf(model); aNumber = integerValueOf(aNumber); aByteNumber = integerValueOf(aByteNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1123,8 +1051,7 @@ primitiveMPEG3ReadFrameBufferOffset(void) && ((isIntegerObject((model = stackValue(2)))) && ((isIntegerObject((aNumber = stackValue(1)))) && (isIntegerObject((aByteNumber = stackValue(0))))))))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(11); aBuffer = ((unsigned *) (firstIndexableField(stackValue(10)))); @@ -1138,9 +1065,6 @@ primitiveMPEG3ReadFrameBufferOffset(void) model = integerValueOf(model); aNumber = integerValueOf(aNumber); aByteNumber = integerValueOf(aByteNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1196,17 +1120,13 @@ primitiveMPEG3ReReadAudio(void) && ((isIntegerObject((aChannelNumber = stackValue(2)))) && ((isIntegerObject((aSampleNumber = stackValue(1)))) && (isIntegerObject((aNumber = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(4); anArray = ((unsigned *) (firstIndexableField(stackValue(3)))); aChannelNumber = integerValueOf(aChannelNumber); aSampleNumber = integerValueOf(aSampleNumber); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1248,14 +1168,10 @@ primitiveMPEG3SampleRate(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1293,14 +1209,10 @@ primitiveMPEG3SeekPercentage(void) result = 0; if (!(isFloatObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = stackFloatValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (aNumber < 0.0) { success(0); @@ -1332,14 +1244,10 @@ primitiveMPEG3SetCpus(void) sqInt fileHandle; if (!(isIntegerObject((cpus = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); cpus = integerValueOf(cpus); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (cpus < 0) { success(0); @@ -1371,15 +1279,11 @@ primitiveMPEG3SetFrame(void) result = 0; if (!((isFloatObject(stackValue(1))) && (isIntegerObject((aNumber = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(2); aFrameNumber = stackFloatValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1415,14 +1319,10 @@ primitiveMPEG3SetMmx(void) sqInt mmx; if (!(isBooleanObject(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); mmx = booleanValueOf(stackValue(0)); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -1450,15 +1350,11 @@ primitiveMPEG3SetSample(void) result = 0; if (!((isFloatObject(stackValue(1))) && (isIntegerObject((aNumber = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(2); aSampleNumber = stackFloatValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1499,9 +1395,6 @@ primitiveMPEG3TellPercentage(void) sqInt _return_value; fileHandle = stackValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -1529,9 +1422,6 @@ primitiveMPEG3TotalAStreams(void) result = 0; fileHandle = stackValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1557,9 +1447,6 @@ primitiveMPEG3TotalVStreams(void) result = 0; fileHandle = stackValue(0); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { return null; @@ -1586,14 +1473,10 @@ primitiveMPEG3VideoFrames(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1634,14 +1517,10 @@ primitiveMPEG3VideoHeight(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1679,14 +1558,10 @@ primitiveMPEG3VideoWidth(void) result = 0; if (!(isIntegerObject((aNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } fileHandle = stackValue(1); aNumber = integerValueOf(aNumber); - if (failed()) { - return null; - } file = mpeg3tValueOf(fileHandle); if (file == null) { methodReturnValue(0); @@ -1804,76 +1679,78 @@ static char _m[] = "Mpeg3Plugin"; void* Mpeg3Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveMPEG3AudioChannels\000\001", (void*)primitiveMPEG3AudioChannels}, - {(void*)_m, "primitiveMPEG3AudioSamples\000\001", (void*)primitiveMPEG3AudioSamples}, - {(void*)_m, "primitiveMPEG3CheckSig\000\377", (void*)primitiveMPEG3CheckSig}, - {(void*)_m, "primitiveMPEG3Close\000\001", (void*)primitiveMPEG3Close}, - {(void*)_m, "primitiveMPEG3DropFrames\000\001", (void*)primitiveMPEG3DropFrames}, - {(void*)_m, "primitiveMPEG3EndOfAudio\000\001", (void*)primitiveMPEG3EndOfAudio}, - {(void*)_m, "primitiveMPEG3EndOfVideo\000\001", (void*)primitiveMPEG3EndOfVideo}, - {(void*)_m, "primitiveMPEG3FrameRate\000\001", (void*)primitiveMPEG3FrameRate}, - {(void*)_m, "primitiveMPEG3GenerateToc\000\001", (void*)primitiveMPEG3GenerateToc}, - {(void*)_m, "primitiveMPEG3GetFrame\000\001", (void*)primitiveMPEG3GetFrame}, - {(void*)_m, "primitiveMPEG3GetSample\000\001", (void*)primitiveMPEG3GetSample}, - {(void*)_m, "primitiveMPEG3GetTime\000\001", (void*)primitiveMPEG3GetTime}, - {(void*)_m, "primitiveMPEG3HasAudio\000\001", (void*)primitiveMPEG3HasAudio}, - {(void*)_m, "primitiveMPEG3HasVideo\000\001", (void*)primitiveMPEG3HasVideo}, - {(void*)_m, "primitiveMPEG3Open\000\377", (void*)primitiveMPEG3Open}, - {(void*)_m, "primitiveMPEG3OpenABuffer\000\000", (void*)primitiveMPEG3OpenABuffer}, - {(void*)_m, "primitiveMPEG3PreviousFrame\000\001", (void*)primitiveMPEG3PreviousFrame}, - {(void*)_m, "primitiveMPEG3ReadAudio\000\001", (void*)primitiveMPEG3ReadAudio}, - {(void*)_m, "primitiveMPEG3ReadFrame\000\001", (void*)primitiveMPEG3ReadFrame}, - {(void*)_m, "primitiveMPEG3ReadFrameBufferOffset\000\001", (void*)primitiveMPEG3ReadFrameBufferOffset}, - {(void*)_m, "primitiveMPEG3ReReadAudio\000\001", (void*)primitiveMPEG3ReReadAudio}, - {(void*)_m, "primitiveMPEG3SampleRate\000\001", (void*)primitiveMPEG3SampleRate}, - {(void*)_m, "primitiveMPEG3SeekPercentage\000\001", (void*)primitiveMPEG3SeekPercentage}, - {(void*)_m, "primitiveMPEG3SetCpus\000\001", (void*)primitiveMPEG3SetCpus}, - {(void*)_m, "primitiveMPEG3SetFrame\000\001", (void*)primitiveMPEG3SetFrame}, - {(void*)_m, "primitiveMPEG3SetMmx\000\001", (void*)primitiveMPEG3SetMmx}, - {(void*)_m, "primitiveMPEG3SetSample\000\001", (void*)primitiveMPEG3SetSample}, - {(void*)_m, "primitiveMPEG3TellPercentage\000\001", (void*)primitiveMPEG3TellPercentage}, - {(void*)_m, "primitiveMPEG3TotalAStreams\000\001", (void*)primitiveMPEG3TotalAStreams}, - {(void*)_m, "primitiveMPEG3TotalVStreams\000\001", (void*)primitiveMPEG3TotalVStreams}, - {(void*)_m, "primitiveMPEG3VideoFrames\000\001", (void*)primitiveMPEG3VideoFrames}, - {(void*)_m, "primitiveMPEG3VideoHeight\000\001", (void*)primitiveMPEG3VideoHeight}, - {(void*)_m, "primitiveMPEG3VideoWidth\000\001", (void*)primitiveMPEG3VideoWidth}, + {(void*)_m, "primitiveMPEG3AudioChannels\000\001\000", (void*)primitiveMPEG3AudioChannels}, + {(void*)_m, "primitiveMPEG3AudioSamples\000\001\000", (void*)primitiveMPEG3AudioSamples}, + {(void*)_m, "primitiveMPEG3CheckSig\000\377\000", (void*)primitiveMPEG3CheckSig}, + {(void*)_m, "primitiveMPEG3Close\000\001\000", (void*)primitiveMPEG3Close}, + {(void*)_m, "primitiveMPEG3DropFrames\000\001\000", (void*)primitiveMPEG3DropFrames}, + {(void*)_m, "primitiveMPEG3EndOfAudio\000\001\000", (void*)primitiveMPEG3EndOfAudio}, + {(void*)_m, "primitiveMPEG3EndOfVideo\000\001\000", (void*)primitiveMPEG3EndOfVideo}, + {(void*)_m, "primitiveMPEG3FrameRate\000\001\000", (void*)primitiveMPEG3FrameRate}, + {(void*)_m, "primitiveMPEG3GenerateToc\000\001\000", (void*)primitiveMPEG3GenerateToc}, + {(void*)_m, "primitiveMPEG3GetFrame\000\001\000", (void*)primitiveMPEG3GetFrame}, + {(void*)_m, "primitiveMPEG3GetSample\000\001\000", (void*)primitiveMPEG3GetSample}, + {(void*)_m, "primitiveMPEG3GetTime\000\001\000", (void*)primitiveMPEG3GetTime}, + {(void*)_m, "primitiveMPEG3HasAudio\000\001\000", (void*)primitiveMPEG3HasAudio}, + {(void*)_m, "primitiveMPEG3HasVideo\000\001\000", (void*)primitiveMPEG3HasVideo}, + {(void*)_m, "primitiveMPEG3Open\000\377\000", (void*)primitiveMPEG3Open}, + {(void*)_m, "primitiveMPEG3OpenABuffer\000\000\000", (void*)primitiveMPEG3OpenABuffer}, + {(void*)_m, "primitiveMPEG3PreviousFrame\000\001\000", (void*)primitiveMPEG3PreviousFrame}, + {(void*)_m, "primitiveMPEG3ReadAudio\000\001\000", (void*)primitiveMPEG3ReadAudio}, + {(void*)_m, "primitiveMPEG3ReadFrame\000\001\000", (void*)primitiveMPEG3ReadFrame}, + {(void*)_m, "primitiveMPEG3ReadFrameBufferOffset\000\001\000", (void*)primitiveMPEG3ReadFrameBufferOffset}, + {(void*)_m, "primitiveMPEG3ReReadAudio\000\001\000", (void*)primitiveMPEG3ReReadAudio}, + {(void*)_m, "primitiveMPEG3SampleRate\000\001\000", (void*)primitiveMPEG3SampleRate}, + {(void*)_m, "primitiveMPEG3SeekPercentage\000\001\000", (void*)primitiveMPEG3SeekPercentage}, + {(void*)_m, "primitiveMPEG3SetCpus\000\001\000", (void*)primitiveMPEG3SetCpus}, + {(void*)_m, "primitiveMPEG3SetFrame\000\001\000", (void*)primitiveMPEG3SetFrame}, + {(void*)_m, "primitiveMPEG3SetMmx\000\001\000", (void*)primitiveMPEG3SetMmx}, + {(void*)_m, "primitiveMPEG3SetSample\000\001\000", (void*)primitiveMPEG3SetSample}, + {(void*)_m, "primitiveMPEG3TellPercentage\000\001\000", (void*)primitiveMPEG3TellPercentage}, + {(void*)_m, "primitiveMPEG3TotalAStreams\000\001\000", (void*)primitiveMPEG3TotalAStreams}, + {(void*)_m, "primitiveMPEG3TotalVStreams\000\001\000", (void*)primitiveMPEG3TotalVStreams}, + {(void*)_m, "primitiveMPEG3VideoFrames\000\001\000", (void*)primitiveMPEG3VideoFrames}, + {(void*)_m, "primitiveMPEG3VideoHeight\000\001\000", (void*)primitiveMPEG3VideoHeight}, + {(void*)_m, "primitiveMPEG3VideoWidth\000\001\000", (void*)primitiveMPEG3VideoWidth}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveMPEG3AudioChannelsAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3AudioSamplesAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3CloseAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3DropFramesAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3EndOfAudioAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3EndOfVideoAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3FrameRateAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3GenerateTocAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3GetFrameAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3GetSampleAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3GetTimeAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3HasAudioAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3HasVideoAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3OpenABufferAccessorDepth = 0; -EXPORT(signed char) primitiveMPEG3PreviousFrameAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3ReadAudioAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3ReadFrameAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3ReadFrameBufferOffsetAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3ReReadAudioAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3SampleRateAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3SeekPercentageAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3SetCpusAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3SetFrameAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3SetMmxAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3SetSampleAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3TellPercentageAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3TotalAStreamsAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3TotalVStreamsAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3VideoFramesAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3VideoHeightAccessorDepth = 1; -EXPORT(signed char) primitiveMPEG3VideoWidthAccessorDepth = 1; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveMPEG3AudioChannelsMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3AudioSamplesMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3CloseMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3DropFramesMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3EndOfAudioMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3EndOfVideoMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3FrameRateMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3GenerateTocMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3GetFrameMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3GetSampleMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3GetTimeMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3HasAudioMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3HasVideoMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3OpenABufferMetadata = 0; +EXPORT(signed short) primitiveMPEG3PreviousFrameMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3ReadAudioMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3ReadFrameMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3ReadFrameBufferOffsetMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3ReReadAudioMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3SampleRateMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3SeekPercentageMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3SetCpusMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3SetFrameMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3SetMmxMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3SetSampleMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3TellPercentageMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3TotalAStreamsMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3TotalVStreamsMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3VideoFramesMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3VideoHeightMetadata = 0x100; +EXPORT(signed short) primitiveMPEG3VideoWidthMetadata = 0x100; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/QuicktimePlugin/QuicktimePlugin.c b/src/plugins/QuicktimePlugin/QuicktimePlugin.c index be472cbd6b..f36fc954b6 100644 --- a/src/plugins/QuicktimePlugin/QuicktimePlugin.c +++ b/src/plugins/QuicktimePlugin/QuicktimePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - QuicktimePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + QuicktimePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "QuicktimePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "QuicktimePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -88,7 +88,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "QuicktimePlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "QuicktimePlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -132,13 +132,9 @@ primitiveClearFrameCompletedSemaphore(void) sqInt data; if (!(isIntegerObject((data = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } data = integerValueOf(data); - if (failed()) { - return null; - } stQuicktimeClearSemaphore(data); return null; } @@ -150,13 +146,9 @@ primitiveDestroyHandle(void) sqInt data; if (!(isIntegerObject((data = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } data = integerValueOf(data); - if (failed()) { - return null; - } stQuicktimeDestroy(data); return null; } @@ -168,13 +160,9 @@ primitiveDestroySurface(void) sqInt data; if (!(isIntegerObject((data = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } data = integerValueOf(data); - if (failed()) { - return null; - } stQuicktimeDestroySurface(data); return null; } @@ -188,14 +176,10 @@ primitiveSetFrameCompletedSemaphore(void) if (!((isIntegerObject((semaIndex = stackValue(1)))) && (isIntegerObject((data = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } semaIndex = integerValueOf(semaIndex); data = integerValueOf(data); - if (failed()) { - return null; - } stQuicktimeSetSemaphorefor(semaIndex, data); return null; } @@ -219,8 +203,7 @@ primitiveSetGWorldPtrOntoExistingSurface(void) && ((isIntegerObject((height = stackValue(3)))) && ((isIntegerObject((rowBytes = stackValue(2)))) && (isIntegerObject((depth = stackValue(1))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } surfaceID = integerValueOf(surfaceID); bitMapPtr = stackValue(5); @@ -229,9 +212,6 @@ primitiveSetGWorldPtrOntoExistingSurface(void) rowBytes = integerValueOf(rowBytes); depth = integerValueOf(depth); moviePtr = stackValue(0); - if (failed()) { - return null; - } buffer = ((char *) (positiveMachineIntegerValueOf(bitMapPtr))); movie = ((sqIntptr_t) (positiveMachineIntegerValueOf(moviePtr))); stQuicktimeSetToExistingSurfacegworldwidthheightrowBytesdepthmovie(surfaceID, buffer, width, height, rowBytes, depth, movie); @@ -260,8 +240,7 @@ primitiveSetGWorldPtrOntoSurface(void) && ((isIntegerObject((height = stackValue(3)))) && ((isIntegerObject((rowBytes = stackValue(2)))) && (isIntegerObject((depth = stackValue(1)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } bitMapPtr = stackValue(5); width = integerValueOf(width); @@ -269,9 +248,6 @@ primitiveSetGWorldPtrOntoSurface(void) rowBytes = integerValueOf(rowBytes); depth = integerValueOf(depth); moviePtr = stackValue(0); - if (failed()) { - return null; - } buffer = ((char *) (positiveMachineIntegerValueOf(bitMapPtr))); movie = ((sqIntptr_t) (positiveMachineIntegerValueOf(moviePtr))); results = stQuicktimeSetSurfacewidthheightrowBytesdepthmovie(buffer, width, height, rowBytes, depth, movie); @@ -330,23 +306,25 @@ void* QuicktimePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveClearFrameCompletedSemaphore\000\000", (void*)primitiveClearFrameCompletedSemaphore}, - {(void*)_m, "primitiveDestroyHandle\000\000", (void*)primitiveDestroyHandle}, - {(void*)_m, "primitiveDestroySurface\000\000", (void*)primitiveDestroySurface}, - {(void*)_m, "primitiveSetFrameCompletedSemaphore\000\000", (void*)primitiveSetFrameCompletedSemaphore}, - {(void*)_m, "primitiveSetGWorldPtrOntoExistingSurface\000\000", (void*)primitiveSetGWorldPtrOntoExistingSurface}, - {(void*)_m, "primitiveSetGWorldPtrOntoSurface\000\000", (void*)primitiveSetGWorldPtrOntoSurface}, + {(void*)_m, "primitiveClearFrameCompletedSemaphore\000\000\000", (void*)primitiveClearFrameCompletedSemaphore}, + {(void*)_m, "primitiveDestroyHandle\000\000\000", (void*)primitiveDestroyHandle}, + {(void*)_m, "primitiveDestroySurface\000\000\000", (void*)primitiveDestroySurface}, + {(void*)_m, "primitiveSetFrameCompletedSemaphore\000\000\000", (void*)primitiveSetFrameCompletedSemaphore}, + {(void*)_m, "primitiveSetGWorldPtrOntoExistingSurface\000\000\000", (void*)primitiveSetGWorldPtrOntoExistingSurface}, + {(void*)_m, "primitiveSetGWorldPtrOntoSurface\000\000\000", (void*)primitiveSetGWorldPtrOntoSurface}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveClearFrameCompletedSemaphoreAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyHandleAccessorDepth = 0; -EXPORT(signed char) primitiveDestroySurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveSetFrameCompletedSemaphoreAccessorDepth = 0; -EXPORT(signed char) primitiveSetGWorldPtrOntoExistingSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveSetGWorldPtrOntoSurfaceAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveClearFrameCompletedSemaphoreMetadata = 0; +EXPORT(signed short) primitiveDestroyHandleMetadata = 0; +EXPORT(signed short) primitiveDestroySurfaceMetadata = 0; +EXPORT(signed short) primitiveSetFrameCompletedSemaphoreMetadata = 0; +EXPORT(signed short) primitiveSetGWorldPtrOntoExistingSurfaceMetadata = 0; +EXPORT(signed short) primitiveSetGWorldPtrOntoSurfaceMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/RePlugin/RePlugin.c b/src/plugins/RePlugin/RePlugin.c index 04cf8b5a61..f17ecd82f7 100644 --- a/src/plugins/RePlugin/RePlugin.c +++ b/src/plugins/RePlugin/RePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2987 uuid: a04be31b-0684-47d9-8eab-044c097bce29 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - RePlugin VMMaker.oscog-eem.2987 uuid: a04be31b-0684-47d9-8eab-044c097bce29 + RePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "RePlugin VMMaker.oscog-eem.2987 uuid: a04be31b-0684-47d9-8eab-044c097bce29 " __DATE__ ; +static char __buildInfo[] = "RePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -112,7 +112,7 @@ extern #endif struct VirtualMachine* interpreterProxy; static sqInt matchFlags; -static const char *moduleName = "RePlugin VMMaker.oscog-eem.2987 " INT_EXT; +static const char *moduleName = "RePlugin VMMaker.oscog-eem.3024 " INT_EXT; static sqInt patternStr; static const char * patternStrPtr; static sqInt pcrePtr; @@ -614,23 +614,23 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "RePlugin"; void* RePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primLastAlloc\000\377", (void*)primLastAlloc}, - {(void*)_m, "primNetMemory\000\377", (void*)primNetMemory}, - {(void*)_m, "primNumAllocs\000\377", (void*)primNumAllocs}, - {(void*)_m, "primNumFrees\000\377", (void*)primNumFrees}, - {(void*)_m, "primPCRECompile\000\000", (void*)primPCRECompile}, - {(void*)_m, "primPCREExec\000\001", (void*)primPCREExec}, - {(void*)_m, "primPCREExecfromto\000\001", (void*)primPCREExecfromto}, - {(void*)_m, "primPCRENumSubPatterns\000\000", (void*)primPCRENumSubPatterns}, + {(void*)_m, "primLastAlloc\000\377\000", (void*)primLastAlloc}, + {(void*)_m, "primNetMemory\000\377\000", (void*)primNetMemory}, + {(void*)_m, "primNumAllocs\000\377\000", (void*)primNumAllocs}, + {(void*)_m, "primNumFrees\000\377\000", (void*)primNumFrees}, + {(void*)_m, "primPCRECompile\000\377\000", (void*)primPCRECompile}, + {(void*)_m, "primPCREExec\000\001\000", (void*)primPCREExec}, + {(void*)_m, "primPCREExecfromto\000\001\000", (void*)primPCREExecfromto}, + {(void*)_m, "primPCRENumSubPatterns\000\377\000", (void*)primPCRENumSubPatterns}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primPCRECompileAccessorDepth = 0; -EXPORT(signed char) primPCREExecAccessorDepth = 1; -EXPORT(signed char) primPCREExecfromtoAccessorDepth = 1; -EXPORT(signed char) primPCRENumSubPatternsAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primPCREExecMetadata = 0x100; +EXPORT(signed short) primPCREExecfromtoMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SHA2Plugin/SHA2Plugin.c b/src/plugins/SHA2Plugin/SHA2Plugin.c index 906cf04c39..3e6e10584b 100644 --- a/src/plugins/SHA2Plugin/SHA2Plugin.c +++ b/src/plugins/SHA2Plugin/SHA2Plugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SHA2Plugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee + SHA2Plugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d */ -static char __buildInfo[] = "SHA2Plugin CryptographyPlugins-ul.22 uuid: 1308f614-8494-46ef-bffd-21a70d1f8dee " __DATE__ ; +static char __buildInfo[] = "SHA2Plugin CryptographyPlugins-eem.23 uuid: bc8a8db4-2e4d-458f-bac9-f007458fdd4d " __DATE__ ; #include "config.h" @@ -80,7 +80,7 @@ extern sqInt stackObjectValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SHA2Plugin CryptographyPlugins-ul.22 " INT_EXT; +static const char *moduleName = "SHA2Plugin CryptographyPlugins-eem.23 " INT_EXT; static const unsigned int sha256k[] = { /*0*/ 1116352408, 1899447441, 3049323471U, 3921009573U, 961987163, 0x59F111F1, 2453635748U, /*7*/ 2870763221U, 0xD807AA98U, 310598401, 607225278, 1426881987, 1925078388, 2162078206U, @@ -473,20 +473,23 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "SHA2Plugin"; void* SHA2Plugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveCopyDoubleWordsIntoBytesBigEndian\000\001", (void*)primitiveCopyDoubleWordsIntoBytesBigEndian}, - {(void*)_m, "primitiveCopyWordsIntoBytesBigEndian\000\001", (void*)primitiveCopyWordsIntoBytesBigEndian}, - {(void*)_m, "primitiveIsPluginAvailable\000\377", (void*)primitiveIsPluginAvailable}, - {(void*)_m, "primitiveSHA256ProcessBufferUpdatingHash\000\001", (void*)primitiveSHA256ProcessBufferUpdatingHash}, - {(void*)_m, "primitiveSHA512ProcessBufferUpdatingHash\000\001", (void*)primitiveSHA512ProcessBufferUpdatingHash}, + {(void*)_m, "primitiveCopyDoubleWordsIntoBytesBigEndian\000\001\001", (void*)primitiveCopyDoubleWordsIntoBytesBigEndian}, + {(void*)_m, "primitiveCopyWordsIntoBytesBigEndian\000\001\001", (void*)primitiveCopyWordsIntoBytesBigEndian}, + {(void*)_m, "primitiveIsPluginAvailable\000\377\001", (void*)primitiveIsPluginAvailable}, + {(void*)_m, "primitiveSHA256ProcessBufferUpdatingHash\000\001\001", (void*)primitiveSHA256ProcessBufferUpdatingHash}, + {(void*)_m, "primitiveSHA512ProcessBufferUpdatingHash\000\001\001", (void*)primitiveSHA512ProcessBufferUpdatingHash}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveCopyDoubleWordsIntoBytesBigEndianAccessorDepth = 1; -EXPORT(signed char) primitiveCopyWordsIntoBytesBigEndianAccessorDepth = 1; -EXPORT(signed char) primitiveSHA256ProcessBufferUpdatingHashAccessorDepth = 1; -EXPORT(signed char) primitiveSHA512ProcessBufferUpdatingHashAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveCopyDoubleWordsIntoBytesBigEndianMetadata = 0x101; +EXPORT(signed short) primitiveCopyWordsIntoBytesBigEndianMetadata = 0x101; +EXPORT(signed short) primitiveIsPluginAvailableMetadata = -255; +EXPORT(signed short) primitiveSHA256ProcessBufferUpdatingHashMetadata = 0x101; +EXPORT(signed short) primitiveSHA512ProcessBufferUpdatingHashMetadata = 0x101; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/ScratchPlugin/ScratchPlugin.c b/src/plugins/ScratchPlugin/ScratchPlugin.c index fb71dea8a4..8d54f55856 100644 --- a/src/plugins/ScratchPlugin/ScratchPlugin.c +++ b/src/plugins/ScratchPlugin/ScratchPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - ScratchPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + ScratchPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "ScratchPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "ScratchPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -115,7 +115,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ScratchPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "ScratchPlugin VMMaker.oscog-eem.3024 " INT_EXT; /* ScratchPlugin>>#bitmap:at:putH:s:v: */ @@ -2697,68 +2697,70 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "ScratchPlugin"; void* ScratchPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primClose\000\000", (void*)primClose}, - {(void*)_m, "primGetOption\000\000", (void*)primGetOption}, - {(void*)_m, "primIsPortOpen\000\000", (void*)primIsPortOpen}, - {(void*)_m, "primitiveBlur\000\000", (void*)primitiveBlur}, - {(void*)_m, "primitiveBrightnessShift\000\000", (void*)primitiveBrightnessShift}, - {(void*)_m, "primitiveCondenseSound\000\000", (void*)primitiveCondenseSound}, - {(void*)_m, "primitiveDoubleSize\000\000", (void*)primitiveDoubleSize}, - {(void*)_m, "primitiveExtractChannel\000\000", (void*)primitiveExtractChannel}, - {(void*)_m, "primitiveFisheye\000\000", (void*)primitiveFisheye}, - {(void*)_m, "primitiveGetFolderPath\000\000", (void*)primitiveGetFolderPath}, - {(void*)_m, "primitiveHalfSizeAverage\000\000", (void*)primitiveHalfSizeAverage}, - {(void*)_m, "primitiveHalfSizeDiagonal\000\000", (void*)primitiveHalfSizeDiagonal}, - {(void*)_m, "primitiveHueShift\000\000", (void*)primitiveHueShift}, - {(void*)_m, "primitiveInterpolate\000\000", (void*)primitiveInterpolate}, - {(void*)_m, "primitiveIsHidden\000\000", (void*)primitiveIsHidden}, - {(void*)_m, "primitiveOpenURL\000\000", (void*)primitiveOpenURL}, - {(void*)_m, "primitiveSaturationShift\000\000", (void*)primitiveSaturationShift}, - {(void*)_m, "primitiveScale\000\000", (void*)primitiveScale}, - {(void*)_m, "primitiveSetUnicodePasteBuffer\000\000", (void*)primitiveSetUnicodePasteBuffer}, - {(void*)_m, "primitiveSetWindowTitle\000\000", (void*)primitiveSetWindowTitle}, - {(void*)_m, "primitiveShortToLongPath\000\000", (void*)primitiveShortToLongPath}, - {(void*)_m, "primitiveWaterRipples1\000\000", (void*)primitiveWaterRipples1}, - {(void*)_m, "primitiveWhirl\000\000", (void*)primitiveWhirl}, - {(void*)_m, "primOpenPortNamed\000\000", (void*)primOpenPortNamed}, - {(void*)_m, "primPortCount\000\377", (void*)primPortCount}, - {(void*)_m, "primPortName\000\000", (void*)primPortName}, - {(void*)_m, "primRead\000\000", (void*)primRead}, - {(void*)_m, "primSetOption\000\000", (void*)primSetOption}, - {(void*)_m, "primWrite\000\000", (void*)primWrite}, + {(void*)_m, "primClose\000\000\000", (void*)primClose}, + {(void*)_m, "primGetOption\000\000\000", (void*)primGetOption}, + {(void*)_m, "primIsPortOpen\000\000\000", (void*)primIsPortOpen}, + {(void*)_m, "primitiveBlur\000\001\000", (void*)primitiveBlur}, + {(void*)_m, "primitiveBrightnessShift\000\001\000", (void*)primitiveBrightnessShift}, + {(void*)_m, "primitiveCondenseSound\000\000\000", (void*)primitiveCondenseSound}, + {(void*)_m, "primitiveDoubleSize\000\001\000", (void*)primitiveDoubleSize}, + {(void*)_m, "primitiveExtractChannel\000\000\000", (void*)primitiveExtractChannel}, + {(void*)_m, "primitiveFisheye\000\002\000", (void*)primitiveFisheye}, + {(void*)_m, "primitiveGetFolderPath\000\000\000", (void*)primitiveGetFolderPath}, + {(void*)_m, "primitiveHalfSizeAverage\000\000\000", (void*)primitiveHalfSizeAverage}, + {(void*)_m, "primitiveHalfSizeDiagonal\000\000\000", (void*)primitiveHalfSizeDiagonal}, + {(void*)_m, "primitiveHueShift\000\001\000", (void*)primitiveHueShift}, + {(void*)_m, "primitiveInterpolate\000\002\000", (void*)primitiveInterpolate}, + {(void*)_m, "primitiveIsHidden\000\000\000", (void*)primitiveIsHidden}, + {(void*)_m, "primitiveOpenURL\000\000\000", (void*)primitiveOpenURL}, + {(void*)_m, "primitiveSaturationShift\000\001\000", (void*)primitiveSaturationShift}, + {(void*)_m, "primitiveScale\000\001\000", (void*)primitiveScale}, + {(void*)_m, "primitiveSetUnicodePasteBuffer\000\000\000", (void*)primitiveSetUnicodePasteBuffer}, + {(void*)_m, "primitiveSetWindowTitle\000\000\000", (void*)primitiveSetWindowTitle}, + {(void*)_m, "primitiveShortToLongPath\000\000\000", (void*)primitiveShortToLongPath}, + {(void*)_m, "primitiveWaterRipples1\000\001\000", (void*)primitiveWaterRipples1}, + {(void*)_m, "primitiveWhirl\000\002\000", (void*)primitiveWhirl}, + {(void*)_m, "primOpenPortNamed\000\000\000", (void*)primOpenPortNamed}, + {(void*)_m, "primPortCount\000\377\000", (void*)primPortCount}, + {(void*)_m, "primPortName\000\000\000", (void*)primPortName}, + {(void*)_m, "primRead\000\000\000", (void*)primRead}, + {(void*)_m, "primSetOption\000\000\000", (void*)primSetOption}, + {(void*)_m, "primWrite\000\000\000", (void*)primWrite}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primCloseAccessorDepth = 0; -EXPORT(signed char) primGetOptionAccessorDepth = 0; -EXPORT(signed char) primIsPortOpenAccessorDepth = 0; -EXPORT(signed char) primitiveBlurAccessorDepth = 0; -EXPORT(signed char) primitiveBrightnessShiftAccessorDepth = 0; -EXPORT(signed char) primitiveCondenseSoundAccessorDepth = 0; -EXPORT(signed char) primitiveDoubleSizeAccessorDepth = 0; -EXPORT(signed char) primitiveExtractChannelAccessorDepth = 0; -EXPORT(signed char) primitiveFisheyeAccessorDepth = 0; -EXPORT(signed char) primitiveGetFolderPathAccessorDepth = 0; -EXPORT(signed char) primitiveHalfSizeAverageAccessorDepth = 0; -EXPORT(signed char) primitiveHalfSizeDiagonalAccessorDepth = 0; -EXPORT(signed char) primitiveHueShiftAccessorDepth = 0; -EXPORT(signed char) primitiveInterpolateAccessorDepth = 0; -EXPORT(signed char) primitiveIsHiddenAccessorDepth = 0; -EXPORT(signed char) primitiveOpenURLAccessorDepth = 0; -EXPORT(signed char) primitiveSaturationShiftAccessorDepth = 0; -EXPORT(signed char) primitiveScaleAccessorDepth = 0; -EXPORT(signed char) primitiveSetUnicodePasteBufferAccessorDepth = 0; -EXPORT(signed char) primitiveSetWindowTitleAccessorDepth = 0; -EXPORT(signed char) primitiveShortToLongPathAccessorDepth = 0; -EXPORT(signed char) primitiveWaterRipples1AccessorDepth = 0; -EXPORT(signed char) primitiveWhirlAccessorDepth = 0; -EXPORT(signed char) primOpenPortNamedAccessorDepth = 0; -EXPORT(signed char) primPortNameAccessorDepth = 0; -EXPORT(signed char) primReadAccessorDepth = 0; -EXPORT(signed char) primSetOptionAccessorDepth = 0; -EXPORT(signed char) primWriteAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primCloseMetadata = 0; +EXPORT(signed short) primGetOptionMetadata = 0; +EXPORT(signed short) primIsPortOpenMetadata = 0; +EXPORT(signed short) primitiveBlurMetadata = 0x100; +EXPORT(signed short) primitiveBrightnessShiftMetadata = 0x100; +EXPORT(signed short) primitiveCondenseSoundMetadata = 0; +EXPORT(signed short) primitiveDoubleSizeMetadata = 0x100; +EXPORT(signed short) primitiveExtractChannelMetadata = 0; +EXPORT(signed short) primitiveFisheyeMetadata = 0x200; +EXPORT(signed short) primitiveGetFolderPathMetadata = 0; +EXPORT(signed short) primitiveHalfSizeAverageMetadata = 0; +EXPORT(signed short) primitiveHalfSizeDiagonalMetadata = 0; +EXPORT(signed short) primitiveHueShiftMetadata = 0x100; +EXPORT(signed short) primitiveInterpolateMetadata = 0x200; +EXPORT(signed short) primitiveIsHiddenMetadata = 0; +EXPORT(signed short) primitiveOpenURLMetadata = 0; +EXPORT(signed short) primitiveSaturationShiftMetadata = 0x100; +EXPORT(signed short) primitiveScaleMetadata = 0x100; +EXPORT(signed short) primitiveSetUnicodePasteBufferMetadata = 0; +EXPORT(signed short) primitiveSetWindowTitleMetadata = 0; +EXPORT(signed short) primitiveShortToLongPathMetadata = 0; +EXPORT(signed short) primitiveWaterRipples1Metadata = 0x100; +EXPORT(signed short) primitiveWhirlMetadata = 0x200; +EXPORT(signed short) primOpenPortNamedMetadata = 0; +EXPORT(signed short) primPortNameMetadata = 0; +EXPORT(signed short) primReadMetadata = 0; +EXPORT(signed short) primSetOptionMetadata = 0; +EXPORT(signed short) primWriteMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SecurityPlugin/SecurityPlugin.c b/src/plugins/SecurityPlugin/SecurityPlugin.c index 7c7fec40b9..8157daa2e9 100644 --- a/src/plugins/SecurityPlugin/SecurityPlugin.c +++ b/src/plugins/SecurityPlugin/SecurityPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SecurityPlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + SecurityPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "SecurityPlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 " __DATE__ ; +static char __buildInfo[] = "SecurityPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -76,7 +76,7 @@ extern sqInt methodReturnString(char *aCString); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SecurityPlugin VMMaker.oscog-eem.2944 " INT_EXT; +static const char *moduleName = "SecurityPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -313,10 +313,10 @@ static char _m[] = "SecurityPlugin"; void* SecurityPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveCanWriteImage\000\377", (void*)primitiveCanWriteImage}, - {(void*)_m, "primitiveDisableImageWrite\000\377", (void*)primitiveDisableImageWrite}, - {(void*)_m, "primitiveGetSecureUserDirectory\000\377", (void*)primitiveGetSecureUserDirectory}, - {(void*)_m, "primitiveGetUntrustedUserDirectory\000\377", (void*)primitiveGetUntrustedUserDirectory}, + {(void*)_m, "primitiveCanWriteImage\000\377\000", (void*)primitiveCanWriteImage}, + {(void*)_m, "primitiveDisableImageWrite\000\377\000", (void*)primitiveDisableImageWrite}, + {(void*)_m, "primitiveGetSecureUserDirectory\000\377\000", (void*)primitiveGetSecureUserDirectory}, + {(void*)_m, "primitiveGetUntrustedUserDirectory\000\377\000", (void*)primitiveGetUntrustedUserDirectory}, {(void*)_m, "secCanConnectToPort", (void*)secCanConnectToPort}, {(void*)_m, "secCanCreatePathOfSize", (void*)secCanCreatePathOfSize}, {(void*)_m, "secCanCreateSocketOfType", (void*)secCanCreateSocketOfType}, @@ -327,20 +327,22 @@ void* SecurityPlugin_exports[][3] = { {(void*)_m, "secCanOpenAsyncFileOfSizeWritable", (void*)secCanOpenAsyncFileOfSizeWritable}, {(void*)_m, "secCanOpenFileOfSizeWritable", (void*)secCanOpenFileOfSizeWritable}, {(void*)_m, "secCanRenameFileOfSize", (void*)secCanRenameFileOfSize}, - {(void*)_m, "secCanRenameImage\000\377", (void*)secCanRenameImage}, + {(void*)_m, "secCanRenameImage", (void*)secCanRenameImage}, {(void*)_m, "secCanSetFileTypeOfSize", (void*)secCanSetFileTypeOfSize}, - {(void*)_m, "secCanWriteImage\000\377", (void*)secCanWriteImage}, + {(void*)_m, "secCanWriteImage", (void*)secCanWriteImage}, {(void*)_m, "secCanListenOnPort", (void*)secCanListenOnPort}, - {(void*)_m, "secDisableFileAccess\000\377", (void*)secDisableFileAccess}, - {(void*)_m, "secDisableSocketAccess\000\377", (void*)secDisableSocketAccess}, - {(void*)_m, "secHasEnvironmentAccess\000\377", (void*)secHasEnvironmentAccess}, - {(void*)_m, "secHasFileAccess\000\377", (void*)secHasFileAccess}, - {(void*)_m, "secHasSocketAccess\000\377", (void*)secHasSocketAccess}, + {(void*)_m, "secDisableFileAccess", (void*)secDisableFileAccess}, + {(void*)_m, "secDisableSocketAccess", (void*)secDisableSocketAccess}, + {(void*)_m, "secHasEnvironmentAccess", (void*)secHasEnvironmentAccess}, + {(void*)_m, "secHasFileAccess", (void*)secHasFileAccess}, + {(void*)_m, "secHasSocketAccess", (void*)secHasSocketAccess}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN +#if SPURVM +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SerialPlugin/SerialPlugin.c b/src/plugins/SerialPlugin/SerialPlugin.c index 298f9da4d8..abf4859977 100644 --- a/src/plugins/SerialPlugin/SerialPlugin.c +++ b/src/plugins/SerialPlugin/SerialPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SerialPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SerialPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "SerialPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "SerialPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -92,7 +92,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SerialPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "SerialPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -122,13 +122,9 @@ primitiveSerialPortClose(void) sqInt portNum; if (!(isIntegerObject((portNum = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); - if (failed()) { - return null; - } serialPortClose(portNum); if (!(failed())) { pop(1); @@ -146,13 +142,9 @@ primitiveSerialPortCloseByName(void) sqInt portNameSize; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portName = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } /* begin copyPortNameToCString: */ portNameSize = slotSizeOf(((sqInt)((portName) - BaseHeaderSize))); port1 = alloca(portNameSize + 1); @@ -189,8 +181,7 @@ primitiveSerialPortOpen(void) && ((isIntegerObject((outFlowControl = stackValue(2)))) && ((isIntegerObject((xOnChar = stackValue(1)))) && (isIntegerObject((xOffChar = stackValue(0))))))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); baudRate = integerValueOf(baudRate); @@ -201,9 +192,6 @@ primitiveSerialPortOpen(void) outFlowControl = integerValueOf(outFlowControl); xOnChar = integerValueOf(xOnChar); xOffChar = integerValueOf(xOffChar); - if (failed()) { - return null; - } serialPortOpen(portNum, baudRate, stopBitsType, parityType, dataBits, inFlowControl, outFlowControl, xOnChar, xOffChar); if (!(failed())) { pop(9); @@ -237,8 +225,7 @@ primitiveSerialPortOpenByName(void) && ((isIntegerObject((outFlowControl = stackValue(2)))) && ((isIntegerObject((xOnChar = stackValue(1)))) && (isIntegerObject((xOffChar = stackValue(0))))))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portName = ((char *) (firstIndexableField(stackValue(8)))); baudRate = integerValueOf(baudRate); @@ -249,9 +236,6 @@ primitiveSerialPortOpenByName(void) outFlowControl = integerValueOf(outFlowControl); xOnChar = integerValueOf(xOnChar); xOffChar = integerValueOf(xOffChar); - if (failed()) { - return null; - } /* begin copyPortNameToCString: */ portNameSize = slotSizeOf(((sqInt)((portName) - BaseHeaderSize))); port1 = alloca(portNameSize + 1); @@ -279,16 +263,12 @@ primitiveSerialPortRead(void) && ((isBytes(stackValue(2))) && ((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); array = ((char *) (firstIndexableField(stackValue(2)))); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } if ((startIndex >= 1) && (((startIndex + count) - 1) <= (byteSizeOf(((sqInt)(sqIntptr_t)(array) - BaseHeaderSize))))) { bytesRead = serialPortReadInto(portNum, count, (array + startIndex) - 1); @@ -321,16 +301,12 @@ primitiveSerialPortReadByName(void) && ((isBytes(stackValue(2))) && ((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portName = ((char *) (firstIndexableField(stackValue(3)))); array = ((char *) (firstIndexableField(stackValue(2)))); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } if ((startIndex >= 1) && (((startIndex + count) - 1) <= (byteSizeOf(((sqInt)(sqIntptr_t)(array) - BaseHeaderSize))))) { /* begin copyPortNameToCString: */ @@ -366,16 +342,12 @@ primitiveSerialPortWrite(void) && ((isBytes(stackValue(2))) && ((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNum = integerValueOf(portNum); array = ((char *) (firstIndexableField(stackValue(2)))); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } if ((startIndex >= 1) && (((startIndex + count) - 1) <= (byteSizeOf(((sqInt)(sqIntptr_t)(array) - BaseHeaderSize))))) { bytesWritten = serialPortWriteFrom(portNum, count, (array + startIndex) - 1); @@ -408,16 +380,12 @@ primitiveSerialPortWriteByName(void) && ((isBytes(stackValue(2))) && ((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portName = ((char *) (firstIndexableField(stackValue(3)))); array = ((char *) (firstIndexableField(stackValue(2)))); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } if ((startIndex >= 1) && (((startIndex + count) - 1) <= (byteSizeOf(((sqInt)(sqIntptr_t)(array) - BaseHeaderSize))))) { /* begin copyPortNameToCString: */ @@ -492,27 +460,29 @@ static char _m[] = "SerialPlugin"; void* SerialPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveSerialPortClose\000\000", (void*)primitiveSerialPortClose}, - {(void*)_m, "primitiveSerialPortCloseByName\000\377", (void*)primitiveSerialPortCloseByName}, - {(void*)_m, "primitiveSerialPortOpen\000\000", (void*)primitiveSerialPortOpen}, - {(void*)_m, "primitiveSerialPortOpenByName\000\000", (void*)primitiveSerialPortOpenByName}, - {(void*)_m, "primitiveSerialPortRead\000\000", (void*)primitiveSerialPortRead}, - {(void*)_m, "primitiveSerialPortReadByName\000\000", (void*)primitiveSerialPortReadByName}, - {(void*)_m, "primitiveSerialPortWrite\000\000", (void*)primitiveSerialPortWrite}, - {(void*)_m, "primitiveSerialPortWriteByName\000\000", (void*)primitiveSerialPortWriteByName}, + {(void*)_m, "primitiveSerialPortClose\000\000\000", (void*)primitiveSerialPortClose}, + {(void*)_m, "primitiveSerialPortCloseByName\000\377\000", (void*)primitiveSerialPortCloseByName}, + {(void*)_m, "primitiveSerialPortOpen\000\000\000", (void*)primitiveSerialPortOpen}, + {(void*)_m, "primitiveSerialPortOpenByName\000\000\000", (void*)primitiveSerialPortOpenByName}, + {(void*)_m, "primitiveSerialPortRead\000\000\000", (void*)primitiveSerialPortRead}, + {(void*)_m, "primitiveSerialPortReadByName\000\000\000", (void*)primitiveSerialPortReadByName}, + {(void*)_m, "primitiveSerialPortWrite\000\000\000", (void*)primitiveSerialPortWrite}, + {(void*)_m, "primitiveSerialPortWriteByName\000\000\000", (void*)primitiveSerialPortWriteByName}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveSerialPortCloseAccessorDepth = 0; -EXPORT(signed char) primitiveSerialPortOpenAccessorDepth = 0; -EXPORT(signed char) primitiveSerialPortOpenByNameAccessorDepth = 0; -EXPORT(signed char) primitiveSerialPortReadAccessorDepth = 0; -EXPORT(signed char) primitiveSerialPortReadByNameAccessorDepth = 0; -EXPORT(signed char) primitiveSerialPortWriteAccessorDepth = 0; -EXPORT(signed char) primitiveSerialPortWriteByNameAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveSerialPortCloseMetadata = 0; +EXPORT(signed short) primitiveSerialPortOpenMetadata = 0; +EXPORT(signed short) primitiveSerialPortOpenByNameMetadata = 0; +EXPORT(signed short) primitiveSerialPortReadMetadata = 0; +EXPORT(signed short) primitiveSerialPortReadByNameMetadata = 0; +EXPORT(signed short) primitiveSerialPortWriteMetadata = 0; +EXPORT(signed short) primitiveSerialPortWriteByNameMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SocketPlugin/SocketPlugin.c b/src/plugins/SocketPlugin/SocketPlugin.c index 136f06f8d4..589a596f50 100644 --- a/src/plugins/SocketPlugin/SocketPlugin.c +++ b/src/plugins/SocketPlugin/SocketPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SocketPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SocketPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -191,7 +191,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SocketPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "SocketPlugin VMMaker.oscog-eem.3024 " INT_EXT; static void * sCCLOPfn; static void * sCCSOTfn; static void * sCCTPfn; @@ -292,13 +292,9 @@ primitiveInitializeNetwork(void) sqInt resolverSemaIndex; if (!(isIntegerObject((resolverSemaIndex = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } resolverSemaIndex = integerValueOf(resolverSemaIndex); - if (failed()) { - return null; - } err = sqNetworkInit(resolverSemaIndex); success(err == 0); if (!(failed())) { @@ -361,8 +357,7 @@ primitiveResolverGetAddressInfo(void) && ((isIntegerObject((family = stackValue(2)))) && ((isIntegerObject((type = stackValue(1)))) && (isIntegerObject((protocol = stackValue(0)))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } hostName = ((char *) (firstIndexableField(stackValue(5)))); servName = ((char *) (firstIndexableField(stackValue(4)))); @@ -370,9 +365,6 @@ primitiveResolverGetAddressInfo(void) family = integerValueOf(family); type = integerValueOf(type); protocol = integerValueOf(protocol); - if (failed()) { - return null; - } if (!(failed())) { hostSize = byteSizeOf(((sqInt)(sqIntptr_t)(hostName) - BaseHeaderSize)); servSize = byteSizeOf(((sqInt)(sqIntptr_t)(servName) - BaseHeaderSize)); @@ -440,13 +432,9 @@ primitiveResolverGetAddressInfoResult(void) char *socketAddress; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socketAddress = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!(failed())) { addrSize = byteSizeOf(((sqInt)(sqIntptr_t)(socketAddress) - BaseHeaderSize)); sqResolverGetAddressInfoResultSize(socketAddress, addrSize); @@ -499,14 +487,10 @@ primitiveResolverGetNameInfo(void) sqInt socketAddress; if (!(isIntegerObject((flags = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socketAddress = stackValue(1); flags = integerValueOf(flags); - if (failed()) { - return null; - } if (!(failed())) { addrSize = byteSizeOf(socketAddress); addrBase = ((char *) (firstIndexableField(socketAddress))); @@ -526,13 +510,9 @@ primitiveResolverGetNameInfoHostResult(void) char *socketName; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socketName = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!(failed())) { addrSize = byteSizeOf(((sqInt)(sqIntptr_t)(socketName) - BaseHeaderSize)); sqResolverGetNameInfoHostResultSize(socketName, addrSize); @@ -567,13 +547,9 @@ primitiveResolverGetNameInfoServiceResult(void) char *socketName; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socketName = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!(failed())) { addrSize = byteSizeOf(((sqInt)(sqIntptr_t)(socketName) - BaseHeaderSize)); sqResolverGetNameInfoServiceResultSize(socketName, addrSize); @@ -608,13 +584,9 @@ primitiveResolverHostNameResult(void) char *nameString; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } nameString = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!(failed())) { nameSize = byteSizeOf(((sqInt)(sqIntptr_t)(nameString) - BaseHeaderSize)); sqResolverHostNameResultSize(nameString, nameSize); @@ -684,13 +656,9 @@ primitiveResolverStartAddressLookup(void) sqInt sz; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } address = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } /* begin netAddressToInt: */ sz = byteSizeOf(((sqInt)(sqIntptr_t)((((unsigned char *) address))) - BaseHeaderSize)); if (!(sz == 4)) { @@ -716,13 +684,9 @@ primitiveResolverStartNameLookup(void) sqInt sz; if (!(isBytes(stackValue(0)))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } name = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (!(failed())) { sz = byteSizeOf(((sqInt)(sqIntptr_t)(name) - BaseHeaderSize)); sqResolverStartNameLookup(name, sz); @@ -754,9 +718,6 @@ primitiveSocketAbortConnection(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -790,16 +751,12 @@ primitiveSocketAccept(void) if (!((isIntegerObject((recvBufSize = stackValue(2)))) && ((isIntegerObject((sendBufSize = stackValue(1)))) && (isIntegerObject((semaIndex = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } sockHandle = stackValue(3); recvBufSize = integerValueOf(recvBufSize); sendBufSize = integerValueOf(sendBufSize); semaIndex = integerValueOf(semaIndex); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(sockHandle)) && ((byteSizeOf(sockHandle)) == (sizeof(SQSocket)))) { @@ -853,8 +810,7 @@ primitiveSocketAccept3Semaphores(void) && ((isIntegerObject((semaIndex = stackValue(2)))) && ((isIntegerObject((aReadSema = stackValue(1)))) && (isIntegerObject((aWriteSema = stackValue(0))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } sockHandle = stackValue(5); recvBufSize = integerValueOf(recvBufSize); @@ -862,9 +818,6 @@ primitiveSocketAccept3Semaphores(void) semaIndex = integerValueOf(semaIndex); aReadSema = integerValueOf(aReadSema); aWriteSema = integerValueOf(aWriteSema); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(sockHandle)) && ((byteSizeOf(sockHandle)) == (sizeof(SQSocket)))) { @@ -909,9 +862,6 @@ primitiveSocketAddressGetPort(void) sqInt port; addr = stackValue(0); - if (failed()) { - return null; - } addrSize = byteSizeOf(addr); addrBase = ((char *) (firstIndexableField(addr))); if (!(failed())) { @@ -934,14 +884,10 @@ primitiveSocketAddressSetPort(void) sqInt portNumber; if (!(isIntegerObject((portNumber = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } portNumber = integerValueOf(portNumber); addr = stackValue(1); - if (failed()) { - return null; - } addrSize = byteSizeOf(addr); addrBase = ((char *) (firstIndexableField(addr))); if (!(failed())) { @@ -965,9 +911,6 @@ primitiveSocketBindTo(void) socket = stackValue(1); socketAddress = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1001,15 +944,11 @@ primitiveSocketBindToPort(void) if (!((isBytes(stackValue(1))) && (isIntegerObject((port = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(2); address = ((char *) (firstIndexableField(stackValue(1)))); port = integerValueOf(port); - if (failed()) { - return null; - } /* begin netAddressToInt: */ sz = byteSizeOf(((sqInt)(sqIntptr_t)((((unsigned char *) address))) - BaseHeaderSize)); if (!(sz == 4)) { @@ -1044,9 +983,6 @@ primitiveSocketCloseConnection(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1075,9 +1011,6 @@ primitiveSocketConnectionStatus(void) status = 0; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1108,9 +1041,6 @@ primitiveSocketConnectTo(void) socket = stackValue(1); socketAddress = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1145,15 +1075,11 @@ primitiveSocketConnectToPort(void) if (!((isBytes(stackValue(1))) && (isIntegerObject((port = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(2); address = ((char *) (firstIndexableField(stackValue(1)))); port = integerValueOf(port); - if (failed()) { - return null; - } /* begin netAddressToInt: */ sz = byteSizeOf(((sqInt)(sqIntptr_t)((((unsigned char *) address))) - BaseHeaderSize)); if (!(sz == 4)) { @@ -1204,17 +1130,13 @@ primitiveSocketCreate(void) && ((isIntegerObject((recvBufSize = stackValue(2)))) && ((isIntegerObject((sendBufSize = stackValue(1)))) && (isIntegerObject((semaIndex = stackValue(0))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } netType = integerValueOf(netType); socketType = integerValueOf(socketType); recvBufSize = integerValueOf(recvBufSize); sendBufSize = integerValueOf(sendBufSize); semaIndex = integerValueOf(semaIndex); - if (failed()) { - return null; - } if (sCCSOTfn != 0) { okToCreate = ((sqInt (*) (sqInt, sqInt)) sCCSOTfn)(netType, socketType); if (!okToCreate) { @@ -1266,8 +1188,7 @@ primitiveSocketCreate3Semaphores(void) && ((isIntegerObject((semaIndex = stackValue(2)))) && ((isIntegerObject((aReadSema = stackValue(1)))) && (isIntegerObject((aWriteSema = stackValue(0))))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } netType = integerValueOf(netType); socketType = integerValueOf(socketType); @@ -1276,9 +1197,6 @@ primitiveSocketCreate3Semaphores(void) semaIndex = integerValueOf(semaIndex); aReadSema = integerValueOf(aReadSema); aWriteSema = integerValueOf(aWriteSema); - if (failed()) { - return null; - } if (sCCSOTfn != 0) { okToCreate = ((sqInt (*) (sqInt, sqInt)) sCCSOTfn)(netType, socketType); if (!okToCreate) { @@ -1330,8 +1248,7 @@ primitiveSocketCreateRAW(void) && ((isIntegerObject((semaIndex = stackValue(2)))) && ((isIntegerObject((aReadSema = stackValue(1)))) && (isIntegerObject((aWriteSema = stackValue(0))))))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } netType = integerValueOf(netType); protoType = integerValueOf(protoType); @@ -1340,9 +1257,6 @@ primitiveSocketCreateRAW(void) semaIndex = integerValueOf(semaIndex); aReadSema = integerValueOf(aReadSema); aWriteSema = integerValueOf(aWriteSema); - if (failed()) { - return null; - } if (sCCSOTfn != 0) { okToCreate = ((sqInt (*) (sqInt, sqInt)) sCCSOTfn)(netType, protoType); if (!okToCreate) { @@ -1380,9 +1294,6 @@ primitiveSocketDestroy(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1409,9 +1320,6 @@ primitiveSocketError(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1441,9 +1349,6 @@ primitiveSocketGetOptions(void) socket = stackValue(1); optionName = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1483,14 +1388,10 @@ primitiveSocketListenOnPort(void) sqInt socket; if (!(isIntegerObject((port = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(1); port = integerValueOf(port); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1532,15 +1433,11 @@ primitiveSocketListenOnPortBacklog(void) if (!((isIntegerObject((port = stackValue(1)))) && (isIntegerObject((backlog = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(2); port = integerValueOf(port); backlog = integerValueOf(backlog); - if (failed()) { - return null; - } if (sCCLOPfn != 0) { okToListen = ((sqInt (*) (sqInt, sqInt)) sCCLOPfn)((sqInt)s, port); if (!okToListen) { @@ -1587,16 +1484,12 @@ primitiveSocketListenOnPortBacklogInterface(void) if (!((isIntegerObject((port = stackValue(2)))) && ((isIntegerObject((backlog = stackValue(1)))) && (isBytes(stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(3); port = integerValueOf(port); backlog = integerValueOf(backlog); ifAddr = ((char *) (firstIndexableField(stackValue(0)))); - if (failed()) { - return null; - } if (sCCLOPfn != 0) { okToListen = ((sqInt (*) (sqInt, sqInt)) sCCLOPfn)((sqInt)s, port); if (!okToListen) { @@ -1638,14 +1531,10 @@ primitiveSocketListenWithBacklog(void) sqInt socket; if (!(isIntegerObject((backlogSize = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(1); backlogSize = integerValueOf(backlogSize); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1689,9 +1578,6 @@ primitiveSocketLocalAddress(void) sqInt _return_value; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1723,9 +1609,6 @@ primitiveSocketLocalAddressResult(void) socket = stackValue(1); socketAddress = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1755,9 +1638,6 @@ primitiveSocketLocalAddressSize(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1789,9 +1669,6 @@ primitiveSocketLocalPort(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1816,9 +1693,6 @@ primitiveSocketReceiveDataAvailable(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1850,16 +1724,12 @@ primitiveSocketReceiveDataBufCount(void) if (!((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(3); array = stackValue(2); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } elementSize = # if SPURVM bytesPerElement(array) @@ -1921,16 +1791,12 @@ primitiveSocketReceiveUDPDataBufCount(void) if (!((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(3); array = stackValue(2); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -1993,9 +1859,6 @@ primitiveSocketRemoteAddress(void) sqInt _return_value; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -2027,9 +1890,6 @@ primitiveSocketRemoteAddressResult(void) socket = stackValue(1); socketAddress = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -2059,9 +1919,6 @@ primitiveSocketRemoteAddressSize(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -2092,9 +1949,6 @@ primitiveSocketRemotePort(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -2127,16 +1981,12 @@ primitiveSocketSendDataBufCount(void) bytesSent = 0; if (!((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(3); array = stackValue(2); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -2182,9 +2032,6 @@ primitiveSocketSendDone(void) sqInt socket; socket = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -2223,8 +2070,7 @@ primitiveSocketSendUDPDataBufCount(void) && ((isIntegerObject((portNumber = stackValue(2)))) && ((isIntegerObject((startIndex = stackValue(1)))) && (isIntegerObject((count = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } socket = stackValue(5); array = stackValue(4); @@ -2232,9 +2078,6 @@ primitiveSocketSendUDPDataBufCount(void) portNumber = integerValueOf(portNumber); startIndex = integerValueOf(startIndex); count = integerValueOf(count); - if (failed()) { - return null; - } elementSize = # if SPURVM bytesPerElement(array) @@ -2304,9 +2147,6 @@ primitiveSocketSetOptions(void) socket = stackValue(2); optionName = stackValue(1); optionValue = stackValue(0); - if (failed()) { - return null; - } /* begin socketValueOf: */ if ((isBytes(socket)) && ((byteSizeOf(socket)) == (sizeof(SQSocket)))) { @@ -2410,114 +2250,115 @@ void* SocketPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveDisableSocketAccess\000\377", (void*)primitiveDisableSocketAccess}, - {(void*)_m, "primitiveHasSocketAccess\000\377", (void*)primitiveHasSocketAccess}, - {(void*)_m, "primitiveInitializeNetwork\000\000", (void*)primitiveInitializeNetwork}, - {(void*)_m, "primitiveResolverAbortLookup\000\377", (void*)primitiveResolverAbortLookup}, - {(void*)_m, "primitiveResolverAddressLookupResult\000\377", (void*)primitiveResolverAddressLookupResult}, - {(void*)_m, "primitiveResolverError\000\377", (void*)primitiveResolverError}, - {(void*)_m, "primitiveResolverGetAddressInfo\000\000", (void*)primitiveResolverGetAddressInfo}, - {(void*)_m, "primitiveResolverGetAddressInfoFamily\000\377", (void*)primitiveResolverGetAddressInfoFamily}, - {(void*)_m, "primitiveResolverGetAddressInfoNext\000\377", (void*)primitiveResolverGetAddressInfoNext}, - {(void*)_m, "primitiveResolverGetAddressInfoProtocol\000\377", (void*)primitiveResolverGetAddressInfoProtocol}, - {(void*)_m, "primitiveResolverGetAddressInfoResult\000\377", (void*)primitiveResolverGetAddressInfoResult}, - {(void*)_m, "primitiveResolverGetAddressInfoSize\000\377", (void*)primitiveResolverGetAddressInfoSize}, - {(void*)_m, "primitiveResolverGetAddressInfoType\000\377", (void*)primitiveResolverGetAddressInfoType}, - {(void*)_m, "primitiveResolverGetNameInfo\000\000", (void*)primitiveResolverGetNameInfo}, - {(void*)_m, "primitiveResolverGetNameInfoHostResult\000\377", (void*)primitiveResolverGetNameInfoHostResult}, - {(void*)_m, "primitiveResolverGetNameInfoHostSize\000\377", (void*)primitiveResolverGetNameInfoHostSize}, - {(void*)_m, "primitiveResolverGetNameInfoServiceResult\000\377", (void*)primitiveResolverGetNameInfoServiceResult}, - {(void*)_m, "primitiveResolverGetNameInfoServiceSize\000\377", (void*)primitiveResolverGetNameInfoServiceSize}, - {(void*)_m, "primitiveResolverHostNameResult\000\377", (void*)primitiveResolverHostNameResult}, - {(void*)_m, "primitiveResolverHostNameSize\000\377", (void*)primitiveResolverHostNameSize}, - {(void*)_m, "primitiveResolverLocalAddress\000\377", (void*)primitiveResolverLocalAddress}, - {(void*)_m, "primitiveResolverNameLookupResult\000\377", (void*)primitiveResolverNameLookupResult}, - {(void*)_m, "primitiveResolverStartAddressLookup\000\377", (void*)primitiveResolverStartAddressLookup}, - {(void*)_m, "primitiveResolverStartNameLookup\000\377", (void*)primitiveResolverStartNameLookup}, - {(void*)_m, "primitiveResolverStatus\000\377", (void*)primitiveResolverStatus}, - {(void*)_m, "primitiveSocketAbortConnection\000\000", (void*)primitiveSocketAbortConnection}, - {(void*)_m, "primitiveSocketAccept\000\000", (void*)primitiveSocketAccept}, - {(void*)_m, "primitiveSocketAccept3Semaphores\000\000", (void*)primitiveSocketAccept3Semaphores}, - {(void*)_m, "primitiveSocketAddressGetPort\000\000", (void*)primitiveSocketAddressGetPort}, - {(void*)_m, "primitiveSocketAddressSetPort\000\000", (void*)primitiveSocketAddressSetPort}, - {(void*)_m, "primitiveSocketBindTo\000\000", (void*)primitiveSocketBindTo}, - {(void*)_m, "primitiveSocketBindToPort\000\000", (void*)primitiveSocketBindToPort}, - {(void*)_m, "primitiveSocketCloseConnection\000\000", (void*)primitiveSocketCloseConnection}, - {(void*)_m, "primitiveSocketConnectionStatus\000\000", (void*)primitiveSocketConnectionStatus}, - {(void*)_m, "primitiveSocketConnectTo\000\000", (void*)primitiveSocketConnectTo}, - {(void*)_m, "primitiveSocketConnectToPort\000\000", (void*)primitiveSocketConnectToPort}, - {(void*)_m, "primitiveSocketCreate\000\000", (void*)primitiveSocketCreate}, - {(void*)_m, "primitiveSocketCreate3Semaphores\000\000", (void*)primitiveSocketCreate3Semaphores}, - {(void*)_m, "primitiveSocketCreateRAW\000\000", (void*)primitiveSocketCreateRAW}, - {(void*)_m, "primitiveSocketDestroy\000\000", (void*)primitiveSocketDestroy}, - {(void*)_m, "primitiveSocketError\000\000", (void*)primitiveSocketError}, - {(void*)_m, "primitiveSocketGetOptions\000\000", (void*)primitiveSocketGetOptions}, - {(void*)_m, "primitiveSocketListenOnPort\000\000", (void*)primitiveSocketListenOnPort}, - {(void*)_m, "primitiveSocketListenOnPortBacklog\000\000", (void*)primitiveSocketListenOnPortBacklog}, - {(void*)_m, "primitiveSocketListenOnPortBacklogInterface\000\000", (void*)primitiveSocketListenOnPortBacklogInterface}, - {(void*)_m, "primitiveSocketListenWithBacklog\000\000", (void*)primitiveSocketListenWithBacklog}, - {(void*)_m, "primitiveSocketListenWithOrWithoutBacklog\000\000", (void*)primitiveSocketListenWithOrWithoutBacklog}, - {(void*)_m, "primitiveSocketLocalAddress\000\000", (void*)primitiveSocketLocalAddress}, - {(void*)_m, "primitiveSocketLocalAddressResult\000\000", (void*)primitiveSocketLocalAddressResult}, - {(void*)_m, "primitiveSocketLocalAddressSize\000\000", (void*)primitiveSocketLocalAddressSize}, - {(void*)_m, "primitiveSocketLocalPort\000\000", (void*)primitiveSocketLocalPort}, - {(void*)_m, "primitiveSocketReceiveDataAvailable\000\000", (void*)primitiveSocketReceiveDataAvailable}, - {(void*)_m, "primitiveSocketReceiveDataBufCount\000\000", (void*)primitiveSocketReceiveDataBufCount}, - {(void*)_m, "primitiveSocketReceiveUDPDataBufCount\000\000", (void*)primitiveSocketReceiveUDPDataBufCount}, - {(void*)_m, "primitiveSocketRemoteAddress\000\000", (void*)primitiveSocketRemoteAddress}, - {(void*)_m, "primitiveSocketRemoteAddressResult\000\000", (void*)primitiveSocketRemoteAddressResult}, - {(void*)_m, "primitiveSocketRemoteAddressSize\000\000", (void*)primitiveSocketRemoteAddressSize}, - {(void*)_m, "primitiveSocketRemotePort\000\000", (void*)primitiveSocketRemotePort}, - {(void*)_m, "primitiveSocketSendDataBufCount\000\000", (void*)primitiveSocketSendDataBufCount}, - {(void*)_m, "primitiveSocketSendDone\000\000", (void*)primitiveSocketSendDone}, - {(void*)_m, "primitiveSocketSendUDPDataBufCount\000\000", (void*)primitiveSocketSendUDPDataBufCount}, - {(void*)_m, "primitiveSocketSetOptions\000\000", (void*)primitiveSocketSetOptions}, + {(void*)_m, "primitiveDisableSocketAccess\000\377\000", (void*)primitiveDisableSocketAccess}, + {(void*)_m, "primitiveHasSocketAccess\000\377\000", (void*)primitiveHasSocketAccess}, + {(void*)_m, "primitiveInitializeNetwork\000\000\000", (void*)primitiveInitializeNetwork}, + {(void*)_m, "primitiveResolverAbortLookup\000\377\000", (void*)primitiveResolverAbortLookup}, + {(void*)_m, "primitiveResolverAddressLookupResult\000\377\000", (void*)primitiveResolverAddressLookupResult}, + {(void*)_m, "primitiveResolverError\000\377\000", (void*)primitiveResolverError}, + {(void*)_m, "primitiveResolverGetAddressInfo\000\000\000", (void*)primitiveResolverGetAddressInfo}, + {(void*)_m, "primitiveResolverGetAddressInfoFamily\000\377\000", (void*)primitiveResolverGetAddressInfoFamily}, + {(void*)_m, "primitiveResolverGetAddressInfoNext\000\377\000", (void*)primitiveResolverGetAddressInfoNext}, + {(void*)_m, "primitiveResolverGetAddressInfoProtocol\000\377\000", (void*)primitiveResolverGetAddressInfoProtocol}, + {(void*)_m, "primitiveResolverGetAddressInfoResult\000\377\000", (void*)primitiveResolverGetAddressInfoResult}, + {(void*)_m, "primitiveResolverGetAddressInfoSize\000\377\000", (void*)primitiveResolverGetAddressInfoSize}, + {(void*)_m, "primitiveResolverGetAddressInfoType\000\377\000", (void*)primitiveResolverGetAddressInfoType}, + {(void*)_m, "primitiveResolverGetNameInfo\000\000\000", (void*)primitiveResolverGetNameInfo}, + {(void*)_m, "primitiveResolverGetNameInfoHostResult\000\377\000", (void*)primitiveResolverGetNameInfoHostResult}, + {(void*)_m, "primitiveResolverGetNameInfoHostSize\000\377\000", (void*)primitiveResolverGetNameInfoHostSize}, + {(void*)_m, "primitiveResolverGetNameInfoServiceResult\000\377\000", (void*)primitiveResolverGetNameInfoServiceResult}, + {(void*)_m, "primitiveResolverGetNameInfoServiceSize\000\377\000", (void*)primitiveResolverGetNameInfoServiceSize}, + {(void*)_m, "primitiveResolverHostNameResult\000\377\000", (void*)primitiveResolverHostNameResult}, + {(void*)_m, "primitiveResolverHostNameSize\000\377\000", (void*)primitiveResolverHostNameSize}, + {(void*)_m, "primitiveResolverLocalAddress\000\377\000", (void*)primitiveResolverLocalAddress}, + {(void*)_m, "primitiveResolverNameLookupResult\000\377\000", (void*)primitiveResolverNameLookupResult}, + {(void*)_m, "primitiveResolverStartAddressLookup\000\377\000", (void*)primitiveResolverStartAddressLookup}, + {(void*)_m, "primitiveResolverStartNameLookup\000\377\000", (void*)primitiveResolverStartNameLookup}, + {(void*)_m, "primitiveResolverStatus\000\377\000", (void*)primitiveResolverStatus}, + {(void*)_m, "primitiveSocketAbortConnection\000\001\000", (void*)primitiveSocketAbortConnection}, + {(void*)_m, "primitiveSocketAccept\000\001\000", (void*)primitiveSocketAccept}, + {(void*)_m, "primitiveSocketAccept3Semaphores\000\001\000", (void*)primitiveSocketAccept3Semaphores}, + {(void*)_m, "primitiveSocketAddressGetPort\000\000\000", (void*)primitiveSocketAddressGetPort}, + {(void*)_m, "primitiveSocketAddressSetPort\000\000\000", (void*)primitiveSocketAddressSetPort}, + {(void*)_m, "primitiveSocketBindTo\000\001\000", (void*)primitiveSocketBindTo}, + {(void*)_m, "primitiveSocketBindToPort\000\001\000", (void*)primitiveSocketBindToPort}, + {(void*)_m, "primitiveSocketCloseConnection\000\001\000", (void*)primitiveSocketCloseConnection}, + {(void*)_m, "primitiveSocketConnectionStatus\000\001\000", (void*)primitiveSocketConnectionStatus}, + {(void*)_m, "primitiveSocketConnectTo\000\001\000", (void*)primitiveSocketConnectTo}, + {(void*)_m, "primitiveSocketConnectToPort\000\001\000", (void*)primitiveSocketConnectToPort}, + {(void*)_m, "primitiveSocketCreate\000\000\000", (void*)primitiveSocketCreate}, + {(void*)_m, "primitiveSocketCreate3Semaphores\000\000\000", (void*)primitiveSocketCreate3Semaphores}, + {(void*)_m, "primitiveSocketCreateRAW\000\000\000", (void*)primitiveSocketCreateRAW}, + {(void*)_m, "primitiveSocketDestroy\000\001\000", (void*)primitiveSocketDestroy}, + {(void*)_m, "primitiveSocketError\000\001\000", (void*)primitiveSocketError}, + {(void*)_m, "primitiveSocketGetOptions\000\001\000", (void*)primitiveSocketGetOptions}, + {(void*)_m, "primitiveSocketListenOnPort\000\001\000", (void*)primitiveSocketListenOnPort}, + {(void*)_m, "primitiveSocketListenOnPortBacklog\000\001\000", (void*)primitiveSocketListenOnPortBacklog}, + {(void*)_m, "primitiveSocketListenOnPortBacklogInterface\000\001\000", (void*)primitiveSocketListenOnPortBacklogInterface}, + {(void*)_m, "primitiveSocketListenWithBacklog\000\001\000", (void*)primitiveSocketListenWithBacklog}, + {(void*)_m, "primitiveSocketListenWithOrWithoutBacklog\000\377\000", (void*)primitiveSocketListenWithOrWithoutBacklog}, + {(void*)_m, "primitiveSocketLocalAddress\000\001\000", (void*)primitiveSocketLocalAddress}, + {(void*)_m, "primitiveSocketLocalAddressResult\000\001\000", (void*)primitiveSocketLocalAddressResult}, + {(void*)_m, "primitiveSocketLocalAddressSize\000\001\000", (void*)primitiveSocketLocalAddressSize}, + {(void*)_m, "primitiveSocketLocalPort\000\001\000", (void*)primitiveSocketLocalPort}, + {(void*)_m, "primitiveSocketReceiveDataAvailable\000\001\000", (void*)primitiveSocketReceiveDataAvailable}, + {(void*)_m, "primitiveSocketReceiveDataBufCount\000\001\000", (void*)primitiveSocketReceiveDataBufCount}, + {(void*)_m, "primitiveSocketReceiveUDPDataBufCount\000\001\000", (void*)primitiveSocketReceiveUDPDataBufCount}, + {(void*)_m, "primitiveSocketRemoteAddress\000\001\000", (void*)primitiveSocketRemoteAddress}, + {(void*)_m, "primitiveSocketRemoteAddressResult\000\001\000", (void*)primitiveSocketRemoteAddressResult}, + {(void*)_m, "primitiveSocketRemoteAddressSize\000\001\000", (void*)primitiveSocketRemoteAddressSize}, + {(void*)_m, "primitiveSocketRemotePort\000\001\000", (void*)primitiveSocketRemotePort}, + {(void*)_m, "primitiveSocketSendDataBufCount\000\001\000", (void*)primitiveSocketSendDataBufCount}, + {(void*)_m, "primitiveSocketSendDone\000\001\000", (void*)primitiveSocketSendDone}, + {(void*)_m, "primitiveSocketSendUDPDataBufCount\000\001\000", (void*)primitiveSocketSendUDPDataBufCount}, + {(void*)_m, "primitiveSocketSetOptions\000\001\000", (void*)primitiveSocketSetOptions}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveInitializeNetworkAccessorDepth = 0; -EXPORT(signed char) primitiveResolverGetAddressInfoAccessorDepth = 0; -EXPORT(signed char) primitiveResolverGetNameInfoAccessorDepth = 0; -EXPORT(signed char) primitiveSocketAbortConnectionAccessorDepth = 0; -EXPORT(signed char) primitiveSocketAcceptAccessorDepth = 0; -EXPORT(signed char) primitiveSocketAccept3SemaphoresAccessorDepth = 0; -EXPORT(signed char) primitiveSocketAddressGetPortAccessorDepth = 0; -EXPORT(signed char) primitiveSocketAddressSetPortAccessorDepth = 0; -EXPORT(signed char) primitiveSocketBindToAccessorDepth = 0; -EXPORT(signed char) primitiveSocketBindToPortAccessorDepth = 0; -EXPORT(signed char) primitiveSocketCloseConnectionAccessorDepth = 0; -EXPORT(signed char) primitiveSocketConnectionStatusAccessorDepth = 0; -EXPORT(signed char) primitiveSocketConnectToAccessorDepth = 0; -EXPORT(signed char) primitiveSocketConnectToPortAccessorDepth = 0; -EXPORT(signed char) primitiveSocketCreateAccessorDepth = 0; -EXPORT(signed char) primitiveSocketCreate3SemaphoresAccessorDepth = 0; -EXPORT(signed char) primitiveSocketCreateRAWAccessorDepth = 0; -EXPORT(signed char) primitiveSocketDestroyAccessorDepth = 0; -EXPORT(signed char) primitiveSocketErrorAccessorDepth = 0; -EXPORT(signed char) primitiveSocketGetOptionsAccessorDepth = 0; -EXPORT(signed char) primitiveSocketListenOnPortAccessorDepth = 0; -EXPORT(signed char) primitiveSocketListenOnPortBacklogAccessorDepth = 0; -EXPORT(signed char) primitiveSocketListenOnPortBacklogInterfaceAccessorDepth = 0; -EXPORT(signed char) primitiveSocketListenWithBacklogAccessorDepth = 0; -EXPORT(signed char) primitiveSocketListenWithOrWithoutBacklogAccessorDepth = 0; -EXPORT(signed char) primitiveSocketLocalAddressAccessorDepth = 0; -EXPORT(signed char) primitiveSocketLocalAddressResultAccessorDepth = 0; -EXPORT(signed char) primitiveSocketLocalAddressSizeAccessorDepth = 0; -EXPORT(signed char) primitiveSocketLocalPortAccessorDepth = 0; -EXPORT(signed char) primitiveSocketReceiveDataAvailableAccessorDepth = 0; -EXPORT(signed char) primitiveSocketReceiveDataBufCountAccessorDepth = 0; -EXPORT(signed char) primitiveSocketReceiveUDPDataBufCountAccessorDepth = 0; -EXPORT(signed char) primitiveSocketRemoteAddressAccessorDepth = 0; -EXPORT(signed char) primitiveSocketRemoteAddressResultAccessorDepth = 0; -EXPORT(signed char) primitiveSocketRemoteAddressSizeAccessorDepth = 0; -EXPORT(signed char) primitiveSocketRemotePortAccessorDepth = 0; -EXPORT(signed char) primitiveSocketSendDataBufCountAccessorDepth = 0; -EXPORT(signed char) primitiveSocketSendDoneAccessorDepth = 0; -EXPORT(signed char) primitiveSocketSendUDPDataBufCountAccessorDepth = 0; -EXPORT(signed char) primitiveSocketSetOptionsAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveInitializeNetworkMetadata = 0; +EXPORT(signed short) primitiveResolverGetAddressInfoMetadata = 0; +EXPORT(signed short) primitiveResolverGetNameInfoMetadata = 0; +EXPORT(signed short) primitiveSocketAbortConnectionMetadata = 0x100; +EXPORT(signed short) primitiveSocketAcceptMetadata = 0x100; +EXPORT(signed short) primitiveSocketAccept3SemaphoresMetadata = 0x100; +EXPORT(signed short) primitiveSocketAddressGetPortMetadata = 0; +EXPORT(signed short) primitiveSocketAddressSetPortMetadata = 0; +EXPORT(signed short) primitiveSocketBindToMetadata = 0x100; +EXPORT(signed short) primitiveSocketBindToPortMetadata = 0x100; +EXPORT(signed short) primitiveSocketCloseConnectionMetadata = 0x100; +EXPORT(signed short) primitiveSocketConnectionStatusMetadata = 0x100; +EXPORT(signed short) primitiveSocketConnectToMetadata = 0x100; +EXPORT(signed short) primitiveSocketConnectToPortMetadata = 0x100; +EXPORT(signed short) primitiveSocketCreateMetadata = 0; +EXPORT(signed short) primitiveSocketCreate3SemaphoresMetadata = 0; +EXPORT(signed short) primitiveSocketCreateRAWMetadata = 0; +EXPORT(signed short) primitiveSocketDestroyMetadata = 0x100; +EXPORT(signed short) primitiveSocketErrorMetadata = 0x100; +EXPORT(signed short) primitiveSocketGetOptionsMetadata = 0x100; +EXPORT(signed short) primitiveSocketListenOnPortMetadata = 0x100; +EXPORT(signed short) primitiveSocketListenOnPortBacklogMetadata = 0x100; +EXPORT(signed short) primitiveSocketListenOnPortBacklogInterfaceMetadata = 0x100; +EXPORT(signed short) primitiveSocketListenWithBacklogMetadata = 0x100; +EXPORT(signed short) primitiveSocketLocalAddressMetadata = 0x100; +EXPORT(signed short) primitiveSocketLocalAddressResultMetadata = 0x100; +EXPORT(signed short) primitiveSocketLocalAddressSizeMetadata = 0x100; +EXPORT(signed short) primitiveSocketLocalPortMetadata = 0x100; +EXPORT(signed short) primitiveSocketReceiveDataAvailableMetadata = 0x100; +EXPORT(signed short) primitiveSocketReceiveDataBufCountMetadata = 0x100; +EXPORT(signed short) primitiveSocketReceiveUDPDataBufCountMetadata = 0x100; +EXPORT(signed short) primitiveSocketRemoteAddressMetadata = 0x100; +EXPORT(signed short) primitiveSocketRemoteAddressResultMetadata = 0x100; +EXPORT(signed short) primitiveSocketRemoteAddressSizeMetadata = 0x100; +EXPORT(signed short) primitiveSocketRemotePortMetadata = 0x100; +EXPORT(signed short) primitiveSocketSendDataBufCountMetadata = 0x100; +EXPORT(signed short) primitiveSocketSendDoneMetadata = 0x100; +EXPORT(signed short) primitiveSocketSendUDPDataBufCountMetadata = 0x100; +EXPORT(signed short) primitiveSocketSetOptionsMetadata = 0x100; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SoundCodecPrims/SoundCodecPrims.c b/src/plugins/SoundCodecPrims/SoundCodecPrims.c index e66cfc6a7d..a3da8f86af 100644 --- a/src/plugins/SoundCodecPrims/SoundCodecPrims.c +++ b/src/plugins/SoundCodecPrims/SoundCodecPrims.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SoundCodecPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SoundCodecPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "SoundCodecPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "SoundCodecPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -81,7 +81,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SoundCodecPrims VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "SoundCodecPrims VMMaker.oscog-eem.3024 " INT_EXT; @@ -249,16 +249,18 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "SoundCodecPrims"; void* SoundCodecPrims_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveGSMDecode\000\000", (void*)primitiveGSMDecode}, - {(void*)_m, "primitiveGSMEncode\000\000", (void*)primitiveGSMEncode}, - {(void*)_m, "primitiveGSMNewState\000\377", (void*)primitiveGSMNewState}, + {(void*)_m, "primitiveGSMDecode\000\000\000", (void*)primitiveGSMDecode}, + {(void*)_m, "primitiveGSMEncode\000\000\000", (void*)primitiveGSMEncode}, + {(void*)_m, "primitiveGSMNewState\000\377\000", (void*)primitiveGSMNewState}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveGSMDecodeAccessorDepth = 0; -EXPORT(signed char) primitiveGSMEncodeAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveGSMDecodeMetadata = 0; +EXPORT(signed short) primitiveGSMEncodeMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SoundGenerationPlugin/SoundGenerationPlugin.c b/src/plugins/SoundGenerationPlugin/SoundGenerationPlugin.c index 8c79d26faa..7a23e2b43d 100644 --- a/src/plugins/SoundGenerationPlugin/SoundGenerationPlugin.c +++ b/src/plugins/SoundGenerationPlugin/SoundGenerationPlugin.c @@ -1,11 +1,11 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SoundGenerationPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 - AbstractSound * Sound-eem.77 uuid: 6ba9cee3-631a-4b00-b66f-0aad4608aefd + SoundGenerationPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 + AbstractSound * Sound-eem.81 uuid: 43c1e089-1145-4a27-b5b8-f35e872fc99a */ -static char __buildInfo[] = "SoundGenerationPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5\n\ -AbstractSound * Sound-eem.77 uuid: 6ba9cee3-631a-4b00-b66f-0aad4608aefd " __DATE__ ; +static char __buildInfo[] = "SoundGenerationPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190\n\ +AbstractSound * Sound-eem.81 uuid: 43c1e089-1145-4a27-b5b8-f35e872fc99a " __DATE__ ; #include "config.h" @@ -77,7 +77,7 @@ extern sqInt storeIntegerofObjectwithValue(sqInt index, sqInt oop, sqInt integer extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SoundGenerationPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "SoundGenerationPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -732,21 +732,18 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "SoundGenerationPlugin"; void* SoundGenerationPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveApplyReverb\000\001", (void*)primitiveApplyReverb}, - {(void*)_m, "primitiveMixFMSound\000\001", (void*)primitiveMixFMSound}, - {(void*)_m, "primitiveMixLoopedSampledSound\000\001", (void*)primitiveMixLoopedSampledSound}, - {(void*)_m, "primitiveMixPluckedSound\000\001", (void*)primitiveMixPluckedSound}, - {(void*)_m, "primitiveMixSampledSound\000\001", (void*)primitiveMixSampledSound}, + {(void*)_m, "primitiveApplyReverb\000\377\000", (void*)primitiveApplyReverb}, + {(void*)_m, "primitiveMixFMSound\000\377\000", (void*)primitiveMixFMSound}, + {(void*)_m, "primitiveMixLoopedSampledSound\000\377\000", (void*)primitiveMixLoopedSampledSound}, + {(void*)_m, "primitiveMixPluckedSound\000\377\000", (void*)primitiveMixPluckedSound}, + {(void*)_m, "primitiveMixSampledSound\000\377\000", (void*)primitiveMixSampledSound}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveApplyReverbAccessorDepth = 1; -EXPORT(signed char) primitiveMixFMSoundAccessorDepth = 1; -EXPORT(signed char) primitiveMixLoopedSampledSoundAccessorDepth = 1; -EXPORT(signed char) primitiveMixPluckedSoundAccessorDepth = 1; -EXPORT(signed char) primitiveMixSampledSoundAccessorDepth = 1; +#if SPURVM +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SoundPlugin/SoundPlugin.c b/src/plugins/SoundPlugin/SoundPlugin.c index 5c37d10e35..73a704935c 100644 --- a/src/plugins/SoundPlugin/SoundPlugin.c +++ b/src/plugins/SoundPlugin/SoundPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SoundPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SoundPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "SoundPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "SoundPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -168,7 +168,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SoundPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "SoundPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -634,15 +634,11 @@ primitiveSoundInsertSamples(void) if (!((isIntegerObject((frameCount = stackValue(2)))) && ((isWordsOrShorts(stackValue(1))) && (isIntegerObject((leadTime = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } frameCount = integerValueOf(frameCount); buf = ((short *) (firstIndexableField(stackValue(1)))); leadTime = integerValueOf(leadTime); - if (failed()) { - return null; - } if ((((usqInt) frameCount)) > ((byteSizeOf(((sqInt)(sqIntptr_t)(buf) - BaseHeaderSize))) / ((sizeof(short)) * 2))) { return primitiveFailFor(PrimErrBadArgument); } @@ -675,15 +671,11 @@ primitiveSoundPlaySamples(void) if (!((isIntegerObject((frameCount = stackValue(2)))) && ((isWordsOrShorts(stackValue(1))) && (isIntegerObject((startIndex = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } frameCount = integerValueOf(frameCount); buf = ((short *) (firstIndexableField(stackValue(1)))); startIndex = integerValueOf(startIndex); - if (failed()) { - return null; - } if (!((startIndex >= 1) && (((startIndex + frameCount) - 1) <= ((byteSizeOf(((sqInt)(sqIntptr_t)(buf) - BaseHeaderSize))) / ((sizeof(short)) * 2))))) { return primitiveFailFor(PrimErrBadArgument); @@ -736,14 +728,10 @@ primitiveSoundRecordSamples(void) if (!((isWordsOrShorts(stackValue(1))) && (isIntegerObject((startWordIndex = stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } buf = ((short *) (firstIndexableField(stackValue(1)))); startWordIndex = integerValueOf(startWordIndex); - if (failed()) { - return null; - } bufSizeInBytes = byteSizeOf(((sqInt)(sqIntptr_t)(buf) - BaseHeaderSize)); byteOffset = (startWordIndex - 1) * 2; if (!((startWordIndex >= 1) @@ -770,14 +758,10 @@ primitiveSoundSetLeftVolume(void) if (!((isFloatObject(stackValue(1))) && (isFloatObject(stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } aLeftVolume = stackFloatValue(1); aRightVolume = stackFloatValue(0); - if (failed()) { - return null; - } snd_SetVolume(aLeftVolume, aRightVolume); if (!(failed())) { pop(2); @@ -795,13 +779,9 @@ primitiveSoundSetRecordLevel(void) sqInt level; if (!(isIntegerObject((level = stackValue(0))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } level = integerValueOf(level); - if (failed()) { - return null; - } snd_SetRecordLevel(level); if (!(failed())) { pop(1); @@ -825,15 +805,11 @@ primitiveSoundStart(void) if (!((isIntegerObject((bufFrames = stackValue(2)))) && ((isIntegerObject((samplesPerSec = stackValue(1)))) && (isBooleanObject(stackValue(0)))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } bufFrames = integerValueOf(bufFrames); samplesPerSec = integerValueOf(samplesPerSec); stereoFlag = booleanValueOf(stackValue(0)); - if (failed()) { - return null; - } success(snd_Start(bufFrames, samplesPerSec, stereoFlag, 0)); if (!(failed())) { pop(3); @@ -855,15 +831,11 @@ primitiveSoundStartRecording(void) if (!((isIntegerObject((desiredSamplesPerSec = stackValue(2)))) && ((isBooleanObject(stackValue(1))) && (isIntegerObject((semaIndex = stackValue(0))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } desiredSamplesPerSec = integerValueOf(desiredSamplesPerSec); stereoFlag = booleanValueOf(stackValue(1)); semaIndex = integerValueOf(semaIndex); - if (failed()) { - return null; - } snd_StartRecording(desiredSamplesPerSec, stereoFlag, semaIndex); if (!(failed())) { pop(3); @@ -889,16 +861,12 @@ primitiveSoundStartWithSemaphore(void) && ((isIntegerObject((samplesPerSec = stackValue(2)))) && ((isBooleanObject(stackValue(1))) && (isIntegerObject((semaIndex = stackValue(0)))))))) { - primitiveFailFor(PrimErrBadArgument); - return null; + return primitiveFailFor(PrimErrBadArgument); } bufFrames = integerValueOf(bufFrames); samplesPerSec = integerValueOf(samplesPerSec); stereoFlag = booleanValueOf(stackValue(1)); semaIndex = integerValueOf(semaIndex); - if (failed()) { - return null; - } success(snd_Start(bufFrames, samplesPerSec, stereoFlag, semaIndex)); if (!(failed())) { pop(4); @@ -1024,54 +992,54 @@ static char _m[] = "SoundPlugin"; void* SoundPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveGetDefaultSoundPlayer\000\377", (void*)primitiveGetDefaultSoundPlayer}, - {(void*)_m, "primitiveGetDefaultSoundRecorder\000\377", (void*)primitiveGetDefaultSoundRecorder}, - {(void*)_m, "primitiveGetNumberOfSoundPlayerDevices\000\377", (void*)primitiveGetNumberOfSoundPlayerDevices}, - {(void*)_m, "primitiveGetNumberOfSoundRecorderDevices\000\377", (void*)primitiveGetNumberOfSoundRecorderDevices}, - {(void*)_m, "primitiveGetSoundPlayerDeviceName\000\377", (void*)primitiveGetSoundPlayerDeviceName}, + {(void*)_m, "primitiveGetDefaultSoundPlayer\000\377\000", (void*)primitiveGetDefaultSoundPlayer}, + {(void*)_m, "primitiveGetDefaultSoundRecorder\000\377\000", (void*)primitiveGetDefaultSoundRecorder}, + {(void*)_m, "primitiveGetNumberOfSoundPlayerDevices\000\377\000", (void*)primitiveGetNumberOfSoundPlayerDevices}, + {(void*)_m, "primitiveGetNumberOfSoundRecorderDevices\000\377\000", (void*)primitiveGetNumberOfSoundRecorderDevices}, + {(void*)_m, "primitiveGetSoundPlayerDeviceName\000\377\000", (void*)primitiveGetSoundPlayerDeviceName}, #if TerfVM - {(void*)_m, "primitiveGetSoundPlayerDeviceUID\000\377", (void*)primitiveGetSoundPlayerDeviceUID}, + {(void*)_m, "primitiveGetSoundPlayerDeviceUID\000\377\000", (void*)primitiveGetSoundPlayerDeviceUID}, #endif /* TerfVM */ - {(void*)_m, "primitiveGetSoundRecorderDeviceName\000\377", (void*)primitiveGetSoundRecorderDeviceName}, + {(void*)_m, "primitiveGetSoundRecorderDeviceName\000\377\000", (void*)primitiveGetSoundRecorderDeviceName}, #if TerfVM - {(void*)_m, "primitiveGetSoundRecorderDeviceUID\000\377", (void*)primitiveGetSoundRecorderDeviceUID}, + {(void*)_m, "primitiveGetSoundRecorderDeviceUID\000\377\000", (void*)primitiveGetSoundRecorderDeviceUID}, #endif /* TerfVM */ - {(void*)_m, "primitiveSetDefaultSoundPlayer\000\000", (void*)primitiveSetDefaultSoundPlayer}, - {(void*)_m, "primitiveSetDefaultSoundRecorder\000\000", (void*)primitiveSetDefaultSoundRecorder}, - {(void*)_m, "primitiveSoundAvailableSpace\000\377", (void*)primitiveSoundAvailableSpace}, - {(void*)_m, "primitiveSoundEnableAEC\000\000", (void*)primitiveSoundEnableAEC}, - {(void*)_m, "primitiveSoundGetRecordingSampleRate\000\377", (void*)primitiveSoundGetRecordingSampleRate}, - {(void*)_m, "primitiveSoundGetRecordLevel\000\377", (void*)primitiveSoundGetRecordLevel}, - {(void*)_m, "primitiveSoundGetVolume\000\377", (void*)primitiveSoundGetVolume}, - {(void*)_m, "primitiveSoundInsertSamples\000\000", (void*)primitiveSoundInsertSamples}, - {(void*)_m, "primitiveSoundPlaySamples\000\000", (void*)primitiveSoundPlaySamples}, - {(void*)_m, "primitiveSoundPlaySilence\000\377", (void*)primitiveSoundPlaySilence}, - {(void*)_m, "primitiveSoundRecordSamples\000\000", (void*)primitiveSoundRecordSamples}, - {(void*)_m, "primitiveSoundSetLeftVolume\000\000", (void*)primitiveSoundSetLeftVolume}, - {(void*)_m, "primitiveSoundSetRecordLevel\000\000", (void*)primitiveSoundSetRecordLevel}, - {(void*)_m, "primitiveSoundStart\000\000", (void*)primitiveSoundStart}, - {(void*)_m, "primitiveSoundStartRecording\000\000", (void*)primitiveSoundStartRecording}, - {(void*)_m, "primitiveSoundStartWithSemaphore\000\000", (void*)primitiveSoundStartWithSemaphore}, - {(void*)_m, "primitiveSoundStop\000\377", (void*)primitiveSoundStop}, - {(void*)_m, "primitiveSoundStopRecording\000\377", (void*)primitiveSoundStopRecording}, - {(void*)_m, "primitiveSoundSupportsAEC\000\377", (void*)primitiveSoundSupportsAEC}, + {(void*)_m, "primitiveSetDefaultSoundPlayer\000\377\000", (void*)primitiveSetDefaultSoundPlayer}, + {(void*)_m, "primitiveSetDefaultSoundRecorder\000\377\000", (void*)primitiveSetDefaultSoundRecorder}, + {(void*)_m, "primitiveSoundAvailableSpace\000\377\000", (void*)primitiveSoundAvailableSpace}, + {(void*)_m, "primitiveSoundEnableAEC\000\000\000", (void*)primitiveSoundEnableAEC}, + {(void*)_m, "primitiveSoundGetRecordingSampleRate\000\377\000", (void*)primitiveSoundGetRecordingSampleRate}, + {(void*)_m, "primitiveSoundGetRecordLevel\000\377\000", (void*)primitiveSoundGetRecordLevel}, + {(void*)_m, "primitiveSoundGetVolume\000\377\000", (void*)primitiveSoundGetVolume}, + {(void*)_m, "primitiveSoundInsertSamples\000\000\000", (void*)primitiveSoundInsertSamples}, + {(void*)_m, "primitiveSoundPlaySamples\000\000\000", (void*)primitiveSoundPlaySamples}, + {(void*)_m, "primitiveSoundPlaySilence\000\377\000", (void*)primitiveSoundPlaySilence}, + {(void*)_m, "primitiveSoundRecordSamples\000\000\000", (void*)primitiveSoundRecordSamples}, + {(void*)_m, "primitiveSoundSetLeftVolume\000\000\000", (void*)primitiveSoundSetLeftVolume}, + {(void*)_m, "primitiveSoundSetRecordLevel\000\000\000", (void*)primitiveSoundSetRecordLevel}, + {(void*)_m, "primitiveSoundStart\000\000\000", (void*)primitiveSoundStart}, + {(void*)_m, "primitiveSoundStartRecording\000\000\000", (void*)primitiveSoundStartRecording}, + {(void*)_m, "primitiveSoundStartWithSemaphore\000\000\000", (void*)primitiveSoundStartWithSemaphore}, + {(void*)_m, "primitiveSoundStop\000\377\000", (void*)primitiveSoundStop}, + {(void*)_m, "primitiveSoundStopRecording\000\377\000", (void*)primitiveSoundStopRecording}, + {(void*)_m, "primitiveSoundSupportsAEC\000\377\000", (void*)primitiveSoundSupportsAEC}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveSetDefaultSoundPlayerAccessorDepth = 0; -EXPORT(signed char) primitiveSetDefaultSoundRecorderAccessorDepth = 0; -EXPORT(signed char) primitiveSoundEnableAECAccessorDepth = 0; -EXPORT(signed char) primitiveSoundInsertSamplesAccessorDepth = 0; -EXPORT(signed char) primitiveSoundPlaySamplesAccessorDepth = 0; -EXPORT(signed char) primitiveSoundRecordSamplesAccessorDepth = 0; -EXPORT(signed char) primitiveSoundSetLeftVolumeAccessorDepth = 0; -EXPORT(signed char) primitiveSoundSetRecordLevelAccessorDepth = 0; -EXPORT(signed char) primitiveSoundStartAccessorDepth = 0; -EXPORT(signed char) primitiveSoundStartRecordingAccessorDepth = 0; -EXPORT(signed char) primitiveSoundStartWithSemaphoreAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveSoundEnableAECMetadata = 0; +EXPORT(signed short) primitiveSoundInsertSamplesMetadata = 0; +EXPORT(signed short) primitiveSoundPlaySamplesMetadata = 0; +EXPORT(signed short) primitiveSoundRecordSamplesMetadata = 0; +EXPORT(signed short) primitiveSoundSetLeftVolumeMetadata = 0; +EXPORT(signed short) primitiveSoundSetRecordLevelMetadata = 0; +EXPORT(signed short) primitiveSoundStartMetadata = 0; +EXPORT(signed short) primitiveSoundStartRecordingMetadata = 0; +EXPORT(signed short) primitiveSoundStartWithSemaphoreMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/Squeak3D/Squeak3D.c b/src/plugins/Squeak3D/Squeak3D.c index 8108b3a7f0..01f981960e 100644 --- a/src/plugins/Squeak3D/Squeak3D.c +++ b/src/plugins/Squeak3D/Squeak3D.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3019 uuid: e99c07f6-81f2-4d58-9ff4-943d9e7ef0dc from - B3DEnginePlugin * Balloon3D-Plugins-nice.16 uuid: 961cec73-badd-4b71-8d02-9233e3122e21 + B3DEnginePlugin * Balloon3D-Plugins-nice.17 uuid: f037d89d-b9e0-8142-b2df-e82afa001b61 */ -static char __buildInfo[] = "B3DEnginePlugin * Balloon3D-Plugins-nice.16 uuid: 961cec73-badd-4b71-8d02-9233e3122e21 " __DATE__ ; +static char __buildInfo[] = "B3DEnginePlugin * Balloon3D-Plugins-nice.17 uuid: f037d89d-b9e0-8142-b2df-e82afa001b61 " __DATE__ ; #include "config.h" @@ -184,7 +184,6 @@ EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); static sqInt shadeVertex(void); static sqInt stackLightArrayValue(sqInt stackIndex); static void * stackMaterialValue(sqInt stackIndex); -static void* stackMatrix(sqInt index); static void* stackPrimitiveIndexArrayofSizevalidateforVertexSize(sqInt stackIndex, sqInt nItems, sqInt aBool, sqInt maxIndex); static void* stackPrimitiveVertexArrayofSize(sqInt index, sqInt nItems); static void* stackPrimitiveVertex(sqInt index); @@ -277,7 +276,7 @@ static double l2vSpecDir[3]; static sqInt lightFlags; static float* litVertex; static sqInt loadBBFn; -static const char *moduleName = "Squeak3D * Balloon3D-Plugins-nice.16 " INT_EXT; +static const char *moduleName = "Squeak3D * Balloon3D-Plugins-nice.17 " INT_EXT; static float* primLight; static float* primMaterial; static sqInt vbFlags; @@ -888,6 +887,7 @@ b3dInplaceHouseHolderInvert(void) sqInt j; sqInt k; double m[4][4]; + sqInt oop; sqInt r; float *rcvr; double s; @@ -895,7 +895,16 @@ b3dInplaceHouseHolderInvert(void) double sum; double x[4][4] = { {1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1} }; - rcvr = stackMatrix(0); + /* begin stackMatrix: */ + oop = stackValue(0); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + rcvr = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + rcvr = ((void *) null); + l1: /* end stackMatrix: */; for (i = 0; i <= 3; i += 1) { for (j = 0; j <= 3; j += 1) { (m[i])[j] = (rcvr[(i * 4) + j]); @@ -1707,6 +1716,7 @@ EXPORT(sqInt) b3dTransformDirection(void) { float *matrix; + sqInt oop; double rx; double ry; double rz; @@ -1728,7 +1738,16 @@ b3dTransformDirection(void) return primitiveFail(); } vertex = firstIndexableField(v3Oop); - matrix = stackMatrix(1); + /* begin stackMatrix: */ + oop = stackValue(1); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + matrix = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + matrix = ((void *) null); + l1: /* end stackMatrix: */; if (matrix == null) { return primitiveFail(); } @@ -1778,10 +1797,40 @@ b3dTransformMatrixWithInto(void) float *m21; float *m3; float *m31; + sqInt oop; + sqInt oop1; + sqInt oop2; - m3 = stackMatrix(0); - m2 = stackMatrix(1); - m1 = stackMatrix(2); + /* begin stackMatrix: */ + oop = stackValue(0); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + m3 = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + m3 = ((void *) null); + l1: /* end stackMatrix: */; + /* begin stackMatrix: */ + oop1 = stackValue(1); + if ((isWords(oop1)) + && ((slotSizeOf(oop1)) == 16)) { + m2 = firstIndexableField(oop1); + goto l2; + } + primitiveFail(); + m2 = ((void *) null); + l2: /* end stackMatrix: */; + /* begin stackMatrix: */ + oop2 = stackValue(2); + if ((isWords(oop2)) + && ((slotSizeOf(oop2)) == 16)) { + m1 = firstIndexableField(oop2); + goto l3; + } + primitiveFail(); + m1 = ((void *) null); + l3: /* end stackMatrix: */; if (((m1 == null) || (m2 == null)) || (m3 == null)) { return primitiveFail(); } @@ -1817,6 +1866,7 @@ EXPORT(sqInt) b3dTransformPoint(void) { float *matrix; + sqInt oop; double rw; double rx; double ry; @@ -1839,7 +1889,16 @@ b3dTransformPoint(void) return primitiveFail(); } vertex = firstIndexableField(v3Oop); - matrix = stackMatrix(1); + /* begin stackMatrix: */ + oop = stackValue(1); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + matrix = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + matrix = ((void *) null); + l1: /* end stackMatrix: */; if (matrix == null) { return primitiveFail(); } @@ -1883,6 +1942,7 @@ EXPORT(sqInt) b3dTransformPrimitiveNormal(void) { float *matrix; + sqInt oop; float *pVertex; sqInt rescale; @@ -1890,7 +1950,16 @@ b3dTransformPrimitiveNormal(void) if (!(rescale == (nilObject()))) { rescale = booleanValueOf(rescale); } - matrix = stackMatrix(1); + /* begin stackMatrix: */ + oop = stackValue(1); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + matrix = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + matrix = ((void *) null); + l1: /* end stackMatrix: */; pVertex = stackPrimitiveVertex(2); if ((matrix == null) || (pVertex == null)) { return primitiveFail(); @@ -1913,9 +1982,19 @@ EXPORT(sqInt) b3dTransformPrimitivePosition(void) { float *matrix; + sqInt oop; float *pVertex; - matrix = stackMatrix(0); + /* begin stackMatrix: */ + oop = stackValue(0); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + matrix = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + matrix = ((void *) null); + l1: /* end stackMatrix: */; pVertex = stackPrimitiveVertex(1); if ((matrix == null) || (pVertex == null)) { return primitiveFail(); @@ -1934,9 +2013,19 @@ EXPORT(sqInt) b3dTransformPrimitiveRasterPosition(void) { float *matrix; + sqInt oop; float *pVertex; - matrix = stackMatrix(0); + /* begin stackMatrix: */ + oop = stackValue(0); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + matrix = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + matrix = ((void *) null); + l1: /* end stackMatrix: */; pVertex = stackPrimitiveVertex(1); if ((matrix == null) || (pVertex == null)) { return primitiveFail(); @@ -1960,6 +2049,8 @@ b3dTransformVertexBuffer(void) sqInt i; float *modelViewMatrix; sqInt mvFlags; + sqInt oop; + sqInt oop1; sqInt prFlags; float *projectionMatrix; float *pVertex; @@ -1969,8 +2060,26 @@ b3dTransformVertexBuffer(void) rescale = 0; flags = stackIntegerValue(0); - projectionMatrix = stackMatrix(1); - modelViewMatrix = stackMatrix(2); + /* begin stackMatrix: */ + oop = stackValue(1); + if ((isWords(oop)) + && ((slotSizeOf(oop)) == 16)) { + projectionMatrix = firstIndexableField(oop); + goto l1; + } + primitiveFail(); + projectionMatrix = ((void *) null); + l1: /* end stackMatrix: */; + /* begin stackMatrix: */ + oop1 = stackValue(2); + if ((isWords(oop1)) + && ((slotSizeOf(oop1)) == 16)) { + modelViewMatrix = firstIndexableField(oop1); + goto l2; + } + primitiveFail(); + modelViewMatrix = ((void *) null); + l2: /* end stackMatrix: */; vtxCount = stackIntegerValue(3); vtxArray = stackPrimitiveVertexArrayofSize(4, vtxCount); if (((projectionMatrix == null) || (modelViewMatrix == null)) || (vtxArray == null)) { @@ -2022,7 +2131,7 @@ b3dTransformVertexBuffer(void) pVertex += PrimVertexSize; } } - goto l1; + goto l3; } if ((((mvFlags & prFlags) & FlagM44Identity) != 0)) { @@ -2034,7 +2143,7 @@ b3dTransformVertexBuffer(void) pVertex[PrimVtxRasterPosW] = 1.0; pVertex += PrimVertexSize; } - goto l1; + goto l3; } if (((mvFlags & FlagM44Identity) != 0)) { @@ -2043,7 +2152,7 @@ b3dTransformVertexBuffer(void) transformPrimitiveRasterPositionby(pVertex, projectionMatrix); pVertex += PrimVertexSize; } - goto l1; + goto l3; } if (((prFlags & FlagM44Identity) != 0)) { @@ -2070,7 +2179,7 @@ b3dTransformVertexBuffer(void) pVertex[PrimVtxRasterPosW] = 1.0; pVertex += PrimVertexSize; } - goto l1; + goto l3; } for (i = 1; i <= vtxCount; i += 1) { if (hasNormals) { @@ -2080,7 +2189,7 @@ b3dTransformVertexBuffer(void) transformPrimitiveRasterPositionby(pVertex, projectionMatrix); pVertex += PrimVertexSize; } - l1: /* end transformVB:count:by:and:flags: */; + l3: /* end transformVB:count:by:and:flags: */; pop(5); return 0; } @@ -3673,27 +3782,6 @@ stackMaterialValue(sqInt stackIndex) } -/* Load a 4x4 transformation matrix from the interpreter stack. - Return a pointer to the matrix data if successful, nil otherwise. */ - - /* B3DEnginePlugin>>#stackMatrix: */ -static void* -stackMatrix(sqInt index) -{ - sqInt oop; - - oop = stackObjectValue(index); - if (oop == null) { - return null; - } - if ((isWords(oop)) - && ((slotSizeOf(oop)) == 16)) { - return firstIndexableField(oop); - } - return null; -} - - /* Load a primitive index array from the interpreter stack. If aBool is true then check that all the indexes are in the range (1,maxIndex). Return a pointer to the index data if successful, nil @@ -4187,65 +4275,62 @@ vbLoadArraysize(sqInt oop, sqInt count) static char _m[] = "Squeak3D"; void* Squeak3D_exports[][3] = { - {(void*)_m, "b3dClipPolygon\000\001", (void*)b3dClipPolygon}, - {(void*)_m, "b3dComputeMinIndexZ\000\001", (void*)b3dComputeMinIndexZ}, - {(void*)_m, "b3dComputeMinZ\000\001", (void*)b3dComputeMinZ}, - {(void*)_m, "b3dDetermineClipFlags\000\001", (void*)b3dDetermineClipFlags}, - {(void*)_m, "b3dInitializeRasterizerState\000\001", (void*)b3dInitializeRasterizerState}, - {(void*)_m, "b3dInitPrimitiveObject\000\001", (void*)b3dInitPrimitiveObject}, - {(void*)_m, "b3dInplaceHouseHolderInvert\000\000", (void*)b3dInplaceHouseHolderInvert}, - {(void*)_m, "b3dLoadIndexArray\000\000", (void*)b3dLoadIndexArray}, - {(void*)_m, "b3dLoadVertexBuffer\000\000", (void*)b3dLoadVertexBuffer}, - {(void*)_m, "b3dMapVertexBuffer\000\001", (void*)b3dMapVertexBuffer}, - {(void*)_m, "b3dOrthoNormInverseMatrix\000\001", (void*)b3dOrthoNormInverseMatrix}, - {(void*)_m, "b3dPrimitiveNextClippedTriangle\000\001", (void*)b3dPrimitiveNextClippedTriangle}, - {(void*)_m, "b3dPrimitiveObjectSize\000\377", (void*)b3dPrimitiveObjectSize}, - {(void*)_m, "b3dPrimitiveTextureSize\000\377", (void*)b3dPrimitiveTextureSize}, - {(void*)_m, "b3dRasterizerVersion\000\377", (void*)b3dRasterizerVersion}, - {(void*)_m, "b3dShaderVersion\000\377", (void*)b3dShaderVersion}, - {(void*)_m, "b3dShadeVertexBuffer\000\001", (void*)b3dShadeVertexBuffer}, - {(void*)_m, "b3dStartRasterizer\000\002", (void*)b3dStartRasterizer}, - {(void*)_m, "b3dTransformDirection\000\001", (void*)b3dTransformDirection}, - {(void*)_m, "b3dTransformerVersion\000\377", (void*)b3dTransformerVersion}, - {(void*)_m, "b3dTransformMatrixWithInto\000\000", (void*)b3dTransformMatrixWithInto}, - {(void*)_m, "b3dTransformPoint\000\001", (void*)b3dTransformPoint}, - {(void*)_m, "b3dTransformPrimitiveNormal\000\000", (void*)b3dTransformPrimitiveNormal}, - {(void*)_m, "b3dTransformPrimitivePosition\000\000", (void*)b3dTransformPrimitivePosition}, - {(void*)_m, "b3dTransformPrimitiveRasterPosition\000\000", (void*)b3dTransformPrimitiveRasterPosition}, - {(void*)_m, "b3dTransformVertexBuffer\000\001", (void*)b3dTransformVertexBuffer}, - {(void*)_m, "b3dTransposeMatrix\000\001", (void*)b3dTransposeMatrix}, + {(void*)_m, "b3dClipPolygon", (void*)b3dClipPolygon}, + {(void*)_m, "b3dComputeMinIndexZ", (void*)b3dComputeMinIndexZ}, + {(void*)_m, "b3dComputeMinZ", (void*)b3dComputeMinZ}, + {(void*)_m, "b3dDetermineClipFlags", (void*)b3dDetermineClipFlags}, + {(void*)_m, "b3dInitializeRasterizerState", (void*)b3dInitializeRasterizerState}, + {(void*)_m, "b3dInitPrimitiveObject", (void*)b3dInitPrimitiveObject}, + {(void*)_m, "b3dInplaceHouseHolderInvert", (void*)b3dInplaceHouseHolderInvert}, + {(void*)_m, "b3dLoadIndexArray", (void*)b3dLoadIndexArray}, + {(void*)_m, "b3dLoadVertexBuffer", (void*)b3dLoadVertexBuffer}, + {(void*)_m, "b3dMapVertexBuffer", (void*)b3dMapVertexBuffer}, + {(void*)_m, "b3dOrthoNormInverseMatrix", (void*)b3dOrthoNormInverseMatrix}, + {(void*)_m, "b3dPrimitiveNextClippedTriangle", (void*)b3dPrimitiveNextClippedTriangle}, + {(void*)_m, "b3dPrimitiveObjectSize", (void*)b3dPrimitiveObjectSize}, + {(void*)_m, "b3dPrimitiveTextureSize", (void*)b3dPrimitiveTextureSize}, + {(void*)_m, "b3dRasterizerVersion", (void*)b3dRasterizerVersion}, + {(void*)_m, "b3dShaderVersion", (void*)b3dShaderVersion}, + {(void*)_m, "b3dShadeVertexBuffer", (void*)b3dShadeVertexBuffer}, + {(void*)_m, "b3dStartRasterizer", (void*)b3dStartRasterizer}, + {(void*)_m, "b3dTransformDirection", (void*)b3dTransformDirection}, + {(void*)_m, "b3dTransformerVersion", (void*)b3dTransformerVersion}, + {(void*)_m, "b3dTransformMatrixWithInto", (void*)b3dTransformMatrixWithInto}, + {(void*)_m, "b3dTransformPoint", (void*)b3dTransformPoint}, + {(void*)_m, "b3dTransformPrimitiveNormal", (void*)b3dTransformPrimitiveNormal}, + {(void*)_m, "b3dTransformPrimitivePosition", (void*)b3dTransformPrimitivePosition}, + {(void*)_m, "b3dTransformPrimitiveRasterPosition", (void*)b3dTransformPrimitiveRasterPosition}, + {(void*)_m, "b3dTransformVertexBuffer", (void*)b3dTransformVertexBuffer}, + {(void*)_m, "b3dTransposeMatrix", (void*)b3dTransposeMatrix}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveSetBitBltPlugin\000\001", (void*)primitiveSetBitBltPlugin}, + {(void*)_m, "primitiveSetBitBltPlugin\000\001\000", (void*)primitiveSetBitBltPlugin}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) b3dClipPolygonAccessorDepth = 1; -EXPORT(signed char) b3dComputeMinIndexZAccessorDepth = 1; -EXPORT(signed char) b3dComputeMinZAccessorDepth = 1; -EXPORT(signed char) b3dDetermineClipFlagsAccessorDepth = 1; -EXPORT(signed char) b3dInitializeRasterizerStateAccessorDepth = 1; -EXPORT(signed char) b3dInitPrimitiveObjectAccessorDepth = 1; -EXPORT(signed char) b3dInplaceHouseHolderInvertAccessorDepth = 0; -EXPORT(signed char) b3dLoadIndexArrayAccessorDepth = 0; -EXPORT(signed char) b3dLoadVertexBufferAccessorDepth = 0; -EXPORT(signed char) b3dMapVertexBufferAccessorDepth = 1; -EXPORT(signed char) b3dOrthoNormInverseMatrixAccessorDepth = 1; -EXPORT(signed char) b3dPrimitiveNextClippedTriangleAccessorDepth = 1; -EXPORT(signed char) b3dShadeVertexBufferAccessorDepth = 1; -EXPORT(signed char) b3dStartRasterizerAccessorDepth = 2; -EXPORT(signed char) b3dTransformDirectionAccessorDepth = 1; -EXPORT(signed char) b3dTransformMatrixWithIntoAccessorDepth = 0; -EXPORT(signed char) b3dTransformPointAccessorDepth = 1; -EXPORT(signed char) b3dTransformPrimitiveNormalAccessorDepth = 0; -EXPORT(signed char) b3dTransformPrimitivePositionAccessorDepth = 0; -EXPORT(signed char) b3dTransformPrimitiveRasterPositionAccessorDepth = 0; -EXPORT(signed char) b3dTransformVertexBufferAccessorDepth = 1; -EXPORT(signed char) b3dTransposeMatrixAccessorDepth = 1; -EXPORT(signed char) primitiveSetBitBltPluginAccessorDepth = 1; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) b3dClipPolygonMetadata = 0x100; +EXPORT(signed short) b3dComputeMinIndexZMetadata = 0x200; +EXPORT(signed short) b3dComputeMinZMetadata = 0x200; +EXPORT(signed short) b3dDetermineClipFlagsMetadata = 0x200; +EXPORT(signed short) b3dInitializeRasterizerStateMetadata = 0x100; +EXPORT(signed short) b3dInitPrimitiveObjectMetadata = 0x100; +EXPORT(signed short) b3dLoadIndexArrayMetadata = 0; +EXPORT(signed short) b3dLoadVertexBufferMetadata = 0; +EXPORT(signed short) b3dMapVertexBufferMetadata = 0x100; +EXPORT(signed short) b3dOrthoNormInverseMatrixMetadata = 0x100; +EXPORT(signed short) b3dPrimitiveNextClippedTriangleMetadata = 0x100; +EXPORT(signed short) b3dShadeVertexBufferMetadata = 0x100; +EXPORT(signed short) b3dTransformDirectionMetadata = 0x100; +EXPORT(signed short) b3dTransformPointMetadata = 0x100; +EXPORT(signed short) b3dTransformPrimitiveNormalMetadata = 0; +EXPORT(signed short) b3dTransformVertexBufferMetadata = 0x100; +EXPORT(signed short) b3dTransposeMatrixMetadata = 0x100; +EXPORT(signed short) primitiveSetBitBltPluginMetadata = 0x100; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c b/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c index 493e15cf3e..7ece9327a0 100644 --- a/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c +++ b/src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 from - ThreadedARM32FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + ThreadedARM32FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 */ -static char __buildInfo[] = "ThreadedARM32FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "ThreadedARM32FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 " __DATE__ ; #include "config.h" @@ -158,27 +158,30 @@ static char __buildInfo[] = "ThreadedARM32FFIPlugin VMMaker.oscog-eem.2985 uuid: #define FFIStructSizeMask 0xFFFF #define FFITypeBool 1 #define FFITypeDoubleFloat 13 -#define FFITypeSignedByte 3 -#define FFITypeSignedChar 11 -#define FFITypeSignedInt 7 -#define FFITypeSignedLongLong 9 -#define FFITypeSignedShort 5 +#define FFITypeSignedChar32 11 +#define FFITypeSignedChar8 11 +#define FFITypeSignedInt16 5 +#define FFITypeSignedInt32 7 +#define FFITypeSignedInt64 9 +#define FFITypeSignedInt8 3 #define FFITypeSingleFloat 12 -#define FFITypeUnsignedByte 2 -#define FFITypeUnsignedInt 6 -#define FFITypeUnsignedLongLong 8 -#define FFITypeUnsignedShort 4 +#define FFITypeUnsignedInt16 4 +#define FFITypeUnsignedInt32 6 +#define FFITypeUnsignedInt64 8 +#define FFITypeUnsignedInt8 2 #define FFITypeVoid 0 #define MaxNumArgs 15 #define NumFloatRegArgs 16 #define NumIntRegArgs 4 -#define PluginVersionInfo " VMMaker.oscog-eem.2985" +#define PluginVersionInfo " VMMaker.oscog-eem.3041" #define PrimErrBadArgument 3 +#define PrimErrBadIndex 4 #define PrimErrBadMethod 12 #define PrimErrBadNumArgs 5 #define PrimErrBadReceiver 2 #define PrimErrFFIException 22 #define PrimErrNoCMemory 10 +#define PrimErrNoMemory 9 #define PrimErrNotFound 11 #define PrimErrObjectMayMove 14 #if !defined(SPURVM) /* Allow this to be overridden on the compiler command line */ @@ -230,46 +233,22 @@ typedef struct { char pad_to_misalgnment; struct {char c; } element; } structStr /*** Function Prototypes ***/ static sqInt alignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt *indexPtr); static sqInt atomicTypeOf(sqInt typeSpec); -static sqInt canReturnInRegistersStructOfSize(sqInt returnStructSize); static sqInt checkAlignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static sqInt checkAlignmentOfUnionSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static void cleanupCalloutState(CalloutState *calloutState); -static sqInt encodeStructReturnTypeIn(CalloutState *calloutState); static void * ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize); static sqInt ffiArgByValuein(sqInt oop, CalloutState *calloutState); static sqInt ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *calloutState); -static sqInt ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); -static sqInt ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); static sqInt ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs); static sqInt ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState); -static sqInt ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode); -static sqInt ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState); static sqInt ffiFail(sqInt reason); -static double ffiFloatValueOf(sqInt oop); static sqInt ffiIntegerValueOf(sqInt oop); static sqInt ffiLoadCalloutAddressFrom(sqInt oop); -static sqInt ffiLoadCalloutAddress(sqInt lit); static sqInt ffiLoadCalloutModule(sqInt module); static void ffiLogCallout(sqInt lit); EXPORT(sqInt) ffiLogCallsTo(char *fileName); static sqInt ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushPointerin(void *pointer, CalloutState *calloutState); -static sqInt ffiPushSignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState); -static sqInt ffiPushSignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState); static sqInt ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState); -static sqInt ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState); -static sqInt ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushVoidin(sqInt ignored, CalloutState *calloutState); static sqInt ffiReturnCStringFrom(sqInt cPointer); static sqInt ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutState); static sqInt ffiReturnStructofTypein(void *longLongRetPtr, sqInt ffiRetType, CalloutState *calloutState); @@ -289,6 +268,8 @@ EXPORT(void) primitiveCalloutWithArgs(void); EXPORT(sqInt) primitiveCDataModel(void); EXPORT(sqInt) primitiveCreateManualSurface(void); EXPORT(sqInt) primitiveDestroyManualSurface(void); +EXPORT(sqInt) primitiveExternalAddressAsInteger(void); +EXPORT(sqInt) primitiveExternalAddressFromInteger(void); EXPORT(sqInt) primitiveFFIAllocate(void); EXPORT(sqInt) primitiveFFIDoubleAt(void); EXPORT(sqInt) primitiveFFIDoubleAtPut(void); @@ -301,9 +282,25 @@ EXPORT(sqInt) primitiveFFIIntegerAtPut(void); EXPORT(sqInt) primitiveForceLoad(void); EXPORT(sqInt) primitiveLoadSymbolFromModule(void); EXPORT(sqInt) primitiveLogCallsTo(void); +EXPORT(sqInt) primitivePluginVersion(void); EXPORT(sqInt) primitiveSetManualSurfacePointer(void); +EXPORT(sqInt) primitiveSignedInt16At(void); +EXPORT(sqInt) primitiveSignedInt16AtPut(void); +EXPORT(sqInt) primitiveSignedInt32At(void); +EXPORT(sqInt) primitiveSignedInt32AtPut(void); +EXPORT(sqInt) primitiveSignedInt64At(void); +EXPORT(sqInt) primitiveSignedInt64AtPut(void); +EXPORT(sqInt) primitiveSignedInt8At(void); +EXPORT(sqInt) primitiveSignedInt8AtPut(void); EXPORT(sqInt) primitiveStructureElementAlignment(void); -static sqInt returnStructInRegisters(CalloutState *calloutState); +EXPORT(sqInt) primitiveUnsignedInt16At(void); +EXPORT(sqInt) primitiveUnsignedInt16AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt32At(void); +EXPORT(sqInt) primitiveUnsignedInt32AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt64At(void); +EXPORT(sqInt) primitiveUnsignedInt64AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt8At(void); +EXPORT(sqInt) primitiveUnsignedInt8AtPut(void); EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); static sqInt sizeField(sqInt alienOop); static sqInt startOfData(sqInt alienOop); @@ -417,6 +414,7 @@ static sqInt (*primitiveFailForOSError)(sqLong osError); static sqInt (*primitiveMethod)(void); static sqInt (*pushRemappableOop)(sqInt oop); static sqInt (*signed32BitIntegerFor)(sqInt integerValue); +static int (*signed32BitValueOf)(sqInt oop); static sqInt (*signed64BitIntegerFor)(sqLong integerValue); static sqLong (*signed64BitValueOf)(sqInt oop); static sqIntptr_t (*signedMachineIntegerValueOf)(sqInt oop); @@ -522,6 +520,7 @@ extern sqInt primitiveFailForOSError(sqLong osError); extern sqInt primitiveMethod(void); extern sqInt pushRemappableOop(sqInt oop); extern sqInt signed32BitIntegerFor(sqInt integerValue); +extern int signed32BitValueOf(sqInt oop); extern sqInt signed64BitIntegerFor(sqLong integerValue); extern sqLong signed64BitValueOf(sqInt oop); extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); @@ -536,7 +535,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ARM32FFIPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "ARM32FFIPlugin VMMaker.oscog-eem.3041 " INT_EXT; /*** Macros ***/ @@ -604,16 +603,6 @@ atomicTypeOf(sqInt typeSpec) } -/* Answer if a struct result of a given size is returned in registers or not. */ - - /* ThreadedARM32FFIPlugin>>#canReturnInRegistersStructOfSize: */ -static sqInt -canReturnInRegistersStructOfSize(sqInt returnStructSize) -{ - return returnStructSize <= BytesPerWord; -} - - /* Check the alignment of a structure and return true if correctly aligned. If computed size = declared size, then the struct is assumed correctly aligned. @@ -712,17 +701,6 @@ cleanupCalloutState(CalloutState *calloutState) } -/* Set the return type to true if returning the struct via register */ - - /* ThreadedARM32FFIPlugin>>#encodeStructReturnTypeIn: */ -static sqInt -encodeStructReturnTypeIn(CalloutState *calloutState) -{ - (calloutState->structReturnType = ((calloutState->structReturnSize)) <= BytesPerWord); - return 0; -} - - /* Answer a long of the address of the byteSize slot (byte, short, int, whatever) at byteOffset in rcvr. Nominally intended for use with ExternalAddress objects, this code will @@ -737,17 +715,14 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) sqInt rcvrClass; sqInt rcvrSize; - if (!(isBytes(rcvr))) { - return 0; - } if (!(byteOffset > 0)) { - return 0; + return null; } rcvrClass = fetchClassOf(rcvr); rcvrSize = byteSizeOf(rcvr); if (rcvrClass == (classExternalAddress())) { if (!(rcvrSize == BytesPerWord)) { - return 0; + return null; } /* Hack!! */ @@ -756,17 +731,16 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) if (addr == 0) { /* or: [(interpreterProxy isInMemory: addr) or: [(interpreterProxy isPinned: rcvr) not]] */ - return 0; + return null; } } else { if (!(((byteOffset + byteSize) - 1) <= rcvrSize)) { - return 0; + return null; } addr = ((sqIntptr_t) (firstIndexableField(rcvr))); } - addr = (addr + byteOffset) - 1; - return ((void *)addr); + return ((void *)((addr + byteOffset) - 1)); } @@ -780,6 +754,8 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) double floatValue; sqInt intValue; sqInt typeSpec; + usqLong value; + sqLong value1; /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiArgHeader); @@ -791,7 +767,7 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) if (atomicType < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = oop; @@ -866,27 +842,188 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { + (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); + ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) ((value) >> 32))); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); + } + else { + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + (calloutState->integerRegisterIndex = NumIntRegArgs); + longAtput((calloutState->currentArg), ((usqInt) value)); + longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) ((value) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { + (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value1)); + ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) (((usqLong)(value1)) >> 32))); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); + } + else { + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + (calloutState->integerRegisterIndex = NumIntRegArgs); + longAtput((calloutState->currentArg), ((usqInt) value1)); + longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) (((usqLong)(value1)) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + } + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; default: error("Case not found"); @@ -992,6 +1129,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c sqInt typeSpec; sqInt typeSpec1; sqInt typeSpec2; + usqLong value; + sqLong value1; sqInt valueOop; sqInt valueOop1; @@ -1232,8 +1371,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { err = FFIErrorCoercionFailed; goto l3; @@ -1259,7 +1398,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) ? 0 : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* string value (char*) */ /* note: the only types allowed for passing into char* types are @@ -1298,7 +1437,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } return 0; } - atomicType1 = FFITypeUnsignedByte; + atomicType1 = FFITypeUnsignedInt8; } # if COGMTVM @@ -1313,7 +1452,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } # endif // COGMTVM if ((atomicType1 == FFITypeVoid) - || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { + || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedInt8)) >> 1))) { /* byte* -- see comment on string above */ if (isString @@ -1446,7 +1585,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c if (atomicType2 < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = valueOop; @@ -1521,27 +1660,188 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { + (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); + ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) ((value) >> 32))); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); + } + else { + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + (calloutState->integerRegisterIndex = NumIntRegArgs); + longAtput((calloutState->currentArg), ((usqInt) value)); + longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) ((value) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { + (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value1)); + ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) (((usqLong)(value1)) >> 32))); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); + } + else { + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + (calloutState->integerRegisterIndex = NumIntRegArgs); + longAtput((calloutState->currentArg), ((usqInt) value1)); + longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) (((usqLong)(value1)) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + } + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; default: error("Case not found"); @@ -1604,302 +1904,25 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } -/* Support for generic callout. Prepare a pointer reference to an atomic type - for callout. - Note: - for type 'void*' we allow ByteArray/String/Symbol, wordVariableSubclass, - Alien or ExternalAddress. - for other types we allow ByteArray, wordVariableSubclass, Alien or - ExternalAddress. - */ +/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes + args from the stack + and the spec from the method. If argArrayOrNil is not nil takes args from + argArrayOrNil and the spec from the receiver. */ - /* ThreadedFFIPlugin>>#ffiAtomicArgByReference:Class:in: */ + /* ThreadedFFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ static sqInt -ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) +ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) { - sqInt argIsAlien; - sqInt atomicType; - char *copy; - sqInt isString; - sqInt length; - char *pointer; - void *pointer1; - void *pointer2; - void *pointer3; - void *pointer4; - void *pointer5; - void *pointer6; - sqInt typeSpec; - - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType == FFITypeBool) { - - /* No bools on input */ - return FFIErrorCoercionFailed; - } - argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) - ? 0 - : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { - - /* string value (char*) */ - /* note: the only types allowed for passing into char* types are - ByteArray, String, Symbol, Alien and *no* other byte indexed objects - (e.g., CompiledMethod, LargeInteger). We only check for strings - here and fall through to the byte* check otherwise. */ - if (isString) { - - /* String/Symbol */ - /* Strings must be allocated by the ffi support code */ - /* begin ffiPushString:OfLength:in: */ - pointer = firstIndexableField(oop); - length = byteSizeOf(oop); - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - atomicType = FFITypeUnsignedByte; - } -# if COGMTVM - - /* Since all the following pass the address of the first indexable field we need to fail - the call if it is threaded and the object is young, since it may move during the call. */ - if ((((((calloutState->callFlags)) & FFICallFlagThreaded) != 0)) - && (((!argIsAlien) - || ((assert(isAlien(oop)), - (longAt(oop + BaseHeaderSize)) > 0))) - && (isYoung(oop)))) { - return -PrimErrObjectMayMove; - } -# endif // COGMTVM - if ((atomicType == FFITypeVoid) - || ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { - - /* byte* -- see comment on string above */ - if (isString - || (oopClass == (classByteArray()))) { - - /* String/Symbol/ByteArray */ - /* begin ffiPushPointer:in: */ - pointer1 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer1)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer1); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer2 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer2)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer2); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer3 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer3)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer3); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (!(atomicType == FFITypeVoid)) { - return FFIErrorCoercionFailed; - } - } - if (atomicType <= FFITypeDoubleFloat) { - if ((isWords(oop)) - || (oopClass == (classByteArray()))) { - /* begin ffiPushPointer:in: */ - pointer4 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer4)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer4); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer5 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer5)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer5); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer6 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer6)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer6); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - } - return FFIErrorCoercionFailed; -} - - -/* Support for generic callout. Prepare an external pointer reference to an - atomic type for callout. - */ - - /* ThreadedFFIPlugin>>#ffiAtomicStructByReference:Class:in: */ -static sqInt -ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) -{ - sqInt atomicType; - sqInt err; - sqInt ptrType; - sqInt spec; - sqInt specOop; - sqInt specType; - sqInt typeSpec; - sqInt valueOop; - - - /* must be external data to pass pointers to atomic type */ - if (!(oopClass == (classExternalData()))) { - return FFIErrorCoercionFailed; - } - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType != FFITypeVoid) { - /* begin ffiValidateExternalData:AtomicType: */ - ptrType = fetchPointerofObject(1, oop); - if (!((isPointers(ptrType)) - && ((slotSizeOf(ptrType)) >= 2))) { - err = FFIErrorWrongType; - goto l3; - } - specOop = fetchPointerofObject(0, ptrType); - if (!((isWords(specOop)) - && ((slotSizeOf(specOop)) > 0))) { - err = FFIErrorWrongType; - goto l3; - } - spec = fetchPointerofObject(0, specOop); - if (!(((spec & FFIFlagAtomic) != 0))) { - err = FFIErrorWrongType; - goto l3; - } - /* begin atomicTypeOf: */ - specType = ((usqInt)((spec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (specType != atomicType) { - - /* Allow for signed/unsigned conversion but nothing else. - See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) - && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { - err = FFIErrorCoercionFailed; - goto l3; - } - } - err = 0; - l3: /* end ffiValidateExternalData:AtomicType: */; - if (err != 0) { - return err; - } - } - valueOop = fetchPointerofObject(0, oop); - return ffiPushPointerContentsOfin(valueOop, calloutState); -} - - -/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes - args from the stack - and the spec from the method. If argArrayOrNil is not nil takes args from - argArrayOrNil and the spec from the receiver. */ - - /* ThreadedFFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ -static sqInt -ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) -{ - sqInt address; - sqInt address1; - sqInt addressPtr; - char *allocation; - sqInt argClass; - sqInt argSpec; - sqInt argType; - sqInt argTypeArray; - sqInt argTypes; - sqInt argTypes1; + sqInt address; + sqInt address1; + sqInt addressPtr; + char *allocation; + sqInt argClass; + sqInt argSpec; + sqInt argType; + sqInt argTypeArray; + sqInt argTypes; + sqInt argTypes1; sqInt atomicType; sqInt atomicType1; sqInt byteSize; @@ -2166,7 +2189,7 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -2275,18 +2298,18 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : trueObject()); goto l10; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -2308,19 +2331,14 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : positive32BitIntegerFor(intRet))); goto l10; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l10; } -# if SPURVM - result = characterObjectOf(intRet & 0x3FFFFFFF); - goto l10; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result = characterObjectOf(intRet & 0xFF); - goto l10; -# endif l10: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -2362,87 +2380,6 @@ ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState) } -/* Make sure that the given oop is a valid external handle */ - - /* ThreadedFFIPlugin>>#ffiContentsOfHandle:errCode: */ -static sqInt -ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode) -{ - if (!((isBytes(oop)) - && ((byteSizeOf(oop)) == (sizeof(sqInt))))) { - return ffiFail(errCode); - } - return fetchPointerofObject(0, oop); -} - - -/* Callout support. Return the appropriate oop for the given atomic type */ - - /* ThreadedFFIPlugin>>#ffiCreateIntegralResultOop:ofAtomicType:in: */ -static sqInt -ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState) -{ - sqInt byteSize; - usqLong mask; - sqInt shift; - usqLong value; - - assert(atomicType < FFITypeSingleFloat); - if (atomicType == FFITypeBool) { - - /* Make sure bool honors the byte size requested */ - byteSize = ((calloutState->ffiRetHeader)) & FFIStructSizeMask; - value = (byteSize == (sizeof(retVal)) - ? retVal - : retVal & (((((unsigned long long)1)) << (byteSize * 8)) - 1)); - return (value == 0 - ? falseObject() - : trueObject()); - } - if (atomicType <= FFITypeSignedInt) { - - /* these are all generall integer returns */ - if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { - - /* byte/short. first extract partial word, then sign extend */ - - /* # of significant bits */ - shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) - ? 32 - : (((usqInt)(atomicType)) >> 1) * 8); - value = retVal & (((((unsigned long long)1)) << shift) - 1); - if (((atomicType & 1) != 0)) { - - /* make the guy signed */ - mask = (((unsigned long long)1)) << (shift - 1); - value = (value & (mask - 1)) - (value & mask); - } - return integerObjectOf(value); - } - return (((atomicType & 1) != 0) - ? (BytesPerWord == 8 - ? signed64BitIntegerFor(retVal) - : signed32BitIntegerFor(retVal)) - : (BytesPerWord == 8 - ? positive64BitIntegerFor(retVal) - : positive32BitIntegerFor(retVal))); - } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { - return (((atomicType & 1) != 0) - ? signed64BitIntegerFor(retVal) - : positive64BitIntegerFor(retVal)); - } -# if SPURVM - return characterObjectOf(retVal & 0x3FFFFFFF); -# else - return characterObjectOf(retVal & 0xFF); -# endif -} - - /* Map the FFI error code into a primitive error code. If reason is negative it encodes one of the standard PrimErr... codes, negated to distinguish it from the FFIError @@ -2466,21 +2403,6 @@ ffiFail(sqInt reason) } -/* Support for generic callout. Return a float value that is coerced as C - would do. - */ - - /* ThreadedFFIPlugin>>#ffiFloatValueOf: */ -static double -ffiFloatValueOf(sqInt oop) -{ - if (isFloatObject(oop)) { - return floatValueOf(oop); - } - return ((double) (ffiIntegerValueOf(oop)) ); -} - - /* Support for generic callout. Answer an integer value that is coerced as C would do. */ @@ -2573,52 +2495,6 @@ ffiLoadCalloutAddressFrom(sqInt oop) } -/* Load the address of the foreign function from the given object */ - - /* ThreadedFFIPlugin>>#ffiLoadCalloutAddress: */ -static sqInt -ffiLoadCalloutAddress(sqInt lit) -{ - sqInt address; - sqInt addressPtr; - sqIntptr_t *ptr; - - - /* Lookup the address */ - - /* Make sure it's an external handle */ - addressPtr = fetchPointerofObject(0, lit); - /* begin ffiContentsOfHandle:errCode: */ - if (!((isBytes(addressPtr)) - && ((byteSizeOf(addressPtr)) == (sizeof(sqInt))))) { - address = ffiFail(FFIErrorBadAddress); - goto l1; - } - address = fetchPointerofObject(0, addressPtr); - l1: /* end ffiContentsOfHandle:errCode: */; - if (failed()) { - return 0; - } - if (address == 0) { - - /* Go look it up in the module */ - if (externalFunctionInstSize > ExternalFunctionStackSizeIndex) { - storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, lit, -1); - } - if ((slotSizeOf(lit)) < 5) { - return ffiFail(FFIErrorNoModule); - } - address = ffiLoadCalloutAddressFrom(lit); - if (failed()) { - return 0; - } - ptr = firstIndexableField(addressPtr); - ptr[0] = address; - } - return address; -} - - /* Load the given module and return its handle */ /* ThreadedFFIPlugin>>#ffiLoadCalloutModule: */ @@ -2814,200 +2690,12 @@ ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedARM32FFIPlugin>>#ffiPushPointer:in: */ + +/* Push the contents of the given external structure */ + + /* ThreadedFFIPlugin>>#ffiPushStructureContentsOf:in: */ static sqInt -ffiPushPointerin(void *pointer, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedByte:in: */ -static sqInt -ffiPushSignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedChar:in: */ -static sqInt -ffiPushSignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedInt:in: */ -static sqInt -ffiPushSignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - -/* Push a longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushSignedLongLongOop:in: */ -static sqInt -ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - sqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = signed64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushSignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { - (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) (((usqLong)(value)) >> 32))); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); - } - else { - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - (calloutState->integerRegisterIndex = NumIntRegArgs); - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) (((usqLong)(value)) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedLongLong:in: */ -static sqInt -ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { - (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) (((usqLong)(value)) >> 32))); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); - } - else { - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - (calloutState->integerRegisterIndex = NumIntRegArgs); - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) (((usqLong)(value)) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedShort:in: */ -static sqInt -ffiPushSignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedFFIPlugin>>#ffiPushString:OfLength:in: */ -static sqInt -ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState) -{ - char *copy; - - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - -/* Push the contents of the given external structure */ - - /* ThreadedFFIPlugin>>#ffiPushStructureContentsOf:in: */ -static sqInt -ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) +ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) { sqInt availableRegisterSpace; sqInt availableRegisterSpace1; @@ -3148,199 +2836,6 @@ ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedARM32FFIPlugin>>#ffiPushStructure:ofSize:typeSpec:ofLength:in: */ -static sqInt -ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState) -{ - sqInt availableRegisterSpace; - sqInt roundedSize; - sqInt stackPartSize; - - availableRegisterSpace = (NumIntRegArgs - ((calloutState->integerRegisterIndex))) * 4; - stackPartSize = structSize; - if (availableRegisterSpace > 0) { - if (structSize <= availableRegisterSpace) { - - /* all in registers */ - stackPartSize = 0; - memcpy(((void *) ((&(((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)])))), pointer, structSize); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + ((((usqInt)((structSize + 3))) >> 2))); - } - else { - - /* If no previous co-processor candidate arg has already been pushed on the stack, then split the struct between registers and stack. - Otherwise push entire struct on stack. */ - if (((calloutState->currentArg)) == ((calloutState->argVector))) { - stackPartSize = structSize - availableRegisterSpace; - memcpy(((void *) ((&(((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)])))), pointer, availableRegisterSpace); - } - else { - availableRegisterSpace = 0; - } - (calloutState->integerRegisterIndex = NumIntRegArgs); - } - } - if (stackPartSize > 0) { - roundedSize = (((stackPartSize + 3) | 3) - 3); - if ((((calloutState->currentArg)) + roundedSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - memcpy((calloutState->currentArg), (&((((char *) pointer))[availableRegisterSpace])), stackPartSize); - (calloutState->currentArg = ((calloutState->currentArg)) + roundedSize); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedByte:in: */ -static sqInt -ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedChar:in: */ -static sqInt -ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedInt:in: */ -static sqInt -ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - -/* Push an unsigned longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushUnsignedLongLongOop:in: */ -static sqInt -ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - usqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = positive64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushUnsignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { - (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) ((value) >> 32))); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); - } - else { - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - (calloutState->integerRegisterIndex = NumIntRegArgs); - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) ((value) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedLongLong:in: */ -static sqInt -ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < (NumIntRegArgs - 1)) { - (calloutState->integerRegisterIndex = (((((calloutState->integerRegisterIndex)) + 1) | 1) - 1)); - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - ((calloutState->integerRegisters))[((calloutState->integerRegisterIndex)) + 1] = (((usqInt) ((value) >> 32))); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 2); - } - else { - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - (calloutState->integerRegisterIndex = NumIntRegArgs); - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + BytesPerWord, ((usqInt) ((value) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedShort:in: */ -static sqInt -ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - -/* This is a fallback in case somebody tries to pass a 'void' value. - We could simply ignore the argument but I think it's better to let - the caller know what he did */ - - /* ThreadedFFIPlugin>>#ffiPushVoid:in: */ -static sqInt -ffiPushVoidin(sqInt ignored, CalloutState *calloutState) -{ - return FFIErrorAttemptToPassVoid; -} - /* Create a Smalltalk string from a zero terminated C string */ @@ -3399,7 +2894,7 @@ ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutSta /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiRetHeader); atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -3561,8 +3056,8 @@ ffiValidateExternalDataAtomicType(sqInt oop, sqInt atomicType) /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { return FFIErrorCoercionFailed; } @@ -4054,7 +3549,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4163,18 +3658,18 @@ primitiveCallout(void) : trueObject()); goto l10; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -4196,19 +3691,14 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet))); goto l10; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l10; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l10; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); - goto l10; -# endif l10: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -4455,7 +3945,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4564,18 +4054,18 @@ primitiveCallout(void) : trueObject()); goto l17; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -4597,19 +4087,14 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet1))); goto l17; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l17; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l17; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); - goto l17; -# endif l17: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState1->stringArgIndex)) > 0) { @@ -4989,7 +4474,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -5098,18 +4583,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l10; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -5131,19 +4616,14 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet))); goto l10; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l10; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l10; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); - goto l10; -# endif l10: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -5396,7 +4876,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -5505,18 +4985,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l17; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -5538,19 +5018,14 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet1))); goto l17; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l17; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l17; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); - goto l17; -# endif l17: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState1->stringArgIndex)) > 0) { @@ -5747,6 +5222,52 @@ primitiveDestroyManualSurface(void) } +/* Answer the address of a 4 byte or 8 byte ExternalAddress. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressAsInteger */ +EXPORT(sqInt) +primitiveExternalAddressAsInteger(void) +{ + sqInt rcvr; + sqInt size; + + rcvr = stackValue(0); + size = byteSizeOf(rcvr); + if (size == 8) { + return methodReturnValue(positive64BitIntegerFor((*((usqLong *) (firstIndexableField(rcvr)))))); + } + if (size == 4) { + return methodReturnValue(positive32BitIntegerFor((*((unsigned int *) (firstIndexableField(rcvr)))))); + } + primitiveFailFor(PrimErrBadReceiver); + return 0; +} + + +/* Answer a 4 byte or 8 byte ExternalAddress with value of the argument. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressFromInteger */ +EXPORT(sqInt) +primitiveExternalAddressFromInteger(void) +{ + sqInt address; + usqIntptr_t value; + + value = positiveMachineIntegerValueOf(stackValue(0)); + if (failed()) { + return primitiveFailFor(PrimErrBadArgument); + } + address = instantiateClassindexableSize(classExternalAddress(), BytesPerWord); + if (address == null) { + return primitiveFailFor(PrimErrNoMemory); + } + else { + (*((usqIntptr_t *) (firstIndexableField(address))) = value); + return methodReturnValue(address); + } +} + + /* Primitive. Allocate an object on the external heap. */ /* ThreadedFFIPlugin>>#primitiveFFIAllocate */ @@ -5773,7 +5294,7 @@ primitiveFFIAllocate(void) } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAt */ EXPORT(sqInt) @@ -5784,22 +5305,23 @@ primitiveFFIDoubleAt(void) double floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(double)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAtPut */ EXPORT(sqInt) @@ -5807,32 +5329,39 @@ primitiveFFIDoubleAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; double floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((double) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((double) (floatValueOf(valueOop))); } else { - floatValue = ((double) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((double) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(double)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAt */ EXPORT(sqInt) @@ -5843,22 +5372,23 @@ primitiveFFIFloatAt(void) float floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(float)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAtPut */ EXPORT(sqInt) @@ -5866,28 +5396,35 @@ primitiveFFIFloatAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; float floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((float) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((float) (floatValueOf(valueOop))); } else { - floatValue = ((float) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((float) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(floatValue)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } @@ -5964,51 +5501,53 @@ primitiveFFIIntegerAt(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (byteSize <= 2) { - if (byteSize == 1) { - value = ((unsigned char) (byteAt(addr))); - } - else { - value = ((unsigned short) (unalignedShortAt(addr))); - } + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - if (byteSize == 4) { - value = ((unsigned int) (unalignedLong32At(addr))); + if (byteSize <= 2) { + if (byteSize == 1) { + value = ((unsigned char) (byteAt(addr))); + } + else { + value = ((unsigned short) (unalignedShortAt(addr))); + } } else { - value = unalignedLong64At(addr); - } - } - if (byteSize < BytesPerWord) { - if (isSigned) { - - /* sign extend value */ - mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); - value = (value & (mask - 1)) - (value & mask); + if (byteSize == 4) { + value = ((unsigned int) (unalignedLong32At(addr))); + } + else { + value = unalignedLong64At(addr); + } } - valueOop = integerObjectOf(value); - } - else { - - /* general 64 bit integer; note these never fail */ - if (isSigned) { - if (byteSize < 8) { + if (byteSize < BytesPerWord) { + if (isSigned) { /* sign extend value */ mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); value = (value & (mask - 1)) - (value & mask); } - valueOop = signed64BitIntegerFor(value); + valueOop = integerObjectOf(value); } else { - valueOop = positive64BitIntegerFor(value); + + /* general 64 bit integer; note these never fail */ + if (isSigned) { + if (byteSize < 8) { + + /* sign extend value */ + mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); + value = (value & (mask - 1)) - (value & mask); + } + valueOop = signed64BitIntegerFor(value); + } + else { + valueOop = positive64BitIntegerFor(value); + } } + return methodReturnValue(valueOop); } - return popthenPush(4, valueOop); } @@ -6042,49 +5581,51 @@ primitiveFFIIntegerAtPut(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (isSigned) { - value = signed64BitValueOf(valueOop); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - value = positive64BitValueOf(valueOop); - } - if (failed()) { - return 0; - } - if (byteSize < 8) { if (isSigned) { - max = (((unsigned long long)1)) << ((8 * byteSize) - 1); - if (!((value >= (0 - max)) - && (value < max))) { - return primitiveFail(); - } + value = signed64BitValueOf(valueOop); } else { - if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { - return primitiveFail(); - } + value = positive64BitValueOf(valueOop); } - } - if (byteSize <= 2) { - if (byteSize == 1) { - byteAtput(addr, value); + if (failed()) { + return 0; } - else { - unalignedShortAtput(addr, value); + if (byteSize < 8) { + if (isSigned) { + max = (((unsigned long long)1)) << ((8 * byteSize) - 1); + if (!((value >= (0 - max)) + && (value < max))) { + return primitiveFail(); + } + } + else { + if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { + return primitiveFail(); + } + } } - } - else { - if (byteSize == 4) { - unalignedLong32Atput(addr, value); + if (byteSize <= 2) { + if (byteSize == 1) { + byteAtput(addr, value); + } + else { + unalignedShortAtput(addr, value); + } } else { - unalignedLong64Atput(addr, value); + if (byteSize == 4) { + unalignedLong32Atput(addr, value); + } + else { + unalignedLong64Atput(addr, value); + } } + return methodReturnValue(valueOop); } - return popthenPush(5, valueOop); } @@ -6210,6 +5751,19 @@ primitiveLogCallsTo(void) } +/* Answer the plugins current version to ensure compatibility with data + structures shared between plugin an image code such as: + - Type codes in FFIConstants + - Known classes in the special-objects array */ + + /* ThreadedFFIPlugin>>#primitivePluginVersion */ +EXPORT(sqInt) +primitivePluginVersion(void) +{ + return methodReturnInteger(1); +} + + /* Create a 'manual surface' data-structure. See the ExternalForm class in the FFI package for example usage. */ /* arguments: name(type, stack offset) @@ -6240,6 +5794,244 @@ primitiveSetManualSurfacePointer(void) } +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16At */ +EXPORT(sqInt) +primitiveSignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16AtPut */ +EXPORT(sqInt) +primitiveSignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -32768) && (value <= 0x7FFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32At */ +EXPORT(sqInt) +primitiveSignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed32BitIntegerFor(((signed int) (unalignedLong32At(addr))))); + } +} + + +/* Store the signed 32-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32AtPut */ +EXPORT(sqInt) +primitiveSignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + int value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64At */ +EXPORT(sqInt) +primitiveSignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed64BitIntegerFor(((sqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64AtPut */ +EXPORT(sqInt) +primitiveSignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 8-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8At */ +EXPORT(sqInt) +primitiveSignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed char) (byteAt(addr)))); + } +} + + +/* Store the signed 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8AtPut */ +EXPORT(sqInt) +primitiveSignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -128) && (value <= 0x7F))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + /* Answer the alignment of an element of an atomic type, or a structure, within a structure on the current platform. */ @@ -6253,28 +6045,40 @@ primitiveStructureElementAlignment(void) typeCode = stackValue(0); if (!((isIntegerObject(typeCode)) - && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedByte) && (typeCode <= FFITypeDoubleFloat))) + && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedInt8) && (typeCode <= FFITypeDoubleFloat))) || (typeCode == FFIFlagStructure)))) { return primitiveFailFor(PrimErrBadArgument); } switch (typeCode) { - case FFITypeUnsignedByte: - case FFITypeSignedByte: + case FFITypeUnsignedInt8: + alignment = (&(((((structByte *) 0))->element))); + break; + + case FFITypeSignedInt8: alignment = (&(((((structByte *) 0))->element))); break; - case FFITypeUnsignedShort: - case FFITypeSignedShort: + case FFITypeUnsignedInt16: + alignment = (&(((((structShort *) 0))->element))); + break; + + case FFITypeSignedInt16: alignment = (&(((((structShort *) 0))->element))); break; - case FFITypeUnsignedInt: - case FFITypeSignedInt: + case FFITypeUnsignedInt32: alignment = (&(((((structInt *) 0))->element))); break; - case FFITypeUnsignedLongLong: - case FFITypeSignedLongLong: + case FFITypeSignedInt32: + alignment = (&(((((structInt *) 0))->element))); + break; + + case FFITypeUnsignedInt64: + alignment = (&(((((structLongLong *) 0))->element))); + break; + + case FFITypeSignedInt64: alignment = (&(((((structLongLong *) 0))->element))); break; @@ -6293,13 +6097,241 @@ primitiveStructureElementAlignment(void) } -/* Return thrue register if structReturnType is true */ +/* Answer the unsigned 16-bit integer starting at the given byte offset + (native endian). + */ - /* ThreadedARM32FFIPlugin>>#returnStructInRegisters: */ -static sqInt -returnStructInRegisters(CalloutState *calloutState) + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16At */ +EXPORT(sqInt) +primitiveUnsignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFFFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32At */ +EXPORT(sqInt) +primitiveUnsignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive32BitIntegerFor(((unsigned int) (unalignedLong32At(addr))))); + } +} + + +/* Store the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64At */ +EXPORT(sqInt) +primitiveUnsignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(usqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive64BitIntegerFor(((usqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt64AtPut(void) { - return (calloutState->structReturnType); + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 8-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8At */ +EXPORT(sqInt) +primitiveUnsignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned char) (byteAt(addr)))); + } +} + + +/* Store the unsigned 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } } @@ -6425,6 +6457,7 @@ setInterpreter(struct VirtualMachine *anInterpreter) primitiveMethod = interpreterProxy->primitiveMethod; pushRemappableOop = interpreterProxy->pushRemappableOop; signed32BitIntegerFor = interpreterProxy->signed32BitIntegerFor; + signed32BitValueOf = interpreterProxy->signed32BitValueOf; signed64BitIntegerFor = interpreterProxy->signed64BitIntegerFor; signed64BitValueOf = interpreterProxy->signed64BitValueOf; signedMachineIntegerValueOf = interpreterProxy->signedMachineIntegerValueOf; @@ -6475,48 +6508,88 @@ void* ARM32FFIPlugin_exports[][3] = { {(void*)_m, "ffiLogCallsTo", (void*)ffiLogCallsTo}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveCallout\000\002", (void*)primitiveCallout}, - {(void*)_m, "primitiveCalloutWithArgs\000\004", (void*)primitiveCalloutWithArgs}, - {(void*)_m, "primitiveCDataModel\000\000", (void*)primitiveCDataModel}, - {(void*)_m, "primitiveCreateManualSurface\000\000", (void*)primitiveCreateManualSurface}, - {(void*)_m, "primitiveDestroyManualSurface\000\000", (void*)primitiveDestroyManualSurface}, - {(void*)_m, "primitiveFFIAllocate\000\001", (void*)primitiveFFIAllocate}, - {(void*)_m, "primitiveFFIDoubleAt\000\001", (void*)primitiveFFIDoubleAt}, - {(void*)_m, "primitiveFFIDoubleAtPut\000\001", (void*)primitiveFFIDoubleAtPut}, - {(void*)_m, "primitiveFFIFloatAt\000\001", (void*)primitiveFFIFloatAt}, - {(void*)_m, "primitiveFFIFloatAtPut\000\001", (void*)primitiveFFIFloatAtPut}, - {(void*)_m, "primitiveFFIFree\000\001", (void*)primitiveFFIFree}, - {(void*)_m, "primitiveFFIGetLastError\000\377", (void*)primitiveFFIGetLastError}, - {(void*)_m, "primitiveFFIIntegerAt\000\001", (void*)primitiveFFIIntegerAt}, - {(void*)_m, "primitiveFFIIntegerAtPut\000\001", (void*)primitiveFFIIntegerAtPut}, - {(void*)_m, "primitiveForceLoad\000\002", (void*)primitiveForceLoad}, - {(void*)_m, "primitiveLoadSymbolFromModule\000\002", (void*)primitiveLoadSymbolFromModule}, - {(void*)_m, "primitiveLogCallsTo\000\000", (void*)primitiveLogCallsTo}, - {(void*)_m, "primitiveSetManualSurfacePointer\000\000", (void*)primitiveSetManualSurfacePointer}, - {(void*)_m, "primitiveStructureElementAlignment\000\000", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveCallout\000\377\000", (void*)primitiveCallout}, + {(void*)_m, "primitiveCalloutWithArgs\000\005\000", (void*)primitiveCalloutWithArgs}, + {(void*)_m, "primitiveCDataModel\000\000\001", (void*)primitiveCDataModel}, + {(void*)_m, "primitiveCreateManualSurface\000\000\000", (void*)primitiveCreateManualSurface}, + {(void*)_m, "primitiveDestroyManualSurface\000\000\000", (void*)primitiveDestroyManualSurface}, + {(void*)_m, "primitiveExternalAddressAsInteger\000\000\001", (void*)primitiveExternalAddressAsInteger}, + {(void*)_m, "primitiveExternalAddressFromInteger\000\377\001", (void*)primitiveExternalAddressFromInteger}, + {(void*)_m, "primitiveFFIAllocate\000\001\000", (void*)primitiveFFIAllocate}, + {(void*)_m, "primitiveFFIDoubleAt\000\001\003", (void*)primitiveFFIDoubleAt}, + {(void*)_m, "primitiveFFIDoubleAtPut\000\001\003", (void*)primitiveFFIDoubleAtPut}, + {(void*)_m, "primitiveFFIFloatAt\000\001\003", (void*)primitiveFFIFloatAt}, + {(void*)_m, "primitiveFFIFloatAtPut\000\001\003", (void*)primitiveFFIFloatAtPut}, + {(void*)_m, "primitiveFFIFree\000\001\000", (void*)primitiveFFIFree}, + {(void*)_m, "primitiveFFIGetLastError\000\377\001", (void*)primitiveFFIGetLastError}, + {(void*)_m, "primitiveFFIIntegerAt\000\001\001", (void*)primitiveFFIIntegerAt}, + {(void*)_m, "primitiveFFIIntegerAtPut\000\001\001", (void*)primitiveFFIIntegerAtPut}, + {(void*)_m, "primitiveForceLoad\000\002\000", (void*)primitiveForceLoad}, + {(void*)_m, "primitiveLoadSymbolFromModule\000\002\000", (void*)primitiveLoadSymbolFromModule}, + {(void*)_m, "primitiveLogCallsTo\000\000\000", (void*)primitiveLogCallsTo}, + {(void*)_m, "primitivePluginVersion\000\377\001", (void*)primitivePluginVersion}, + {(void*)_m, "primitiveSetManualSurfacePointer\000\000\000", (void*)primitiveSetManualSurfacePointer}, + {(void*)_m, "primitiveSignedInt16At\000\001\001", (void*)primitiveSignedInt16At}, + {(void*)_m, "primitiveSignedInt16AtPut\000\001\001", (void*)primitiveSignedInt16AtPut}, + {(void*)_m, "primitiveSignedInt32At\000\001\001", (void*)primitiveSignedInt32At}, + {(void*)_m, "primitiveSignedInt32AtPut\000\001\001", (void*)primitiveSignedInt32AtPut}, + {(void*)_m, "primitiveSignedInt64At\000\001\001", (void*)primitiveSignedInt64At}, + {(void*)_m, "primitiveSignedInt64AtPut\000\001\001", (void*)primitiveSignedInt64AtPut}, + {(void*)_m, "primitiveSignedInt8At\000\001\001", (void*)primitiveSignedInt8At}, + {(void*)_m, "primitiveSignedInt8AtPut\000\001\001", (void*)primitiveSignedInt8AtPut}, + {(void*)_m, "primitiveStructureElementAlignment\000\000\001", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveUnsignedInt16At\000\001\001", (void*)primitiveUnsignedInt16At}, + {(void*)_m, "primitiveUnsignedInt16AtPut\000\001\001", (void*)primitiveUnsignedInt16AtPut}, + {(void*)_m, "primitiveUnsignedInt32At\000\001\001", (void*)primitiveUnsignedInt32At}, + {(void*)_m, "primitiveUnsignedInt32AtPut\000\001\001", (void*)primitiveUnsignedInt32AtPut}, + {(void*)_m, "primitiveUnsignedInt64At\000\001\001", (void*)primitiveUnsignedInt64At}, + {(void*)_m, "primitiveUnsignedInt64AtPut\000\001\001", (void*)primitiveUnsignedInt64AtPut}, + {(void*)_m, "primitiveUnsignedInt8At\000\001\001", (void*)primitiveUnsignedInt8At}, + {(void*)_m, "primitiveUnsignedInt8AtPut\000\001\001", (void*)primitiveUnsignedInt8AtPut}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveCalloutAccessorDepth = 2; -EXPORT(signed char) primitiveCalloutWithArgsAccessorDepth = 4; -EXPORT(signed char) primitiveCDataModelAccessorDepth = 0; -EXPORT(signed char) primitiveCreateManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveFFIAllocateAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFreeAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveForceLoadAccessorDepth = 2; -EXPORT(signed char) primitiveLoadSymbolFromModuleAccessorDepth = 2; -EXPORT(signed char) primitiveLogCallsToAccessorDepth = 0; -EXPORT(signed char) primitiveSetManualSurfacePointerAccessorDepth = 0; -EXPORT(signed char) primitiveStructureElementAlignmentAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveCalloutWithArgsMetadata = 0x500; +EXPORT(signed short) primitiveCDataModelMetadata = 1; +EXPORT(signed short) primitiveCreateManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveDestroyManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveExternalAddressAsIntegerMetadata = 1; +EXPORT(signed short) primitiveExternalAddressFromIntegerMetadata = -255; +EXPORT(signed short) primitiveFFIAllocateMetadata = 0x100; +EXPORT(signed short) primitiveFFIDoubleAtMetadata = 259; +EXPORT(signed short) primitiveFFIDoubleAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFreeMetadata = 0x100; +EXPORT(signed short) primitiveFFIGetLastErrorMetadata = -255; +EXPORT(signed short) primitiveFFIIntegerAtMetadata = 0x101; +EXPORT(signed short) primitiveFFIIntegerAtPutMetadata = 0x101; +EXPORT(signed short) primitiveForceLoadMetadata = 0x200; +EXPORT(signed short) primitiveLoadSymbolFromModuleMetadata = 0x200; +EXPORT(signed short) primitiveLogCallsToMetadata = 0; +EXPORT(signed short) primitivePluginVersionMetadata = -255; +EXPORT(signed short) primitiveSetManualSurfacePointerMetadata = 0; +EXPORT(signed short) primitiveSignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtPutMetadata = 0x101; +EXPORT(signed short) primitiveStructureElementAlignmentMetadata = 1; +EXPORT(signed short) primitiveUnsignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtPutMetadata = 0x101; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SqueakFFIPrims/ARM64FFIPlugin.c b/src/plugins/SqueakFFIPrims/ARM64FFIPlugin.c index 6a7cdbb89f..edb4856747 100644 --- a/src/plugins/SqueakFFIPrims/ARM64FFIPlugin.c +++ b/src/plugins/SqueakFFIPrims/ARM64FFIPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 from - ThreadedARM64FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + ThreadedARM64FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 */ -static char __buildInfo[] = "ThreadedARM64FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "ThreadedARM64FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 " __DATE__ ; #include "config.h" @@ -158,27 +158,30 @@ static char __buildInfo[] = "ThreadedARM64FFIPlugin VMMaker.oscog-eem.2985 uuid: #define FFIStructSizeMask 0xFFFF #define FFITypeBool 1 #define FFITypeDoubleFloat 13 -#define FFITypeSignedByte 3 -#define FFITypeSignedChar 11 -#define FFITypeSignedInt 7 -#define FFITypeSignedLongLong 9 -#define FFITypeSignedShort 5 +#define FFITypeSignedChar32 11 +#define FFITypeSignedChar8 11 +#define FFITypeSignedInt16 5 +#define FFITypeSignedInt32 7 +#define FFITypeSignedInt64 9 +#define FFITypeSignedInt8 3 #define FFITypeSingleFloat 12 -#define FFITypeUnsignedByte 2 -#define FFITypeUnsignedInt 6 -#define FFITypeUnsignedLongLong 8 -#define FFITypeUnsignedShort 4 +#define FFITypeUnsignedInt16 4 +#define FFITypeUnsignedInt32 6 +#define FFITypeUnsignedInt64 8 +#define FFITypeUnsignedInt8 2 #define FFITypeVoid 0 #define MaxNumArgs 15 #define NumFloatRegArgs 8 #define NumIntRegArgs 8 -#define PluginVersionInfo " VMMaker.oscog-eem.2985" +#define PluginVersionInfo " VMMaker.oscog-eem.3041" #define PrimErrBadArgument 3 +#define PrimErrBadIndex 4 #define PrimErrBadMethod 12 #define PrimErrBadNumArgs 5 #define PrimErrBadReceiver 2 #define PrimErrFFIException 22 #define PrimErrNoCMemory 10 +#define PrimErrNoMemory 9 #define PrimErrNotFound 11 #define PrimErrObjectMayMove 14 #if !defined(SPURVM) /* Allow this to be overridden on the compiler command line */ @@ -229,46 +232,22 @@ typedef struct { char pad_to_misalgnment; struct {char c; } element; } structStr /*** Function Prototypes ***/ static sqInt alignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt *indexPtr); static sqInt atomicTypeOf(sqInt typeSpec); -static sqInt canReturnInRegistersStructOfSize(sqInt returnStructSize); static sqInt checkAlignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static sqInt checkAlignmentOfUnionSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static void cleanupCalloutState(CalloutState *calloutState); -static sqInt encodeStructReturnTypeIn(CalloutState *calloutState); static void * ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize); static sqInt ffiArgByValuein(sqInt oop, CalloutState *calloutState); static sqInt ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *calloutState); -static sqInt ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); -static sqInt ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); static sqInt ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs); static sqInt ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState); -static sqInt ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode); -static sqInt ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState); static sqInt ffiFail(sqInt reason); -static double ffiFloatValueOf(sqInt oop); static sqInt ffiIntegerValueOf(sqInt oop); static sqInt ffiLoadCalloutAddressFrom(sqInt oop); -static sqInt ffiLoadCalloutAddress(sqInt lit); static sqInt ffiLoadCalloutModule(sqInt module); static void ffiLogCallout(sqInt lit); EXPORT(sqInt) ffiLogCallsTo(char *fileName); static sqInt ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushPointerin(void *pointer, CalloutState *calloutState); -static sqInt ffiPushSignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState); -static sqInt ffiPushSignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState); static sqInt ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, unsigned int *argSpec, sqInt argSpecSize, CalloutState *calloutState); -static sqInt ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState); -static sqInt ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushVoidin(sqInt ignored, CalloutState *calloutState); static sqInt ffiReturnCStringFrom(sqInt cPointer); static sqInt ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutState); static sqInt ffiReturnStructofTypein(void *longLongRetPtr, sqInt ffiRetType, CalloutState *calloutState); @@ -283,13 +262,14 @@ static sqInt isAtomicType(sqInt typeSpec); static sqInt isDirectAlien(sqInt oop); static sqInt isUnionSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static sqInt msg(char *s); -static sqInt mustReturnStructOnStack(sqInt returnStructSize); static sqInt nonRegisterStructReturnIsViaImplicitFirstArgument(void); EXPORT(void) primitiveCallout(void); EXPORT(void) primitiveCalloutWithArgs(void); EXPORT(sqInt) primitiveCDataModel(void); EXPORT(sqInt) primitiveCreateManualSurface(void); EXPORT(sqInt) primitiveDestroyManualSurface(void); +EXPORT(sqInt) primitiveExternalAddressAsInteger(void); +EXPORT(sqInt) primitiveExternalAddressFromInteger(void); EXPORT(sqInt) primitiveFFIAllocate(void); EXPORT(sqInt) primitiveFFIDoubleAt(void); EXPORT(sqInt) primitiveFFIDoubleAtPut(void); @@ -302,9 +282,25 @@ EXPORT(sqInt) primitiveFFIIntegerAtPut(void); EXPORT(sqInt) primitiveForceLoad(void); EXPORT(sqInt) primitiveLoadSymbolFromModule(void); EXPORT(sqInt) primitiveLogCallsTo(void); +EXPORT(sqInt) primitivePluginVersion(void); EXPORT(sqInt) primitiveSetManualSurfacePointer(void); +EXPORT(sqInt) primitiveSignedInt16At(void); +EXPORT(sqInt) primitiveSignedInt16AtPut(void); +EXPORT(sqInt) primitiveSignedInt32At(void); +EXPORT(sqInt) primitiveSignedInt32AtPut(void); +EXPORT(sqInt) primitiveSignedInt64At(void); +EXPORT(sqInt) primitiveSignedInt64AtPut(void); +EXPORT(sqInt) primitiveSignedInt8At(void); +EXPORT(sqInt) primitiveSignedInt8AtPut(void); EXPORT(sqInt) primitiveStructureElementAlignment(void); -static sqInt returnStructInRegisters(CalloutState *calloutState); +EXPORT(sqInt) primitiveUnsignedInt16At(void); +EXPORT(sqInt) primitiveUnsignedInt16AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt32At(void); +EXPORT(sqInt) primitiveUnsignedInt32AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt64At(void); +EXPORT(sqInt) primitiveUnsignedInt64AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt8At(void); +EXPORT(sqInt) primitiveUnsignedInt8AtPut(void); EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); static sqInt setReturnRegisterandCallwithArgsArray(sqLong structAddr, sqLong procAddr, sqLong arrayAddr); static sqInt sizeField(sqInt alienOop); @@ -420,6 +416,7 @@ static sqInt (*primitiveFailForOSError)(sqLong osError); static sqInt (*primitiveMethod)(void); static sqInt (*pushRemappableOop)(sqInt oop); static sqInt (*signed32BitIntegerFor)(sqInt integerValue); +static int (*signed32BitValueOf)(sqInt oop); static sqInt (*signed64BitIntegerFor)(sqLong integerValue); static sqLong (*signed64BitValueOf)(sqInt oop); static sqIntptr_t (*signedMachineIntegerValueOf)(sqInt oop); @@ -525,6 +522,7 @@ extern sqInt primitiveFailForOSError(sqLong osError); extern sqInt primitiveMethod(void); extern sqInt pushRemappableOop(sqInt oop); extern sqInt signed32BitIntegerFor(sqInt integerValue); +extern int signed32BitValueOf(sqInt oop); extern sqInt signed64BitIntegerFor(sqLong integerValue); extern sqLong signed64BitValueOf(sqInt oop); extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); @@ -539,7 +537,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ARM64FFIPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "ARM64FFIPlugin VMMaker.oscog-eem.3041 " INT_EXT; /*** Macros ***/ @@ -607,19 +605,6 @@ atomicTypeOf(sqInt typeSpec) } -/* Answer if a struct result of a given size is able to be returned in - registers. NB: this is a predicate! #canReturnInRegistersStructOfSize: - does NOT return a struct in anything! - */ - - /* ThreadedARM64FFIPlugin>>#canReturnInRegistersStructOfSize: */ -static sqInt -canReturnInRegistersStructOfSize(sqInt returnStructSize) -{ - return returnStructSize <= (2 * BytesPerWord); -} - - /* Check the alignment of a structure and return true if correctly aligned. If computed size = declared size, then the struct is assumed correctly aligned. @@ -718,17 +703,6 @@ cleanupCalloutState(CalloutState *calloutState) } -/* Set the return type to true if returning the struct via register */ - - /* ThreadedARM64FFIPlugin>>#encodeStructReturnTypeIn: */ -static sqInt -encodeStructReturnTypeIn(CalloutState *calloutState) -{ - (calloutState->structReturnType = ((calloutState->structReturnSize)) <= (2 * BytesPerWord)); - return 0; -} - - /* Answer a long of the address of the byteSize slot (byte, short, int, whatever) at byteOffset in rcvr. Nominally intended for use with ExternalAddress objects, this code will @@ -743,17 +717,14 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) sqInt rcvrClass; sqInt rcvrSize; - if (!(isBytes(rcvr))) { - return 0; - } if (!(byteOffset > 0)) { - return 0; + return null; } rcvrClass = fetchClassOf(rcvr); rcvrSize = byteSizeOf(rcvr); if (rcvrClass == (classExternalAddress())) { if (!(rcvrSize == BytesPerWord)) { - return 0; + return null; } /* Hack!! */ @@ -762,17 +733,16 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) if (addr == 0) { /* or: [(interpreterProxy isInMemory: addr) or: [(interpreterProxy isPinned: rcvr) not]] */ - return 0; + return null; } } else { if (!(((byteOffset + byteSize) - 1) <= rcvrSize)) { - return 0; + return null; } addr = ((sqIntptr_t) (firstIndexableField(rcvr))); } - addr = (addr + byteOffset) - 1; - return ((void *)addr); + return ((void *)((addr + byteOffset) - 1)); } @@ -786,6 +756,8 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) double floatValue; sqInt intValue; sqInt typeSpec; + usqLong value; + sqLong value1; /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiArgHeader); @@ -797,7 +769,7 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) if (atomicType < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = oop; @@ -872,27 +844,180 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqLong) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) value)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqLong) value1)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value1); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; default: error("Case not found"); @@ -994,6 +1119,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c sqInt typeSpec; sqInt typeSpec1; sqInt typeSpec2; + usqLong value; + sqLong value1; sqInt valueOop; sqInt valueOop1; @@ -1252,8 +1379,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { err = FFIErrorCoercionFailed; goto l3; @@ -1279,7 +1406,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) ? 0 : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* string value (char*) */ /* note: the only types allowed for passing into char* types are @@ -1318,7 +1445,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } return 0; } - atomicType1 = FFITypeUnsignedByte; + atomicType1 = FFITypeUnsignedInt8; } # if COGMTVM @@ -1333,7 +1460,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } # endif // COGMTVM if ((atomicType1 == FFITypeVoid) - || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { + || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedInt8)) >> 1))) { /* byte* -- see comment on string above */ if (isString @@ -1466,7 +1593,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c if (atomicType2 < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = valueOop; @@ -1541,27 +1668,180 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqLong) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) value)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqLong) value1)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value1); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); + } + return 0; default: error("Case not found"); @@ -1616,304 +1896,27 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } -/* Support for generic callout. Prepare a pointer reference to an atomic type - for callout. - Note: - for type 'void*' we allow ByteArray/String/Symbol, wordVariableSubclass, - Alien or ExternalAddress. - for other types we allow ByteArray, wordVariableSubclass, Alien or - ExternalAddress. - */ +/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes + args from the stack + and the spec from the method. If argArrayOrNil is not nil takes args from + argArrayOrNil and the spec from the receiver. */ - /* ThreadedFFIPlugin>>#ffiAtomicArgByReference:Class:in: */ + /* ThreadedARM64FFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ static sqInt -ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) +ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) { - sqInt argIsAlien; - sqInt atomicType; - char *copy; - sqInt isString; - sqInt length; - char *pointer; - void *pointer1; - void *pointer2; - void *pointer3; - void *pointer4; - void *pointer5; - void *pointer6; - sqInt typeSpec; - - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType == FFITypeBool) { - - /* No bools on input */ - return FFIErrorCoercionFailed; - } - argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) - ? 0 - : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { - - /* string value (char*) */ - /* note: the only types allowed for passing into char* types are - ByteArray, String, Symbol, Alien and *no* other byte indexed objects - (e.g., CompiledMethod, LargeInteger). We only check for strings - here and fall through to the byte* check otherwise. */ - if (isString) { - - /* String/Symbol */ - /* Strings must be allocated by the ffi support code */ - /* begin ffiPushString:OfLength:in: */ - pointer = firstIndexableField(oop); - length = byteSizeOf(oop); - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - atomicType = FFITypeUnsignedByte; - } -# if COGMTVM - - /* Since all the following pass the address of the first indexable field we need to fail - the call if it is threaded and the object is young, since it may move during the call. */ - if ((((((calloutState->callFlags)) & FFICallFlagThreaded) != 0)) - && (((!argIsAlien) - || ((assert(isAlien(oop)), - (longAt(oop + BaseHeaderSize)) > 0))) - && (isYoung(oop)))) { - return -PrimErrObjectMayMove; - } -# endif // COGMTVM - if ((atomicType == FFITypeVoid) - || ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { - - /* byte* -- see comment on string above */ - if (isString - || (oopClass == (classByteArray()))) { - - /* String/Symbol/ByteArray */ - /* begin ffiPushPointer:in: */ - pointer1 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer1)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer1); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer2 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer2)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer2); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer3 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer3)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer3); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (!(atomicType == FFITypeVoid)) { - return FFIErrorCoercionFailed; - } - } - if (atomicType <= FFITypeDoubleFloat) { - if ((isWords(oop)) - || (oopClass == (classByteArray()))) { - /* begin ffiPushPointer:in: */ - pointer4 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer4)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer4); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer5 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer5)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer5); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer6 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer6)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer6); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; - } - } - return FFIErrorCoercionFailed; -} - - -/* Support for generic callout. Prepare an external pointer reference to an - atomic type for callout. - */ - - /* ThreadedFFIPlugin>>#ffiAtomicStructByReference:Class:in: */ -static sqInt -ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) -{ - sqInt atomicType; - sqInt err; - sqInt ptrType; - sqInt spec; - sqInt specOop; - sqInt specType; - sqInt typeSpec; - sqInt valueOop; - - - /* must be external data to pass pointers to atomic type */ - if (!(oopClass == (classExternalData()))) { - return FFIErrorCoercionFailed; - } - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType != FFITypeVoid) { - /* begin ffiValidateExternalData:AtomicType: */ - ptrType = fetchPointerofObject(1, oop); - if (!((isPointers(ptrType)) - && ((slotSizeOf(ptrType)) >= 2))) { - err = FFIErrorWrongType; - goto l3; - } - specOop = fetchPointerofObject(0, ptrType); - if (!((isWords(specOop)) - && ((slotSizeOf(specOop)) > 0))) { - err = FFIErrorWrongType; - goto l3; - } - spec = fetchPointerofObject(0, specOop); - if (!(((spec & FFIFlagAtomic) != 0))) { - err = FFIErrorWrongType; - goto l3; - } - /* begin atomicTypeOf: */ - specType = ((usqInt)((spec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (specType != atomicType) { - - /* Allow for signed/unsigned conversion but nothing else. - See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) - && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { - err = FFIErrorCoercionFailed; - goto l3; - } - } - err = 0; - l3: /* end ffiValidateExternalData:AtomicType: */; - if (err != 0) { - return err; - } - } - valueOop = fetchPointerofObject(0, oop); - return ffiPushPointerContentsOfin(valueOop, calloutState); -} - - -/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes - args from the stack - and the spec from the method. If argArrayOrNil is not nil takes args from - argArrayOrNil and the spec from the receiver. */ - - /* ThreadedARM64FFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ -static sqInt -ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) -{ - sqInt address; - sqInt address1; - sqInt addressPtr; - char *allocation; - sqInt argClass; - sqInt argSpec; - sqInt argType; - sqInt argTypeArray; - sqInt argTypes; - sqInt argTypes1; - sqInt argTypes2; - sqLong arrayAddr; + sqInt address; + sqInt address1; + sqInt addressPtr; + char *allocation; + sqInt argClass; + sqInt argSpec; + sqInt argType; + sqInt argTypeArray; + sqInt argTypes; + sqInt argTypes1; + sqInt argTypes2; + sqLong arrayAddr; sqInt atomicType; sqInt atomicType1; sqInt byteSize; @@ -2202,7 +2205,7 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -2311,18 +2314,18 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : trueObject()); goto l10; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -2349,19 +2352,14 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n } goto l10; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l10; } -# if SPURVM - result = characterObjectOf(intRet & 0x3FFFFFFF); - goto l10; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result = characterObjectOf(intRet & 0xFF); - goto l10; -# endif l10: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -2403,89 +2401,6 @@ ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState) } -/* Make sure that the given oop is a valid external handle */ - - /* ThreadedFFIPlugin>>#ffiContentsOfHandle:errCode: */ -static sqInt -ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode) -{ - if (!((isBytes(oop)) - && ((byteSizeOf(oop)) == (sizeof(sqInt))))) { - return ffiFail(errCode); - } - return fetchPointerofObject(0, oop); -} - - -/* Callout support. Return the appropriate oop for the given atomic type */ - - /* ThreadedFFIPlugin>>#ffiCreateIntegralResultOop:ofAtomicType:in: */ -static sqInt -ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState) -{ - sqInt byteSize; - usqLong mask; - sqInt shift; - usqLong value; - - assert(atomicType < FFITypeSingleFloat); - if (atomicType == FFITypeBool) { - - /* Make sure bool honors the byte size requested */ - byteSize = ((calloutState->ffiRetHeader)) & FFIStructSizeMask; - value = (byteSize == (sizeof(retVal)) - ? retVal - : retVal & (((((unsigned long long)1)) << (byteSize * 8)) - 1)); - return (value == 0 - ? falseObject() - : trueObject()); - } - if (atomicType <= FFITypeSignedInt) { - - /* these are all generall integer returns */ - if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { - - /* byte/short. first extract partial word, then sign extend */ - - /* # of significant bits */ - shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) - ? 32 - : (((usqInt)(atomicType)) >> 1) * 8); - value = retVal & (((((unsigned long long)1)) << shift) - 1); - if (((atomicType & 1) != 0)) { - - /* make the guy signed */ - mask = (((unsigned long long)1)) << (shift - 1); - value = (value & (mask - 1)) - (value & mask); - } - return integerObjectOf(value); - } - return (((atomicType & 1) != 0) - ? (/* begin signedMachineIntegerFor: */ - (BytesPerWord == 8 - ? signed64BitIntegerFor(((sqIntptr_t) retVal)) - : signed32BitIntegerFor(((sqIntptr_t) retVal)))) - : (/* begin positiveMachineIntegerFor: */ - (BytesPerWord == 8 - ? positive64BitIntegerFor(((usqIntptr_t) retVal)) - : positive32BitIntegerFor(((usqIntptr_t) retVal))))); - } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { - return (((atomicType & 1) != 0) - ? signed64BitIntegerFor(retVal) - : positive64BitIntegerFor(retVal)); - } -# if SPURVM - return characterObjectOf(retVal & 0x3FFFFFFF); -# else - return characterObjectOf(retVal & 0xFF); -# endif -} - - /* Map the FFI error code into a primitive error code. If reason is negative it encodes one of the standard PrimErr... codes, negated to distinguish it from the FFIError @@ -2509,21 +2424,6 @@ ffiFail(sqInt reason) } -/* Support for generic callout. Return a float value that is coerced as C - would do. - */ - - /* ThreadedFFIPlugin>>#ffiFloatValueOf: */ -static double -ffiFloatValueOf(sqInt oop) -{ - if (isFloatObject(oop)) { - return floatValueOf(oop); - } - return ((double) (ffiIntegerValueOf(oop)) ); -} - - /* Support for generic callout. Answer an integer value that is coerced as C would do. */ @@ -2616,52 +2516,6 @@ ffiLoadCalloutAddressFrom(sqInt oop) } -/* Load the address of the foreign function from the given object */ - - /* ThreadedFFIPlugin>>#ffiLoadCalloutAddress: */ -static sqInt -ffiLoadCalloutAddress(sqInt lit) -{ - sqInt address; - sqInt addressPtr; - sqIntptr_t *ptr; - - - /* Lookup the address */ - - /* Make sure it's an external handle */ - addressPtr = fetchPointerofObject(0, lit); - /* begin ffiContentsOfHandle:errCode: */ - if (!((isBytes(addressPtr)) - && ((byteSizeOf(addressPtr)) == (sizeof(sqInt))))) { - address = ffiFail(FFIErrorBadAddress); - goto l1; - } - address = fetchPointerofObject(0, addressPtr); - l1: /* end ffiContentsOfHandle:errCode: */; - if (failed()) { - return 0; - } - if (address == 0) { - - /* Go look it up in the module */ - if (externalFunctionInstSize > ExternalFunctionStackSizeIndex) { - storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, lit, -1); - } - if ((slotSizeOf(lit)) < 5) { - return ffiFail(FFIErrorNoModule); - } - address = ffiLoadCalloutAddressFrom(lit); - if (failed()) { - return 0; - } - ptr = firstIndexableField(addressPtr); - ptr[0] = address; - } - return address; -} - - /* Load the given module and return its handle */ /* ThreadedFFIPlugin>>#ffiLoadCalloutModule: */ @@ -2857,186 +2711,6 @@ ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedARM32FFIPlugin>>#ffiPushPointer:in: */ -static sqInt -ffiPushPointerin(void *pointer, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedByte:in: */ -static sqInt -ffiPushSignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedChar:in: */ -static sqInt -ffiPushSignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM64FFIPlugin>>#ffiPushSignedInt:in: */ -static sqInt -ffiPushSignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqLong) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - -/* Push a longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushSignedLongLongOop:in: */ -static sqInt -ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - sqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = signed64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushSignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqLong) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM64FFIPlugin>>#ffiPushSignedLongLong:in: */ -static sqInt -ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqLong) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushSignedShort:in: */ -static sqInt -ffiPushSignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedFFIPlugin>>#ffiPushString:OfLength:in: */ -static sqInt -ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState) -{ - char *copy; - - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - /* Push the contents of the given external structure */ @@ -3206,205 +2880,6 @@ ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) } -/* See IHI0055B_aapcs64.pdf sections 4.3.5 & 5.4.2 Stage C; we don't yet - support HVA's - */ - - /* ThreadedARM64FFIPlugin>>#ffiPushStructure:ofSize:typeSpec:ofLength:in: */ -static sqInt -ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, unsigned int *argSpec, sqInt argSpecSize, CalloutState *calloutState) -{ - sqInt availableRegisterSpace; - sqInt roundedSize; - sqInt stackPartSize; - - if (structIsHomogenousFloatArrayOfSizetypeSpecofLength(structSize, argSpec, argSpecSize)) { - availableRegisterSpace = (NumFloatRegArgs - ((calloutState->floatRegisterIndex))) * BytesPerWord; - if (structSize <= availableRegisterSpace) { - - /* Stage C, step C.2, all in floating-point registers (!!) */ - memcpy(((void *) ((&(((calloutState->floatRegisters))[(calloutState->floatRegisterIndex)])))), pointer, structSize); - (calloutState->floatRegisterIndex = ((calloutState->floatRegisterIndex)) + ((((usqInt)((structSize + 7))) >> 3))); - return 0; - } - availableRegisterSpace = 0; - (calloutState->floatRegisterIndex = 8); - } - else { - availableRegisterSpace = (NumIntRegArgs - ((calloutState->integerRegisterIndex))) * BytesPerWord; - } - stackPartSize = structSize; - if (availableRegisterSpace > 0) { - if (structSize <= availableRegisterSpace) { - - /* all in integer registers */ - memcpy(((void *) ((&(((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)])))), pointer, structSize); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + ((((usqInt)((structSize + 7))) >> 3))); - return 0; - } - if (((calloutState->currentArg)) == ((calloutState->argVector))) { - stackPartSize = structSize - availableRegisterSpace; - memcpy(((void *) ((&(((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)])))), pointer, availableRegisterSpace); - } - else { - availableRegisterSpace = 0; - } - (calloutState->integerRegisterIndex = NumIntRegArgs); - } - if (stackPartSize > 0) { - roundedSize = (((stackPartSize + 3) | 3) - 3); - if ((((calloutState->currentArg)) + roundedSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - memcpy((calloutState->currentArg), (&((((char *) pointer))[availableRegisterSpace])), stackPartSize); - (calloutState->currentArg = ((calloutState->currentArg)) + roundedSize); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedByte:in: */ -static sqInt -ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedChar:in: */ -static sqInt -ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM64FFIPlugin>>#ffiPushUnsignedInt:in: */ -static sqInt -ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - -/* Push an unsigned longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushUnsignedLongLongOop:in: */ -static sqInt -ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - usqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = positive64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushUnsignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM64FFIPlugin>>#ffiPushUnsignedLongLong:in: */ -static sqInt -ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqLong) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - /* ThreadedARM32FFIPlugin>>#ffiPushUnsignedShort:in: */ -static sqInt -ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) value)); - (calloutState->integerRegisterIndex = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + BytesPerWord) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + BytesPerWord); - } - return 0; -} - - -/* This is a fallback in case somebody tries to pass a 'void' value. - We could simply ignore the argument but I think it's better to let - the caller know what he did */ - - /* ThreadedFFIPlugin>>#ffiPushVoid:in: */ -static sqInt -ffiPushVoidin(sqInt ignored, CalloutState *calloutState) -{ - return FFIErrorAttemptToPassVoid; -} - - /* Create a Smalltalk string from a zero terminated C string */ /* ThreadedFFIPlugin>>#ffiReturnCStringFrom: */ @@ -3462,7 +2937,7 @@ ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutSta /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiRetHeader); atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -3623,8 +3098,8 @@ ffiValidateExternalDataAtomicType(sqInt oop, sqInt atomicType) /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { return FFIErrorCoercionFailed; } @@ -3746,18 +3221,6 @@ msg(char *s) } -/* Answer if a struct result of a given size is unable to be returned in - registers. - */ - - /* ThreadedARM64FFIPlugin>>#mustReturnStructOnStack: */ -static sqInt -mustReturnStructOnStack(sqInt returnStructSize) -{ - return returnStructSize > (2 * BytesPerWord); -} - - /* Answer if a struct returned in memory is returned to the referent of a pointer passed as an implciit first argument. It almost always is. Subclasses can override if not. */ @@ -4038,6 +3501,52 @@ primitiveDestroyManualSurface(void) } +/* Answer the address of a 4 byte or 8 byte ExternalAddress. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressAsInteger */ +EXPORT(sqInt) +primitiveExternalAddressAsInteger(void) +{ + sqInt rcvr; + sqInt size; + + rcvr = stackValue(0); + size = byteSizeOf(rcvr); + if (size == 8) { + return methodReturnValue(positive64BitIntegerFor((*((usqLong *) (firstIndexableField(rcvr)))))); + } + if (size == 4) { + return methodReturnValue(positive32BitIntegerFor((*((unsigned int *) (firstIndexableField(rcvr)))))); + } + primitiveFailFor(PrimErrBadReceiver); + return 0; +} + + +/* Answer a 4 byte or 8 byte ExternalAddress with value of the argument. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressFromInteger */ +EXPORT(sqInt) +primitiveExternalAddressFromInteger(void) +{ + sqInt address; + usqIntptr_t value; + + value = positiveMachineIntegerValueOf(stackValue(0)); + if (failed()) { + return primitiveFailFor(PrimErrBadArgument); + } + address = instantiateClassindexableSize(classExternalAddress(), BytesPerWord); + if (address == null) { + return primitiveFailFor(PrimErrNoMemory); + } + else { + (*((usqIntptr_t *) (firstIndexableField(address))) = value); + return methodReturnValue(address); + } +} + + /* Primitive. Allocate an object on the external heap. */ /* ThreadedFFIPlugin>>#primitiveFFIAllocate */ @@ -4064,7 +3573,7 @@ primitiveFFIAllocate(void) } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAt */ EXPORT(sqInt) @@ -4075,22 +3584,23 @@ primitiveFFIDoubleAt(void) double floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(double)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAtPut */ EXPORT(sqInt) @@ -4098,32 +3608,39 @@ primitiveFFIDoubleAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; double floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((double) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((double) (floatValueOf(valueOop))); } else { - floatValue = ((double) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((double) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(double)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAt */ EXPORT(sqInt) @@ -4134,22 +3651,23 @@ primitiveFFIFloatAt(void) float floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(float)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAtPut */ EXPORT(sqInt) @@ -4157,28 +3675,35 @@ primitiveFFIFloatAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; float floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((float) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((float) (floatValueOf(valueOop))); } else { - floatValue = ((float) (floatValueOf(floatOop))); - } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + if (isIntegerObject(valueOop)) { + floatValue = ((float) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(floatValue)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } @@ -4255,51 +3780,53 @@ primitiveFFIIntegerAt(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (byteSize <= 2) { - if (byteSize == 1) { - value = ((unsigned char) (byteAt(addr))); - } - else { - value = ((unsigned short) (unalignedShortAt(addr))); - } + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - if (byteSize == 4) { - value = ((unsigned int) (unalignedLong32At(addr))); + if (byteSize <= 2) { + if (byteSize == 1) { + value = ((unsigned char) (byteAt(addr))); + } + else { + value = ((unsigned short) (unalignedShortAt(addr))); + } } else { - value = unalignedLong64At(addr); - } - } - if (byteSize < BytesPerWord) { - if (isSigned) { - - /* sign extend value */ - mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); - value = (value & (mask - 1)) - (value & mask); + if (byteSize == 4) { + value = ((unsigned int) (unalignedLong32At(addr))); + } + else { + value = unalignedLong64At(addr); + } } - valueOop = integerObjectOf(value); - } - else { - - /* general 64 bit integer; note these never fail */ - if (isSigned) { - if (byteSize < 8) { + if (byteSize < BytesPerWord) { + if (isSigned) { /* sign extend value */ mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); value = (value & (mask - 1)) - (value & mask); } - valueOop = signed64BitIntegerFor(value); + valueOop = integerObjectOf(value); } else { - valueOop = positive64BitIntegerFor(value); + + /* general 64 bit integer; note these never fail */ + if (isSigned) { + if (byteSize < 8) { + + /* sign extend value */ + mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); + value = (value & (mask - 1)) - (value & mask); + } + valueOop = signed64BitIntegerFor(value); + } + else { + valueOop = positive64BitIntegerFor(value); + } } + return methodReturnValue(valueOop); } - return popthenPush(4, valueOop); } @@ -4333,49 +3860,51 @@ primitiveFFIIntegerAtPut(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (isSigned) { - value = signed64BitValueOf(valueOop); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - value = positive64BitValueOf(valueOop); - } - if (failed()) { - return 0; - } - if (byteSize < 8) { if (isSigned) { - max = (((unsigned long long)1)) << ((8 * byteSize) - 1); - if (!((value >= (0 - max)) - && (value < max))) { - return primitiveFail(); - } + value = signed64BitValueOf(valueOop); } else { - if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { - return primitiveFail(); - } + value = positive64BitValueOf(valueOop); } - } - if (byteSize <= 2) { - if (byteSize == 1) { - byteAtput(addr, value); + if (failed()) { + return 0; } - else { - unalignedShortAtput(addr, value); + if (byteSize < 8) { + if (isSigned) { + max = (((unsigned long long)1)) << ((8 * byteSize) - 1); + if (!((value >= (0 - max)) + && (value < max))) { + return primitiveFail(); + } + } + else { + if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { + return primitiveFail(); + } + } } - } - else { - if (byteSize == 4) { - unalignedLong32Atput(addr, value); + if (byteSize <= 2) { + if (byteSize == 1) { + byteAtput(addr, value); + } + else { + unalignedShortAtput(addr, value); + } } else { - unalignedLong64Atput(addr, value); + if (byteSize == 4) { + unalignedLong32Atput(addr, value); + } + else { + unalignedLong64Atput(addr, value); + } } + return methodReturnValue(valueOop); } - return popthenPush(5, valueOop); } @@ -4501,6 +4030,19 @@ primitiveLogCallsTo(void) } +/* Answer the plugins current version to ensure compatibility with data + structures shared between plugin an image code such as: + - Type codes in FFIConstants + - Known classes in the special-objects array */ + + /* ThreadedFFIPlugin>>#primitivePluginVersion */ +EXPORT(sqInt) +primitivePluginVersion(void) +{ + return methodReturnInteger(1); +} + + /* Create a 'manual surface' data-structure. See the ExternalForm class in the FFI package for example usage. */ /* arguments: name(type, stack offset) @@ -4531,6 +4073,244 @@ primitiveSetManualSurfacePointer(void) } +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16At */ +EXPORT(sqInt) +primitiveSignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16AtPut */ +EXPORT(sqInt) +primitiveSignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -32768) && (value <= 0x7FFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32At */ +EXPORT(sqInt) +primitiveSignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed32BitIntegerFor(((signed int) (unalignedLong32At(addr))))); + } +} + + +/* Store the signed 32-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32AtPut */ +EXPORT(sqInt) +primitiveSignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + int value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64At */ +EXPORT(sqInt) +primitiveSignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed64BitIntegerFor(((sqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64AtPut */ +EXPORT(sqInt) +primitiveSignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 8-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8At */ +EXPORT(sqInt) +primitiveSignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed char) (byteAt(addr)))); + } +} + + +/* Store the signed 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8AtPut */ +EXPORT(sqInt) +primitiveSignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -128) && (value <= 0x7F))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + /* Answer the alignment of an element of an atomic type, or a structure, within a structure on the current platform. */ @@ -4544,28 +4324,40 @@ primitiveStructureElementAlignment(void) typeCode = stackValue(0); if (!((isIntegerObject(typeCode)) - && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedByte) && (typeCode <= FFITypeDoubleFloat))) + && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedInt8) && (typeCode <= FFITypeDoubleFloat))) || (typeCode == FFIFlagStructure)))) { return primitiveFailFor(PrimErrBadArgument); } switch (typeCode) { - case FFITypeUnsignedByte: - case FFITypeSignedByte: + case FFITypeUnsignedInt8: + alignment = (&(((((structByte *) 0))->element))); + break; + + case FFITypeSignedInt8: alignment = (&(((((structByte *) 0))->element))); break; - case FFITypeUnsignedShort: - case FFITypeSignedShort: + case FFITypeUnsignedInt16: alignment = (&(((((structShort *) 0))->element))); break; - case FFITypeUnsignedInt: - case FFITypeSignedInt: + case FFITypeSignedInt16: + alignment = (&(((((structShort *) 0))->element))); + break; + + case FFITypeUnsignedInt32: + alignment = (&(((((structInt *) 0))->element))); + break; + + case FFITypeSignedInt32: alignment = (&(((((structInt *) 0))->element))); break; - case FFITypeUnsignedLongLong: - case FFITypeSignedLongLong: + case FFITypeUnsignedInt64: + alignment = (&(((((structLongLong *) 0))->element))); + break; + + case FFITypeSignedInt64: alignment = (&(((((structLongLong *) 0))->element))); break; @@ -4584,13 +4376,241 @@ primitiveStructureElementAlignment(void) } -/* Return thrue register if structReturnType is true */ +/* Answer the unsigned 16-bit integer starting at the given byte offset + (native endian). + */ - /* ThreadedARM64FFIPlugin>>#returnStructInRegisters: */ -static sqInt -returnStructInRegisters(CalloutState *calloutState) + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16At */ +EXPORT(sqInt) +primitiveUnsignedInt16At(void) { - return (calloutState->structReturnType); + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFFFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32At */ +EXPORT(sqInt) +primitiveUnsignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive32BitIntegerFor(((unsigned int) (unalignedLong32At(addr))))); + } +} + + +/* Store the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64At */ +EXPORT(sqInt) +primitiveUnsignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(usqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive64BitIntegerFor(((usqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 8-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8At */ +EXPORT(sqInt) +primitiveUnsignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned char) (byteAt(addr)))); + } +} + + +/* Store the unsigned 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } } @@ -4716,6 +4736,7 @@ setInterpreter(struct VirtualMachine *anInterpreter) primitiveMethod = interpreterProxy->primitiveMethod; pushRemappableOop = interpreterProxy->pushRemappableOop; signed32BitIntegerFor = interpreterProxy->signed32BitIntegerFor; + signed32BitValueOf = interpreterProxy->signed32BitValueOf; signed64BitIntegerFor = interpreterProxy->signed64BitIntegerFor; signed64BitValueOf = interpreterProxy->signed64BitValueOf; signedMachineIntegerValueOf = interpreterProxy->signedMachineIntegerValueOf; @@ -4806,48 +4827,88 @@ void* ARM64FFIPlugin_exports[][3] = { {(void*)_m, "ffiLogCallsTo", (void*)ffiLogCallsTo}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveCallout\000\002", (void*)primitiveCallout}, - {(void*)_m, "primitiveCalloutWithArgs\000\004", (void*)primitiveCalloutWithArgs}, - {(void*)_m, "primitiveCDataModel\000\000", (void*)primitiveCDataModel}, - {(void*)_m, "primitiveCreateManualSurface\000\000", (void*)primitiveCreateManualSurface}, - {(void*)_m, "primitiveDestroyManualSurface\000\000", (void*)primitiveDestroyManualSurface}, - {(void*)_m, "primitiveFFIAllocate\000\001", (void*)primitiveFFIAllocate}, - {(void*)_m, "primitiveFFIDoubleAt\000\001", (void*)primitiveFFIDoubleAt}, - {(void*)_m, "primitiveFFIDoubleAtPut\000\001", (void*)primitiveFFIDoubleAtPut}, - {(void*)_m, "primitiveFFIFloatAt\000\001", (void*)primitiveFFIFloatAt}, - {(void*)_m, "primitiveFFIFloatAtPut\000\001", (void*)primitiveFFIFloatAtPut}, - {(void*)_m, "primitiveFFIFree\000\001", (void*)primitiveFFIFree}, - {(void*)_m, "primitiveFFIGetLastError\000\377", (void*)primitiveFFIGetLastError}, - {(void*)_m, "primitiveFFIIntegerAt\000\001", (void*)primitiveFFIIntegerAt}, - {(void*)_m, "primitiveFFIIntegerAtPut\000\001", (void*)primitiveFFIIntegerAtPut}, - {(void*)_m, "primitiveForceLoad\000\002", (void*)primitiveForceLoad}, - {(void*)_m, "primitiveLoadSymbolFromModule\000\002", (void*)primitiveLoadSymbolFromModule}, - {(void*)_m, "primitiveLogCallsTo\000\000", (void*)primitiveLogCallsTo}, - {(void*)_m, "primitiveSetManualSurfacePointer\000\000", (void*)primitiveSetManualSurfacePointer}, - {(void*)_m, "primitiveStructureElementAlignment\000\000", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveCallout\000\377\000", (void*)primitiveCallout}, + {(void*)_m, "primitiveCalloutWithArgs\000\005\000", (void*)primitiveCalloutWithArgs}, + {(void*)_m, "primitiveCDataModel\000\000\001", (void*)primitiveCDataModel}, + {(void*)_m, "primitiveCreateManualSurface\000\000\000", (void*)primitiveCreateManualSurface}, + {(void*)_m, "primitiveDestroyManualSurface\000\000\000", (void*)primitiveDestroyManualSurface}, + {(void*)_m, "primitiveExternalAddressAsInteger\000\000\001", (void*)primitiveExternalAddressAsInteger}, + {(void*)_m, "primitiveExternalAddressFromInteger\000\377\001", (void*)primitiveExternalAddressFromInteger}, + {(void*)_m, "primitiveFFIAllocate\000\001\000", (void*)primitiveFFIAllocate}, + {(void*)_m, "primitiveFFIDoubleAt\000\001\003", (void*)primitiveFFIDoubleAt}, + {(void*)_m, "primitiveFFIDoubleAtPut\000\001\003", (void*)primitiveFFIDoubleAtPut}, + {(void*)_m, "primitiveFFIFloatAt\000\001\003", (void*)primitiveFFIFloatAt}, + {(void*)_m, "primitiveFFIFloatAtPut\000\001\003", (void*)primitiveFFIFloatAtPut}, + {(void*)_m, "primitiveFFIFree\000\001\000", (void*)primitiveFFIFree}, + {(void*)_m, "primitiveFFIGetLastError\000\377\001", (void*)primitiveFFIGetLastError}, + {(void*)_m, "primitiveFFIIntegerAt\000\001\001", (void*)primitiveFFIIntegerAt}, + {(void*)_m, "primitiveFFIIntegerAtPut\000\001\001", (void*)primitiveFFIIntegerAtPut}, + {(void*)_m, "primitiveForceLoad\000\002\000", (void*)primitiveForceLoad}, + {(void*)_m, "primitiveLoadSymbolFromModule\000\002\000", (void*)primitiveLoadSymbolFromModule}, + {(void*)_m, "primitiveLogCallsTo\000\000\000", (void*)primitiveLogCallsTo}, + {(void*)_m, "primitivePluginVersion\000\377\001", (void*)primitivePluginVersion}, + {(void*)_m, "primitiveSetManualSurfacePointer\000\000\000", (void*)primitiveSetManualSurfacePointer}, + {(void*)_m, "primitiveSignedInt16At\000\001\001", (void*)primitiveSignedInt16At}, + {(void*)_m, "primitiveSignedInt16AtPut\000\001\001", (void*)primitiveSignedInt16AtPut}, + {(void*)_m, "primitiveSignedInt32At\000\001\001", (void*)primitiveSignedInt32At}, + {(void*)_m, "primitiveSignedInt32AtPut\000\001\001", (void*)primitiveSignedInt32AtPut}, + {(void*)_m, "primitiveSignedInt64At\000\001\001", (void*)primitiveSignedInt64At}, + {(void*)_m, "primitiveSignedInt64AtPut\000\001\001", (void*)primitiveSignedInt64AtPut}, + {(void*)_m, "primitiveSignedInt8At\000\001\001", (void*)primitiveSignedInt8At}, + {(void*)_m, "primitiveSignedInt8AtPut\000\001\001", (void*)primitiveSignedInt8AtPut}, + {(void*)_m, "primitiveStructureElementAlignment\000\000\001", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveUnsignedInt16At\000\001\001", (void*)primitiveUnsignedInt16At}, + {(void*)_m, "primitiveUnsignedInt16AtPut\000\001\001", (void*)primitiveUnsignedInt16AtPut}, + {(void*)_m, "primitiveUnsignedInt32At\000\001\001", (void*)primitiveUnsignedInt32At}, + {(void*)_m, "primitiveUnsignedInt32AtPut\000\001\001", (void*)primitiveUnsignedInt32AtPut}, + {(void*)_m, "primitiveUnsignedInt64At\000\001\001", (void*)primitiveUnsignedInt64At}, + {(void*)_m, "primitiveUnsignedInt64AtPut\000\001\001", (void*)primitiveUnsignedInt64AtPut}, + {(void*)_m, "primitiveUnsignedInt8At\000\001\001", (void*)primitiveUnsignedInt8At}, + {(void*)_m, "primitiveUnsignedInt8AtPut\000\001\001", (void*)primitiveUnsignedInt8AtPut}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveCalloutAccessorDepth = 2; -EXPORT(signed char) primitiveCalloutWithArgsAccessorDepth = 4; -EXPORT(signed char) primitiveCDataModelAccessorDepth = 0; -EXPORT(signed char) primitiveCreateManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveFFIAllocateAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFreeAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveForceLoadAccessorDepth = 2; -EXPORT(signed char) primitiveLoadSymbolFromModuleAccessorDepth = 2; -EXPORT(signed char) primitiveLogCallsToAccessorDepth = 0; -EXPORT(signed char) primitiveSetManualSurfacePointerAccessorDepth = 0; -EXPORT(signed char) primitiveStructureElementAlignmentAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveCalloutWithArgsMetadata = 0x500; +EXPORT(signed short) primitiveCDataModelMetadata = 1; +EXPORT(signed short) primitiveCreateManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveDestroyManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveExternalAddressAsIntegerMetadata = 1; +EXPORT(signed short) primitiveExternalAddressFromIntegerMetadata = -255; +EXPORT(signed short) primitiveFFIAllocateMetadata = 0x100; +EXPORT(signed short) primitiveFFIDoubleAtMetadata = 259; +EXPORT(signed short) primitiveFFIDoubleAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFreeMetadata = 0x100; +EXPORT(signed short) primitiveFFIGetLastErrorMetadata = -255; +EXPORT(signed short) primitiveFFIIntegerAtMetadata = 0x101; +EXPORT(signed short) primitiveFFIIntegerAtPutMetadata = 0x101; +EXPORT(signed short) primitiveForceLoadMetadata = 0x200; +EXPORT(signed short) primitiveLoadSymbolFromModuleMetadata = 0x200; +EXPORT(signed short) primitiveLogCallsToMetadata = 0; +EXPORT(signed short) primitivePluginVersionMetadata = -255; +EXPORT(signed short) primitiveSetManualSurfacePointerMetadata = 0; +EXPORT(signed short) primitiveSignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtPutMetadata = 0x101; +EXPORT(signed short) primitiveStructureElementAlignmentMetadata = 1; +EXPORT(signed short) primitiveUnsignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtPutMetadata = 0x101; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c b/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c index e11a118212..8a522e4b74 100644 --- a/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c +++ b/src/plugins/SqueakFFIPrims/IA32FFIPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 from - ThreadedIA32FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + ThreadedIA32FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 */ -static char __buildInfo[] = "ThreadedIA32FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "ThreadedIA32FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 " __DATE__ ; #include "config.h" @@ -158,25 +158,28 @@ static char __buildInfo[] = "ThreadedIA32FFIPlugin VMMaker.oscog-eem.2985 uuid: #define FFIStructSizeMask 0xFFFF #define FFITypeBool 1 #define FFITypeDoubleFloat 13 -#define FFITypeSignedByte 3 -#define FFITypeSignedChar 11 -#define FFITypeSignedInt 7 -#define FFITypeSignedLongLong 9 -#define FFITypeSignedShort 5 +#define FFITypeSignedChar32 11 +#define FFITypeSignedChar8 11 +#define FFITypeSignedInt16 5 +#define FFITypeSignedInt32 7 +#define FFITypeSignedInt64 9 +#define FFITypeSignedInt8 3 #define FFITypeSingleFloat 12 -#define FFITypeUnsignedByte 2 -#define FFITypeUnsignedInt 6 -#define FFITypeUnsignedLongLong 8 -#define FFITypeUnsignedShort 4 +#define FFITypeUnsignedInt16 4 +#define FFITypeUnsignedInt32 6 +#define FFITypeUnsignedInt64 8 +#define FFITypeUnsignedInt8 2 #define FFITypeVoid 0 #define MaxNumArgs 15 -#define PluginVersionInfo " VMMaker.oscog-eem.2985" +#define PluginVersionInfo " VMMaker.oscog-eem.3041" #define PrimErrBadArgument 3 +#define PrimErrBadIndex 4 #define PrimErrBadMethod 12 #define PrimErrBadNumArgs 5 #define PrimErrBadReceiver 2 #define PrimErrFFIException 22 #define PrimErrNoCMemory 10 +#define PrimErrNoMemory 9 #define PrimErrNotFound 11 #define PrimErrObjectMayMove 14 #if !defined(SPURVM) /* Allow this to be overridden on the compiler command line */ @@ -225,42 +228,19 @@ static sqInt atomicTypeOf(sqInt typeSpec); static sqInt checkAlignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static sqInt checkAlignmentOfUnionSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static void cleanupCalloutState(CalloutState *calloutState); -static sqInt encodeStructReturnTypeIn(CalloutState *calloutState); static void * ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize); static sqInt ffiArgByValuein(sqInt oop, CalloutState *calloutState); static sqInt ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *calloutState); -static sqInt ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); -static sqInt ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); static sqInt ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs); static sqInt ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState); -static sqInt ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode); -static sqInt ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState); static sqInt ffiFail(sqInt reason); -static double ffiFloatValueOf(sqInt oop); static sqInt ffiIntegerValueOf(sqInt oop); static sqInt ffiLoadCalloutAddressFrom(sqInt oop); -static sqInt ffiLoadCalloutAddress(sqInt lit); static sqInt ffiLoadCalloutModule(sqInt module); static void ffiLogCallout(sqInt lit); EXPORT(sqInt) ffiLogCallsTo(char *fileName); static sqInt ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushPointerin(void *pointer, CalloutState *calloutState); -static sqInt ffiPushSignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongin(usqLong value, CalloutState *calloutState); -static sqInt ffiPushSignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState); static sqInt ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState); -static sqInt ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState); -static sqInt ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushVoidin(sqInt ignored, CalloutState *calloutState); static sqInt ffiReturnCStringFrom(sqInt cPointer); static sqInt ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutState); static sqInt ffiReturnStructofTypein(void *longLongRetPtr, sqInt ffiRetType, CalloutState *calloutState); @@ -280,6 +260,8 @@ EXPORT(void) primitiveCalloutWithArgs(void); EXPORT(sqInt) primitiveCDataModel(void); EXPORT(sqInt) primitiveCreateManualSurface(void); EXPORT(sqInt) primitiveDestroyManualSurface(void); +EXPORT(sqInt) primitiveExternalAddressAsInteger(void); +EXPORT(sqInt) primitiveExternalAddressFromInteger(void); EXPORT(sqInt) primitiveFFIAllocate(void); EXPORT(sqInt) primitiveFFIDoubleAt(void); EXPORT(sqInt) primitiveFFIDoubleAtPut(void); @@ -292,9 +274,25 @@ EXPORT(sqInt) primitiveFFIIntegerAtPut(void); EXPORT(sqInt) primitiveForceLoad(void); EXPORT(sqInt) primitiveLoadSymbolFromModule(void); EXPORT(sqInt) primitiveLogCallsTo(void); +EXPORT(sqInt) primitivePluginVersion(void); EXPORT(sqInt) primitiveSetManualSurfacePointer(void); +EXPORT(sqInt) primitiveSignedInt16At(void); +EXPORT(sqInt) primitiveSignedInt16AtPut(void); +EXPORT(sqInt) primitiveSignedInt32At(void); +EXPORT(sqInt) primitiveSignedInt32AtPut(void); +EXPORT(sqInt) primitiveSignedInt64At(void); +EXPORT(sqInt) primitiveSignedInt64AtPut(void); +EXPORT(sqInt) primitiveSignedInt8At(void); +EXPORT(sqInt) primitiveSignedInt8AtPut(void); EXPORT(sqInt) primitiveStructureElementAlignment(void); -static sqInt returnStructInRegisters(CalloutState *calloutState); +EXPORT(sqInt) primitiveUnsignedInt16At(void); +EXPORT(sqInt) primitiveUnsignedInt16AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt32At(void); +EXPORT(sqInt) primitiveUnsignedInt32AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt64At(void); +EXPORT(sqInt) primitiveUnsignedInt64AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt8At(void); +EXPORT(sqInt) primitiveUnsignedInt8AtPut(void); EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); static sqInt sizeField(sqInt alienOop); static sqInt startOfData(sqInt alienOop); @@ -408,6 +406,7 @@ static sqInt (*primitiveFailForOSError)(sqLong osError); static sqInt (*primitiveMethod)(void); static sqInt (*pushRemappableOop)(sqInt oop); static sqInt (*signed32BitIntegerFor)(sqInt integerValue); +static int (*signed32BitValueOf)(sqInt oop); static sqInt (*signed64BitIntegerFor)(sqLong integerValue); static sqLong (*signed64BitValueOf)(sqInt oop); static sqIntptr_t (*signedMachineIntegerValueOf)(sqInt oop); @@ -513,6 +512,7 @@ extern sqInt primitiveFailForOSError(sqLong osError); extern sqInt primitiveMethod(void); extern sqInt pushRemappableOop(sqInt oop); extern sqInt signed32BitIntegerFor(sqInt integerValue); +extern int signed32BitValueOf(sqInt oop); extern sqInt signed64BitIntegerFor(sqLong integerValue); extern sqLong signed64BitValueOf(sqInt oop); extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); @@ -527,7 +527,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "IA32FFIPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "IA32FFIPlugin VMMaker.oscog-eem.3041 " INT_EXT; /*** Macros ***/ @@ -694,17 +694,6 @@ cleanupCalloutState(CalloutState *calloutState) } -/* Set the return type to true if returning the struct via register */ - - /* ThreadedIA32FFIPlugin>>#encodeStructReturnTypeIn: */ -static sqInt -encodeStructReturnTypeIn(CalloutState *calloutState) -{ - (calloutState->structReturnType = canReturnInRegistersStructOfSize((calloutState->structReturnSize))); - return 0; -} - - /* Answer a long of the address of the byteSize slot (byte, short, int, whatever) at byteOffset in rcvr. Nominally intended for use with ExternalAddress objects, this code will @@ -719,17 +708,14 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) sqInt rcvrClass; sqInt rcvrSize; - if (!(isBytes(rcvr))) { - return 0; - } if (!(byteOffset > 0)) { - return 0; + return null; } rcvrClass = fetchClassOf(rcvr); rcvrSize = byteSizeOf(rcvr); if (rcvrClass == (classExternalAddress())) { if (!(rcvrSize == BytesPerWord)) { - return 0; + return null; } /* Hack!! */ @@ -738,17 +724,16 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) if (addr == 0) { /* or: [(interpreterProxy isInMemory: addr) or: [(interpreterProxy isPinned: rcvr) not]] */ - return 0; + return null; } } else { if (!(((byteOffset + byteSize) - 1) <= rcvrSize)) { - return 0; + return null; } addr = ((sqIntptr_t) (firstIndexableField(rcvr))); } - addr = (addr + byteOffset) - 1; - return ((void *)addr); + return ((void *)((addr + byteOffset) - 1)); } @@ -762,6 +747,8 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) double floatValue; sqInt intValue; sqInt typeSpec; + usqLong value; + sqLong value1; /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiArgHeader); @@ -773,7 +760,7 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) if (atomicType < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = oop; @@ -848,27 +835,116 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((usqInt) value)); + longAtput(((calloutState->currentArg)) + 4, ((usqInt) ((value) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((usqInt) value1)); + longAtput(((calloutState->currentArg)) + 4, ((usqInt) (((usqLong)(value1)) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; default: error("Case not found"); @@ -947,6 +1023,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c sqInt typeSpec; sqInt typeSpec1; sqInt typeSpec2; + usqLong value; + sqLong value1; sqInt valueOop; sqInt valueOop1; @@ -1123,8 +1201,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { err = FFIErrorCoercionFailed; goto l3; @@ -1150,7 +1228,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) ? 0 : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* string value (char*) */ /* note: the only types allowed for passing into char* types are @@ -1183,7 +1261,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c (calloutState->currentArg = ((calloutState->currentArg)) + 4); return 0; } - atomicType1 = FFITypeUnsignedByte; + atomicType1 = FFITypeUnsignedInt8; } # if COGMTVM @@ -1198,7 +1276,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } # endif // COGMTVM if ((atomicType1 == FFITypeVoid) - || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { + || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedInt8)) >> 1))) { /* byte* -- see comment on string above */ if (isString @@ -1295,7 +1373,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c if (atomicType2 < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = valueOop; @@ -1370,27 +1448,116 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((usqInt) value)); + longAtput(((calloutState->currentArg)) + 4, ((usqInt) ((value) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((usqInt) value1)); + longAtput(((calloutState->currentArg)) + 4, ((usqInt) (((usqLong)(value1)) >> 32))); + (calloutState->currentArg = ((calloutState->currentArg)) + 8); + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + 4); + return 0; default: error("Case not found"); @@ -1430,335 +1597,100 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } -/* Support for generic callout. Prepare a pointer reference to an atomic type - for callout. - Note: - for type 'void*' we allow ByteArray/String/Symbol, wordVariableSubclass, - Alien or ExternalAddress. - for other types we allow ByteArray, wordVariableSubclass, Alien or - ExternalAddress. - */ +/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes + args from the stack + and the spec from the method. If argArrayOrNil is not nil takes args from + argArrayOrNil and the spec from the receiver. */ - /* ThreadedFFIPlugin>>#ffiAtomicArgByReference:Class:in: */ + /* ThreadedFFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ static sqInt -ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) +ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) { - sqInt argIsAlien; + sqInt address; + sqInt address1; + sqInt addressPtr; + char *allocation; + sqInt argClass; + sqInt argSpec; + sqInt argType; + sqInt argTypeArray; + sqInt argTypes; + sqInt argTypes1; sqInt atomicType; - char *copy; - sqInt isString; - sqInt length; - char *pointer; - void *pointer1; - void *pointer2; - void *pointer3; - void *pointer4; - void *pointer5; - void *pointer6; + sqInt atomicType1; + sqInt byteSize; + CalloutState *calloutState; + sqInt classOop; + char *cString; + sqInt err; + sqInt ffiRetType; + sqInt flags; + double floatRet; + sqInt functionName; + sqInt i; + sqInt i1; + usqLong intRet; + void *longLongRetPtr; + usqLong mask; + sqInt myThreadIndex; + sqInt oop; + sqInt oop1; + sqInt oop2; + void *pointer; + sqInt primNumArgs; + sqIntptr_t *ptr; + sqInt *ptr1; + sqInt requiredStackSize; + sqInt result; + sqInt retClass; + sqInt retClass1; + sqInt retOop; + sqInt retOop1; + sqInt retType; + sqInt shift; + sqInt specLiteral; + sqInt specLiteral1; + sqInt stackSize; + sqInt strLen; + sqInt strOop; + char *strPtr; + CalloutState theCalloutState; sqInt typeSpec; + sqInt typeSpec1; + usqLong value; - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType == FFITypeBool) { - - /* No bools on input */ - return FFIErrorCoercionFailed; + primNumArgs = methodArgumentCount(); + if (!(isKindOfClass(externalFunction, classExternalFunction()))) { + return ffiFail(FFIErrorNotFunction); } - argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) - ? 0 - : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { - - /* string value (char*) */ - /* note: the only types allowed for passing into char* types are - ByteArray, String, Symbol, Alien and *no* other byte indexed objects - (e.g., CompiledMethod, LargeInteger). We only check for strings - here and fall through to the byte* check otherwise. */ - if (isString) { - - /* String/Symbol */ - /* Strings must be allocated by the ffi support code */ - /* begin ffiPushString:OfLength:in: */ - pointer = firstIndexableField(oop); - length = byteSizeOf(oop); - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; - } - atomicType = FFITypeUnsignedByte; + flags = fetchIntegerofObject(ExternalFunctionFlagsIndex, externalFunction); + if (failed()) { + return ffiFail(FFIErrorBadArgs); } -# if COGMTVM + /* begin ffiLoadCalloutAddress: */ - /* Since all the following pass the address of the first indexable field we need to fail - the call if it is threaded and the object is young, since it may move during the call. */ - if ((((((calloutState->callFlags)) & FFICallFlagThreaded) != 0)) - && (((!argIsAlien) - || ((assert(isAlien(oop)), - (longAt(oop + BaseHeaderSize)) > 0))) - && (isYoung(oop)))) { - return -PrimErrObjectMayMove; + /* Make sure it's an external handle */ + addressPtr = fetchPointerofObject(0, externalFunction); + if (!((isBytes(addressPtr)) + && ((byteSizeOf(addressPtr)) == (sizeof(sqInt))))) { + address1 = ffiFail(FFIErrorBadAddress); + goto l2; } -# endif // COGMTVM - if ((atomicType == FFITypeVoid) - || ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { - - /* byte* -- see comment on string above */ - if (isString - || (oopClass == (classByteArray()))) { + address1 = fetchPointerofObject(0, addressPtr); + l2: /* end ffiContentsOfHandle:errCode: */; + if (failed()) { + address = 0; + goto l3; + } + if (address1 == 0) { - /* String/Symbol/ByteArray */ - /* begin ffiPushPointer:in: */ - pointer1 = firstIndexableField(oop); - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer1); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; + /* Go look it up in the module */ + if (externalFunctionInstSize > ExternalFunctionStackSizeIndex) { + storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, externalFunction, -1); } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer2 = ((void *) (longAt(oop + BaseHeaderSize))); - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer2); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer3 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer3); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; - } - if (!(atomicType == FFITypeVoid)) { - return FFIErrorCoercionFailed; - } - } - if (atomicType <= FFITypeDoubleFloat) { - if ((isWords(oop)) - || (oopClass == (classByteArray()))) { - /* begin ffiPushPointer:in: */ - pointer4 = firstIndexableField(oop); - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer4); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer5 = ((void *) (longAt(oop + BaseHeaderSize))); - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer5); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer6 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer6); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; - } - } - return FFIErrorCoercionFailed; -} - - -/* Support for generic callout. Prepare an external pointer reference to an - atomic type for callout. - */ - - /* ThreadedFFIPlugin>>#ffiAtomicStructByReference:Class:in: */ -static sqInt -ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) -{ - sqInt atomicType; - sqInt err; - sqInt ptrType; - sqInt spec; - sqInt specOop; - sqInt specType; - sqInt typeSpec; - sqInt valueOop; - - - /* must be external data to pass pointers to atomic type */ - if (!(oopClass == (classExternalData()))) { - return FFIErrorCoercionFailed; - } - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType != FFITypeVoid) { - /* begin ffiValidateExternalData:AtomicType: */ - ptrType = fetchPointerofObject(1, oop); - if (!((isPointers(ptrType)) - && ((slotSizeOf(ptrType)) >= 2))) { - err = FFIErrorWrongType; - goto l3; - } - specOop = fetchPointerofObject(0, ptrType); - if (!((isWords(specOop)) - && ((slotSizeOf(specOop)) > 0))) { - err = FFIErrorWrongType; - goto l3; - } - spec = fetchPointerofObject(0, specOop); - if (!(((spec & FFIFlagAtomic) != 0))) { - err = FFIErrorWrongType; - goto l3; - } - /* begin atomicTypeOf: */ - specType = ((usqInt)((spec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (specType != atomicType) { - - /* Allow for signed/unsigned conversion but nothing else. - See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) - && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { - err = FFIErrorCoercionFailed; - goto l3; - } - } - err = 0; - l3: /* end ffiValidateExternalData:AtomicType: */; - if (err != 0) { - return err; - } - } - valueOop = fetchPointerofObject(0, oop); - return ffiPushPointerContentsOfin(valueOop, calloutState); -} - - -/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes - args from the stack - and the spec from the method. If argArrayOrNil is not nil takes args from - argArrayOrNil and the spec from the receiver. */ - - /* ThreadedFFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ -static sqInt -ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) -{ - sqInt address; - sqInt address1; - sqInt addressPtr; - char *allocation; - sqInt argClass; - sqInt argSpec; - sqInt argType; - sqInt argTypeArray; - sqInt argTypes; - sqInt argTypes1; - sqInt atomicType; - sqInt atomicType1; - sqInt byteSize; - CalloutState *calloutState; - sqInt classOop; - char *cString; - sqInt err; - sqInt ffiRetType; - sqInt flags; - double floatRet; - sqInt functionName; - sqInt i; - sqInt i1; - usqLong intRet; - void *longLongRetPtr; - usqLong mask; - sqInt myThreadIndex; - sqInt oop; - sqInt oop1; - sqInt oop2; - void *pointer; - sqInt primNumArgs; - sqIntptr_t *ptr; - sqInt *ptr1; - sqInt requiredStackSize; - sqInt result; - sqInt retClass; - sqInt retClass1; - sqInt retOop; - sqInt retOop1; - sqInt retType; - sqInt shift; - sqInt specLiteral; - sqInt specLiteral1; - sqInt stackSize; - sqInt strLen; - sqInt strOop; - char *strPtr; - CalloutState theCalloutState; - sqInt typeSpec; - sqInt typeSpec1; - usqLong value; - - primNumArgs = methodArgumentCount(); - if (!(isKindOfClass(externalFunction, classExternalFunction()))) { - return ffiFail(FFIErrorNotFunction); - } - flags = fetchIntegerofObject(ExternalFunctionFlagsIndex, externalFunction); - if (failed()) { - return ffiFail(FFIErrorBadArgs); - } - /* begin ffiLoadCalloutAddress: */ - - /* Make sure it's an external handle */ - addressPtr = fetchPointerofObject(0, externalFunction); - if (!((isBytes(addressPtr)) - && ((byteSizeOf(addressPtr)) == (sizeof(sqInt))))) { - address1 = ffiFail(FFIErrorBadAddress); - goto l2; - } - address1 = fetchPointerofObject(0, addressPtr); - l2: /* end ffiContentsOfHandle:errCode: */; - if (failed()) { - address = 0; - goto l3; - } - if (address1 == 0) { - - /* Go look it up in the module */ - if (externalFunctionInstSize > ExternalFunctionStackSizeIndex) { - storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, externalFunction, -1); - } - if ((slotSizeOf(externalFunction)) < 5) { - address = ffiFail(FFIErrorNoModule); - goto l3; + if ((slotSizeOf(externalFunction)) < 5) { + address = ffiFail(FFIErrorNoModule); + goto l3; } address1 = ffiLoadCalloutAddressFrom(externalFunction); if (failed()) { @@ -1935,7 +1867,7 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -2044,18 +1976,18 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : trueObject()); goto l8; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -2077,19 +2009,14 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : positive32BitIntegerFor(intRet))); goto l8; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l8; } -# if SPURVM - result = characterObjectOf(intRet & 0x3FFFFFFF); - goto l8; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result = characterObjectOf(intRet & 0xFF); - goto l8; -# endif l8: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -2131,87 +2058,6 @@ ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState) } -/* Make sure that the given oop is a valid external handle */ - - /* ThreadedFFIPlugin>>#ffiContentsOfHandle:errCode: */ -static sqInt -ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode) -{ - if (!((isBytes(oop)) - && ((byteSizeOf(oop)) == (sizeof(sqInt))))) { - return ffiFail(errCode); - } - return fetchPointerofObject(0, oop); -} - - -/* Callout support. Return the appropriate oop for the given atomic type */ - - /* ThreadedFFIPlugin>>#ffiCreateIntegralResultOop:ofAtomicType:in: */ -static sqInt -ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState) -{ - sqInt byteSize; - usqLong mask; - sqInt shift; - usqLong value; - - assert(atomicType < FFITypeSingleFloat); - if (atomicType == FFITypeBool) { - - /* Make sure bool honors the byte size requested */ - byteSize = ((calloutState->ffiRetHeader)) & FFIStructSizeMask; - value = (byteSize == (sizeof(retVal)) - ? retVal - : retVal & (((((unsigned long long)1)) << (byteSize * 8)) - 1)); - return (value == 0 - ? falseObject() - : trueObject()); - } - if (atomicType <= FFITypeSignedInt) { - - /* these are all generall integer returns */ - if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { - - /* byte/short. first extract partial word, then sign extend */ - - /* # of significant bits */ - shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) - ? 32 - : (((usqInt)(atomicType)) >> 1) * 8); - value = retVal & (((((unsigned long long)1)) << shift) - 1); - if (((atomicType & 1) != 0)) { - - /* make the guy signed */ - mask = (((unsigned long long)1)) << (shift - 1); - value = (value & (mask - 1)) - (value & mask); - } - return integerObjectOf(value); - } - return (((atomicType & 1) != 0) - ? (BytesPerWord == 8 - ? signed64BitIntegerFor(retVal) - : signed32BitIntegerFor(retVal)) - : (BytesPerWord == 8 - ? positive64BitIntegerFor(retVal) - : positive32BitIntegerFor(retVal))); - } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { - return (((atomicType & 1) != 0) - ? signed64BitIntegerFor(retVal) - : positive64BitIntegerFor(retVal)); - } -# if SPURVM - return characterObjectOf(retVal & 0x3FFFFFFF); -# else - return characterObjectOf(retVal & 0xFF); -# endif -} - - /* Map the FFI error code into a primitive error code. If reason is negative it encodes one of the standard PrimErr... codes, negated to distinguish it from the FFIError @@ -2235,21 +2081,6 @@ ffiFail(sqInt reason) } -/* Support for generic callout. Return a float value that is coerced as C - would do. - */ - - /* ThreadedFFIPlugin>>#ffiFloatValueOf: */ -static double -ffiFloatValueOf(sqInt oop) -{ - if (isFloatObject(oop)) { - return floatValueOf(oop); - } - return ((double) (ffiIntegerValueOf(oop)) ); -} - - /* Support for generic callout. Answer an integer value that is coerced as C would do. */ @@ -2342,52 +2173,6 @@ ffiLoadCalloutAddressFrom(sqInt oop) } -/* Load the address of the foreign function from the given object */ - - /* ThreadedFFIPlugin>>#ffiLoadCalloutAddress: */ -static sqInt -ffiLoadCalloutAddress(sqInt lit) -{ - sqInt address; - sqInt addressPtr; - sqIntptr_t *ptr; - - - /* Lookup the address */ - - /* Make sure it's an external handle */ - addressPtr = fetchPointerofObject(0, lit); - /* begin ffiContentsOfHandle:errCode: */ - if (!((isBytes(addressPtr)) - && ((byteSizeOf(addressPtr)) == (sizeof(sqInt))))) { - address = ffiFail(FFIErrorBadAddress); - goto l1; - } - address = fetchPointerofObject(0, addressPtr); - l1: /* end ffiContentsOfHandle:errCode: */; - if (failed()) { - return 0; - } - if (address == 0) { - - /* Go look it up in the module */ - if (externalFunctionInstSize > ExternalFunctionStackSizeIndex) { - storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, lit, -1); - } - if ((slotSizeOf(lit)) < 5) { - return ffiFail(FFIErrorNoModule); - } - address = ffiLoadCalloutAddressFrom(lit); - if (failed()) { - return 0; - } - ptr = firstIndexableField(addressPtr); - ptr[0] = address; - } - return address; -} - - /* Load the given module and return its handle */ /* ThreadedFFIPlugin>>#ffiLoadCalloutModule: */ @@ -2565,140 +2350,6 @@ ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedIA32FFIPlugin>>#ffiPushPointer:in: */ -static sqInt -ffiPushPointerin(void *pointer, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushSignedByte:in: */ -static sqInt -ffiPushSignedBytein(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushSignedChar:in: */ -static sqInt -ffiPushSignedCharin(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushSignedInt:in: */ -static sqInt -ffiPushSignedIntin(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - -/* Push a longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushSignedLongLongOop:in: */ -static sqInt -ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - sqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = signed64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushSignedLongLong:in: */ - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + 4, ((usqInt) (((usqLong)(value)) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushSignedLongLong:in: */ -static sqInt -ffiPushSignedLongLongin(usqLong value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + 4, ((usqInt) ((value) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushSignedShort:in: */ -static sqInt -ffiPushSignedShortin(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - /* ThreadedFFIPlugin>>#ffiPushString:OfLength:in: */ -static sqInt -ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState) -{ - char *copy; - - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - /* Push the contents of the given external structure */ @@ -2783,129 +2434,6 @@ ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedIA32FFIPlugin>>#ffiPushStructure:ofSize:typeSpec:ofLength:in: */ -static sqInt -ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState) -{ - sqInt roundedSize; - - roundedSize = (((structSize + 3) | 3) - 3); - if ((((calloutState->currentArg)) + roundedSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - memcpy((calloutState->currentArg), pointer, structSize); - (calloutState->currentArg = ((calloutState->currentArg)) + roundedSize); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushUnsignedByte:in: */ -static sqInt -ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushUnsignedChar:in: */ -static sqInt -ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushUnsignedInt:in: */ -static sqInt -ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - -/* Push an unsigned longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushUnsignedLongLongOop:in: */ -static sqInt -ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - usqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = positive64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushUnsignedLongLong:in: */ - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + 4, ((usqInt) ((value) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushUnsignedLongLong:in: */ -static sqInt -ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 8) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((usqInt) value)); - longAtput(((calloutState->currentArg)) + 4, ((usqInt) ((value) >> 32))); - (calloutState->currentArg = ((calloutState->currentArg)) + 8); - return 0; -} - - /* ThreadedIA32FFIPlugin>>#ffiPushUnsignedShort:in: */ -static sqInt -ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState) -{ - if ((((calloutState->currentArg)) + 4) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + 4); - return 0; -} - - -/* This is a fallback in case somebody tries to pass a 'void' value. - We could simply ignore the argument but I think it's better to let - the caller know what he did */ - - /* ThreadedFFIPlugin>>#ffiPushVoid:in: */ -static sqInt -ffiPushVoidin(sqInt ignored, CalloutState *calloutState) -{ - return FFIErrorAttemptToPassVoid; -} - /* Create a Smalltalk string from a zero terminated C string */ @@ -2964,7 +2492,7 @@ ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutSta /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiRetHeader); atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -3126,8 +2654,8 @@ ffiValidateExternalDataAtomicType(sqInt oop, sqInt atomicType) /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { return FFIErrorCoercionFailed; } @@ -3604,7 +3132,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -3713,18 +3241,18 @@ primitiveCallout(void) : trueObject()); goto l8; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -3746,19 +3274,14 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet))); goto l8; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l8; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l8; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); - goto l8; -# endif l8: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -3991,7 +3514,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4100,18 +3623,18 @@ primitiveCallout(void) : trueObject()); goto l14; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -4133,19 +3656,14 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet1))); goto l14; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l14; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l14; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); - goto l14; -# endif l14: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState1->stringArgIndex)) > 0) { @@ -4510,7 +4028,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4619,18 +4137,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l8; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -4652,19 +4170,14 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet))); goto l8; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l8; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l8; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); - goto l8; -# endif l8: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -4903,7 +4416,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -5012,18 +4525,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l14; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -5045,19 +4558,14 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet1))); goto l14; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l14; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l14; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); - goto l14; -# endif l14: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState1->stringArgIndex)) > 0) { @@ -5254,6 +4762,52 @@ primitiveDestroyManualSurface(void) } +/* Answer the address of a 4 byte or 8 byte ExternalAddress. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressAsInteger */ +EXPORT(sqInt) +primitiveExternalAddressAsInteger(void) +{ + sqInt rcvr; + sqInt size; + + rcvr = stackValue(0); + size = byteSizeOf(rcvr); + if (size == 8) { + return methodReturnValue(positive64BitIntegerFor((*((usqLong *) (firstIndexableField(rcvr)))))); + } + if (size == 4) { + return methodReturnValue(positive32BitIntegerFor((*((unsigned int *) (firstIndexableField(rcvr)))))); + } + primitiveFailFor(PrimErrBadReceiver); + return 0; +} + + +/* Answer a 4 byte or 8 byte ExternalAddress with value of the argument. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressFromInteger */ +EXPORT(sqInt) +primitiveExternalAddressFromInteger(void) +{ + sqInt address; + usqIntptr_t value; + + value = positiveMachineIntegerValueOf(stackValue(0)); + if (failed()) { + return primitiveFailFor(PrimErrBadArgument); + } + address = instantiateClassindexableSize(classExternalAddress(), BytesPerWord); + if (address == null) { + return primitiveFailFor(PrimErrNoMemory); + } + else { + (*((usqIntptr_t *) (firstIndexableField(address))) = value); + return methodReturnValue(address); + } +} + + /* Primitive. Allocate an object on the external heap. */ /* ThreadedFFIPlugin>>#primitiveFFIAllocate */ @@ -5280,7 +4834,7 @@ primitiveFFIAllocate(void) } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAt */ EXPORT(sqInt) @@ -5291,22 +4845,23 @@ primitiveFFIDoubleAt(void) double floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(double)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAtPut */ EXPORT(sqInt) @@ -5314,32 +4869,39 @@ primitiveFFIDoubleAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; double floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((double) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((double) (floatValueOf(valueOop))); } else { - floatValue = ((double) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((double) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(double)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAt */ EXPORT(sqInt) @@ -5350,22 +4912,23 @@ primitiveFFIFloatAt(void) float floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(float)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAtPut */ EXPORT(sqInt) @@ -5373,28 +4936,35 @@ primitiveFFIFloatAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; float floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((float) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((float) (floatValueOf(valueOop))); } else { - floatValue = ((float) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((float) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(floatValue)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } @@ -5471,51 +5041,53 @@ primitiveFFIIntegerAt(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (byteSize <= 2) { - if (byteSize == 1) { - value = ((unsigned char) (byteAt(addr))); - } - else { - value = ((unsigned short) (unalignedShortAt(addr))); - } + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - if (byteSize == 4) { - value = ((unsigned int) (unalignedLong32At(addr))); + if (byteSize <= 2) { + if (byteSize == 1) { + value = ((unsigned char) (byteAt(addr))); + } + else { + value = ((unsigned short) (unalignedShortAt(addr))); + } } else { - value = unalignedLong64At(addr); - } - } - if (byteSize < BytesPerWord) { - if (isSigned) { - - /* sign extend value */ - mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); - value = (value & (mask - 1)) - (value & mask); + if (byteSize == 4) { + value = ((unsigned int) (unalignedLong32At(addr))); + } + else { + value = unalignedLong64At(addr); + } } - valueOop = integerObjectOf(value); - } - else { - - /* general 64 bit integer; note these never fail */ - if (isSigned) { - if (byteSize < 8) { + if (byteSize < BytesPerWord) { + if (isSigned) { /* sign extend value */ mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); value = (value & (mask - 1)) - (value & mask); } - valueOop = signed64BitIntegerFor(value); + valueOop = integerObjectOf(value); } else { - valueOop = positive64BitIntegerFor(value); + + /* general 64 bit integer; note these never fail */ + if (isSigned) { + if (byteSize < 8) { + + /* sign extend value */ + mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); + value = (value & (mask - 1)) - (value & mask); + } + valueOop = signed64BitIntegerFor(value); + } + else { + valueOop = positive64BitIntegerFor(value); + } } + return methodReturnValue(valueOop); } - return popthenPush(4, valueOop); } @@ -5549,49 +5121,51 @@ primitiveFFIIntegerAtPut(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (isSigned) { - value = signed64BitValueOf(valueOop); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - value = positive64BitValueOf(valueOop); - } - if (failed()) { - return 0; - } - if (byteSize < 8) { if (isSigned) { - max = (((unsigned long long)1)) << ((8 * byteSize) - 1); - if (!((value >= (0 - max)) - && (value < max))) { - return primitiveFail(); - } + value = signed64BitValueOf(valueOop); } else { - if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { - return primitiveFail(); + value = positive64BitValueOf(valueOop); + } + if (failed()) { + return 0; + } + if (byteSize < 8) { + if (isSigned) { + max = (((unsigned long long)1)) << ((8 * byteSize) - 1); + if (!((value >= (0 - max)) + && (value < max))) { + return primitiveFail(); + } + } + else { + if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { + return primitiveFail(); + } } } - } - if (byteSize <= 2) { - if (byteSize == 1) { - byteAtput(addr, value); + if (byteSize <= 2) { + if (byteSize == 1) { + byteAtput(addr, value); + } + else { + unalignedShortAtput(addr, value); + } } else { - unalignedShortAtput(addr, value); + if (byteSize == 4) { + unalignedLong32Atput(addr, value); + } + else { + unalignedLong64Atput(addr, value); + } } + return methodReturnValue(valueOop); } - else { - if (byteSize == 4) { - unalignedLong32Atput(addr, value); - } - else { - unalignedLong64Atput(addr, value); - } - } - return popthenPush(5, valueOop); } @@ -5717,6 +5291,19 @@ primitiveLogCallsTo(void) } +/* Answer the plugins current version to ensure compatibility with data + structures shared between plugin an image code such as: + - Type codes in FFIConstants + - Known classes in the special-objects array */ + + /* ThreadedFFIPlugin>>#primitivePluginVersion */ +EXPORT(sqInt) +primitivePluginVersion(void) +{ + return methodReturnInteger(1); +} + + /* Create a 'manual surface' data-structure. See the ExternalForm class in the FFI package for example usage. */ /* arguments: name(type, stack offset) @@ -5747,6 +5334,244 @@ primitiveSetManualSurfacePointer(void) } +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16At */ +EXPORT(sqInt) +primitiveSignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16AtPut */ +EXPORT(sqInt) +primitiveSignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -32768) && (value <= 0x7FFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32At */ +EXPORT(sqInt) +primitiveSignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed32BitIntegerFor(((signed int) (unalignedLong32At(addr))))); + } +} + + +/* Store the signed 32-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32AtPut */ +EXPORT(sqInt) +primitiveSignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + int value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64At */ +EXPORT(sqInt) +primitiveSignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed64BitIntegerFor(((sqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64AtPut */ +EXPORT(sqInt) +primitiveSignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 8-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8At */ +EXPORT(sqInt) +primitiveSignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed char) (byteAt(addr)))); + } +} + + +/* Store the signed 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8AtPut */ +EXPORT(sqInt) +primitiveSignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -128) && (value <= 0x7F))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + /* Answer the alignment of an element of an atomic type, or a structure, within a structure on the current platform. */ @@ -5760,28 +5585,40 @@ primitiveStructureElementAlignment(void) typeCode = stackValue(0); if (!((isIntegerObject(typeCode)) - && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedByte) && (typeCode <= FFITypeDoubleFloat))) + && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedInt8) && (typeCode <= FFITypeDoubleFloat))) || (typeCode == FFIFlagStructure)))) { return primitiveFailFor(PrimErrBadArgument); } switch (typeCode) { - case FFITypeUnsignedByte: - case FFITypeSignedByte: + case FFITypeUnsignedInt8: alignment = (&(((((structByte *) 0))->element))); break; - case FFITypeUnsignedShort: - case FFITypeSignedShort: + case FFITypeSignedInt8: + alignment = (&(((((structByte *) 0))->element))); + break; + + case FFITypeUnsignedInt16: alignment = (&(((((structShort *) 0))->element))); break; - case FFITypeUnsignedInt: - case FFITypeSignedInt: + case FFITypeSignedInt16: + alignment = (&(((((structShort *) 0))->element))); + break; + + case FFITypeUnsignedInt32: + alignment = (&(((((structInt *) 0))->element))); + break; + + case FFITypeSignedInt32: alignment = (&(((((structInt *) 0))->element))); break; - case FFITypeUnsignedLongLong: - case FFITypeSignedLongLong: + case FFITypeUnsignedInt64: + alignment = (&(((((structLongLong *) 0))->element))); + break; + + case FFITypeSignedInt64: alignment = (&(((((structLongLong *) 0))->element))); break; @@ -5800,13 +5637,241 @@ primitiveStructureElementAlignment(void) } -/* Return thrue register if structReturnType is true */ +/* Answer the unsigned 16-bit integer starting at the given byte offset + (native endian). + */ - /* ThreadedIA32FFIPlugin>>#returnStructInRegisters: */ -static sqInt -returnStructInRegisters(CalloutState *calloutState) + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16At */ +EXPORT(sqInt) +primitiveUnsignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFFFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32At */ +EXPORT(sqInt) +primitiveUnsignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive32BitIntegerFor(((unsigned int) (unalignedLong32At(addr))))); + } +} + + +/* Store the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64At */ +EXPORT(sqInt) +primitiveUnsignedInt64At(void) { - return (calloutState->structReturnType); + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(usqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive64BitIntegerFor(((usqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 8-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8At */ +EXPORT(sqInt) +primitiveUnsignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned char) (byteAt(addr)))); + } +} + + +/* Store the unsigned 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } } @@ -5932,6 +5997,7 @@ setInterpreter(struct VirtualMachine *anInterpreter) primitiveMethod = interpreterProxy->primitiveMethod; pushRemappableOop = interpreterProxy->pushRemappableOop; signed32BitIntegerFor = interpreterProxy->signed32BitIntegerFor; + signed32BitValueOf = interpreterProxy->signed32BitValueOf; signed64BitIntegerFor = interpreterProxy->signed64BitIntegerFor; signed64BitValueOf = interpreterProxy->signed64BitValueOf; signedMachineIntegerValueOf = interpreterProxy->signedMachineIntegerValueOf; @@ -5982,48 +6048,88 @@ void* IA32FFIPlugin_exports[][3] = { {(void*)_m, "ffiLogCallsTo", (void*)ffiLogCallsTo}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveCallout\000\002", (void*)primitiveCallout}, - {(void*)_m, "primitiveCalloutWithArgs\000\004", (void*)primitiveCalloutWithArgs}, - {(void*)_m, "primitiveCDataModel\000\000", (void*)primitiveCDataModel}, - {(void*)_m, "primitiveCreateManualSurface\000\000", (void*)primitiveCreateManualSurface}, - {(void*)_m, "primitiveDestroyManualSurface\000\000", (void*)primitiveDestroyManualSurface}, - {(void*)_m, "primitiveFFIAllocate\000\001", (void*)primitiveFFIAllocate}, - {(void*)_m, "primitiveFFIDoubleAt\000\001", (void*)primitiveFFIDoubleAt}, - {(void*)_m, "primitiveFFIDoubleAtPut\000\001", (void*)primitiveFFIDoubleAtPut}, - {(void*)_m, "primitiveFFIFloatAt\000\001", (void*)primitiveFFIFloatAt}, - {(void*)_m, "primitiveFFIFloatAtPut\000\001", (void*)primitiveFFIFloatAtPut}, - {(void*)_m, "primitiveFFIFree\000\001", (void*)primitiveFFIFree}, - {(void*)_m, "primitiveFFIGetLastError\000\377", (void*)primitiveFFIGetLastError}, - {(void*)_m, "primitiveFFIIntegerAt\000\001", (void*)primitiveFFIIntegerAt}, - {(void*)_m, "primitiveFFIIntegerAtPut\000\001", (void*)primitiveFFIIntegerAtPut}, - {(void*)_m, "primitiveForceLoad\000\002", (void*)primitiveForceLoad}, - {(void*)_m, "primitiveLoadSymbolFromModule\000\002", (void*)primitiveLoadSymbolFromModule}, - {(void*)_m, "primitiveLogCallsTo\000\000", (void*)primitiveLogCallsTo}, - {(void*)_m, "primitiveSetManualSurfacePointer\000\000", (void*)primitiveSetManualSurfacePointer}, - {(void*)_m, "primitiveStructureElementAlignment\000\000", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveCallout\000\377\000", (void*)primitiveCallout}, + {(void*)_m, "primitiveCalloutWithArgs\000\005\000", (void*)primitiveCalloutWithArgs}, + {(void*)_m, "primitiveCDataModel\000\000\001", (void*)primitiveCDataModel}, + {(void*)_m, "primitiveCreateManualSurface\000\000\000", (void*)primitiveCreateManualSurface}, + {(void*)_m, "primitiveDestroyManualSurface\000\000\000", (void*)primitiveDestroyManualSurface}, + {(void*)_m, "primitiveExternalAddressAsInteger\000\000\001", (void*)primitiveExternalAddressAsInteger}, + {(void*)_m, "primitiveExternalAddressFromInteger\000\377\001", (void*)primitiveExternalAddressFromInteger}, + {(void*)_m, "primitiveFFIAllocate\000\001\000", (void*)primitiveFFIAllocate}, + {(void*)_m, "primitiveFFIDoubleAt\000\001\003", (void*)primitiveFFIDoubleAt}, + {(void*)_m, "primitiveFFIDoubleAtPut\000\001\003", (void*)primitiveFFIDoubleAtPut}, + {(void*)_m, "primitiveFFIFloatAt\000\001\003", (void*)primitiveFFIFloatAt}, + {(void*)_m, "primitiveFFIFloatAtPut\000\001\003", (void*)primitiveFFIFloatAtPut}, + {(void*)_m, "primitiveFFIFree\000\001\000", (void*)primitiveFFIFree}, + {(void*)_m, "primitiveFFIGetLastError\000\377\001", (void*)primitiveFFIGetLastError}, + {(void*)_m, "primitiveFFIIntegerAt\000\001\001", (void*)primitiveFFIIntegerAt}, + {(void*)_m, "primitiveFFIIntegerAtPut\000\001\001", (void*)primitiveFFIIntegerAtPut}, + {(void*)_m, "primitiveForceLoad\000\002\000", (void*)primitiveForceLoad}, + {(void*)_m, "primitiveLoadSymbolFromModule\000\002\000", (void*)primitiveLoadSymbolFromModule}, + {(void*)_m, "primitiveLogCallsTo\000\000\000", (void*)primitiveLogCallsTo}, + {(void*)_m, "primitivePluginVersion\000\377\001", (void*)primitivePluginVersion}, + {(void*)_m, "primitiveSetManualSurfacePointer\000\000\000", (void*)primitiveSetManualSurfacePointer}, + {(void*)_m, "primitiveSignedInt16At\000\001\001", (void*)primitiveSignedInt16At}, + {(void*)_m, "primitiveSignedInt16AtPut\000\001\001", (void*)primitiveSignedInt16AtPut}, + {(void*)_m, "primitiveSignedInt32At\000\001\001", (void*)primitiveSignedInt32At}, + {(void*)_m, "primitiveSignedInt32AtPut\000\001\001", (void*)primitiveSignedInt32AtPut}, + {(void*)_m, "primitiveSignedInt64At\000\001\001", (void*)primitiveSignedInt64At}, + {(void*)_m, "primitiveSignedInt64AtPut\000\001\001", (void*)primitiveSignedInt64AtPut}, + {(void*)_m, "primitiveSignedInt8At\000\001\001", (void*)primitiveSignedInt8At}, + {(void*)_m, "primitiveSignedInt8AtPut\000\001\001", (void*)primitiveSignedInt8AtPut}, + {(void*)_m, "primitiveStructureElementAlignment\000\000\001", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveUnsignedInt16At\000\001\001", (void*)primitiveUnsignedInt16At}, + {(void*)_m, "primitiveUnsignedInt16AtPut\000\001\001", (void*)primitiveUnsignedInt16AtPut}, + {(void*)_m, "primitiveUnsignedInt32At\000\001\001", (void*)primitiveUnsignedInt32At}, + {(void*)_m, "primitiveUnsignedInt32AtPut\000\001\001", (void*)primitiveUnsignedInt32AtPut}, + {(void*)_m, "primitiveUnsignedInt64At\000\001\001", (void*)primitiveUnsignedInt64At}, + {(void*)_m, "primitiveUnsignedInt64AtPut\000\001\001", (void*)primitiveUnsignedInt64AtPut}, + {(void*)_m, "primitiveUnsignedInt8At\000\001\001", (void*)primitiveUnsignedInt8At}, + {(void*)_m, "primitiveUnsignedInt8AtPut\000\001\001", (void*)primitiveUnsignedInt8AtPut}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveCalloutAccessorDepth = 2; -EXPORT(signed char) primitiveCalloutWithArgsAccessorDepth = 4; -EXPORT(signed char) primitiveCDataModelAccessorDepth = 0; -EXPORT(signed char) primitiveCreateManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveFFIAllocateAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFreeAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveForceLoadAccessorDepth = 2; -EXPORT(signed char) primitiveLoadSymbolFromModuleAccessorDepth = 2; -EXPORT(signed char) primitiveLogCallsToAccessorDepth = 0; -EXPORT(signed char) primitiveSetManualSurfacePointerAccessorDepth = 0; -EXPORT(signed char) primitiveStructureElementAlignmentAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveCalloutWithArgsMetadata = 0x500; +EXPORT(signed short) primitiveCDataModelMetadata = 1; +EXPORT(signed short) primitiveCreateManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveDestroyManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveExternalAddressAsIntegerMetadata = 1; +EXPORT(signed short) primitiveExternalAddressFromIntegerMetadata = -255; +EXPORT(signed short) primitiveFFIAllocateMetadata = 0x100; +EXPORT(signed short) primitiveFFIDoubleAtMetadata = 259; +EXPORT(signed short) primitiveFFIDoubleAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFreeMetadata = 0x100; +EXPORT(signed short) primitiveFFIGetLastErrorMetadata = -255; +EXPORT(signed short) primitiveFFIIntegerAtMetadata = 0x101; +EXPORT(signed short) primitiveFFIIntegerAtPutMetadata = 0x101; +EXPORT(signed short) primitiveForceLoadMetadata = 0x200; +EXPORT(signed short) primitiveLoadSymbolFromModuleMetadata = 0x200; +EXPORT(signed short) primitiveLogCallsToMetadata = 0; +EXPORT(signed short) primitivePluginVersionMetadata = -255; +EXPORT(signed short) primitiveSetManualSurfacePointerMetadata = 0; +EXPORT(signed short) primitiveSignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtPutMetadata = 0x101; +EXPORT(signed short) primitiveStructureElementAlignmentMetadata = 1; +EXPORT(signed short) primitiveUnsignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtPutMetadata = 0x101; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c b/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c index 5e7de3c0bb..e66c7f7b14 100644 --- a/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c +++ b/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c @@ -1,5 +1,5 @@ /* Automatically generated by - ThreadedFFIPlugin VMMaker.oscog-eem.2944 uuid: 242b00d2-2d09-4363-8f25-cedcd6ee2187 + ThreadedFFIPlugin VMMaker.oscog-eem.2999 uuid: c7933314-4edf-4570-b6d8-3891b13c233d */ #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7__) || defined(__arm32__) || defined(ARM32) || defined(_M_ARM) diff --git a/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c b/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c index c307eb9eda..3f715266bb 100644 --- a/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c +++ b/src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 from - ThreadedX64SysVFFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + ThreadedX64SysVFFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 */ -static char __buildInfo[] = "ThreadedX64SysVFFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "ThreadedX64SysVFFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 " __DATE__ ; #include "config.h" @@ -158,27 +158,30 @@ static char __buildInfo[] = "ThreadedX64SysVFFIPlugin VMMaker.oscog-eem.2985 uui #define FFIStructSizeMask 0xFFFF #define FFITypeBool 1 #define FFITypeDoubleFloat 13 -#define FFITypeSignedByte 3 -#define FFITypeSignedChar 11 -#define FFITypeSignedInt 7 -#define FFITypeSignedLongLong 9 -#define FFITypeSignedShort 5 +#define FFITypeSignedChar32 11 +#define FFITypeSignedChar8 11 +#define FFITypeSignedInt16 5 +#define FFITypeSignedInt32 7 +#define FFITypeSignedInt64 9 +#define FFITypeSignedInt8 3 #define FFITypeSingleFloat 12 -#define FFITypeUnsignedByte 2 -#define FFITypeUnsignedInt 6 -#define FFITypeUnsignedLongLong 8 -#define FFITypeUnsignedShort 4 +#define FFITypeUnsignedInt16 4 +#define FFITypeUnsignedInt32 6 +#define FFITypeUnsignedInt64 8 +#define FFITypeUnsignedInt8 2 #define FFITypeVoid 0 #define MaxNumArgs 15 #define NumFloatRegArgs 8 #define NumIntRegArgs 6 -#define PluginVersionInfo " VMMaker.oscog-eem.2985" +#define PluginVersionInfo " VMMaker.oscog-eem.3041" #define PrimErrBadArgument 3 +#define PrimErrBadIndex 4 #define PrimErrBadMethod 12 #define PrimErrBadNumArgs 5 #define PrimErrBadReceiver 2 #define PrimErrFFIException 22 #define PrimErrNoCMemory 10 +#define PrimErrNoMemory 9 #define PrimErrNotFound 11 #define PrimErrObjectMayMove 14 #if !defined(SPURVM) /* Allow this to be overridden on the compiler command line */ @@ -263,46 +266,22 @@ typedef struct { /*** Function Prototypes ***/ static sqInt alignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt *indexPtr); static sqInt atomicTypeOf(sqInt typeSpec); -static sqInt canReturnInRegistersStructOfSize(sqInt returnStructSize); static sqInt checkAlignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static sqInt checkAlignmentOfUnionSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static void cleanupCalloutState(CalloutState *calloutState); -static sqInt encodeStructReturnTypeIn(CalloutState *calloutState); static void * ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize); static sqInt ffiArgByValuein(sqInt oop, CalloutState *calloutState); static sqInt ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *calloutState); -static sqInt ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); -static sqInt ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); static sqInt ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs); static sqInt ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState); -static sqInt ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode); -static sqInt ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState); static sqInt ffiFail(sqInt reason); -static double ffiFloatValueOf(sqInt oop); static sqInt ffiIntegerValueOf(sqInt oop); static sqInt ffiLoadCalloutAddressFrom(sqInt oop); -static sqInt ffiLoadCalloutAddress(sqInt lit); static sqInt ffiLoadCalloutModule(sqInt module); static void ffiLogCallout(sqInt lit); EXPORT(sqInt) ffiLogCallsTo(char *fileName); static sqInt ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushPointerin(void *pointer, CalloutState *calloutState); -static sqInt ffiPushSignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState); -static sqInt ffiPushSignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState); static sqInt ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState); -static sqInt ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState); -static sqInt ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushVoidin(sqInt ignored, CalloutState *calloutState); static sqInt ffiReturnCStringFrom(sqInt cPointer); static sqInt ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutState); static sqInt ffiReturnStructofTypein(void *structRetPtr, sqInt ffiRetType, CalloutState *calloutState); @@ -324,6 +303,8 @@ EXPORT(void) primitiveCalloutWithArgs(void); EXPORT(sqInt) primitiveCDataModel(void); EXPORT(sqInt) primitiveCreateManualSurface(void); EXPORT(sqInt) primitiveDestroyManualSurface(void); +EXPORT(sqInt) primitiveExternalAddressAsInteger(void); +EXPORT(sqInt) primitiveExternalAddressFromInteger(void); EXPORT(sqInt) primitiveFFIAllocate(void); EXPORT(sqInt) primitiveFFIDoubleAt(void); EXPORT(sqInt) primitiveFFIDoubleAtPut(void); @@ -336,12 +317,28 @@ EXPORT(sqInt) primitiveFFIIntegerAtPut(void); EXPORT(sqInt) primitiveForceLoad(void); EXPORT(sqInt) primitiveLoadSymbolFromModule(void); EXPORT(sqInt) primitiveLogCallsTo(void); +EXPORT(sqInt) primitivePluginVersion(void); EXPORT(sqInt) primitiveSetManualSurfacePointer(void); +EXPORT(sqInt) primitiveSignedInt16At(void); +EXPORT(sqInt) primitiveSignedInt16AtPut(void); +EXPORT(sqInt) primitiveSignedInt32At(void); +EXPORT(sqInt) primitiveSignedInt32AtPut(void); +EXPORT(sqInt) primitiveSignedInt64At(void); +EXPORT(sqInt) primitiveSignedInt64AtPut(void); +EXPORT(sqInt) primitiveSignedInt8At(void); +EXPORT(sqInt) primitiveSignedInt8AtPut(void); EXPORT(sqInt) primitiveStructureElementAlignment(void); +EXPORT(sqInt) primitiveUnsignedInt16At(void); +EXPORT(sqInt) primitiveUnsignedInt16AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt32At(void); +EXPORT(sqInt) primitiveUnsignedInt32AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt64At(void); +EXPORT(sqInt) primitiveUnsignedInt64AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt8At(void); +EXPORT(sqInt) primitiveUnsignedInt8AtPut(void); static sqInt registerTypeForStructSpecsOfLength(unsigned int *specs, sqInt specSize); static sqInt registerTypeForStructSpecsOfLengthStartingAtByteOffsetEightbyteOffset(sqInt initialRegisterType, unsigned int *specs, sqInt specSize, sqInt *indexPtr, sqInt initialByteOffset, sqInt initialEightbyteOffset); static sqInt registerTypeForUnionSpecsOfLengthStartingAtByteOffsetEightbyteOffset(sqInt initialRegisterType, unsigned int *specs, sqInt specSize, sqInt *indexPtr, sqInt byteOffset, sqInt eightbyteOffset); -static sqInt returnStructInRegisters(CalloutState *calloutState); EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); static sqInt sizeField(sqInt alienOop); static sqInt startOfData(sqInt alienOop); @@ -455,6 +452,7 @@ static sqInt (*primitiveFailForOSError)(sqLong osError); static sqInt (*primitiveMethod)(void); static sqInt (*pushRemappableOop)(sqInt oop); static sqInt (*signed32BitIntegerFor)(sqInt integerValue); +static int (*signed32BitValueOf)(sqInt oop); static sqInt (*signed64BitIntegerFor)(sqLong integerValue); static sqLong (*signed64BitValueOf)(sqInt oop); static sqIntptr_t (*signedMachineIntegerValueOf)(sqInt oop); @@ -560,6 +558,7 @@ extern sqInt primitiveFailForOSError(sqLong osError); extern sqInt primitiveMethod(void); extern sqInt pushRemappableOop(sqInt oop); extern sqInt signed32BitIntegerFor(sqInt integerValue); +extern int signed32BitValueOf(sqInt oop); extern sqInt signed64BitIntegerFor(sqLong integerValue); extern sqLong signed64BitValueOf(sqInt oop); extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); @@ -574,7 +573,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "X64SysVFFIPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "X64SysVFFIPlugin VMMaker.oscog-eem.3041 " INT_EXT; /*** Macros ***/ @@ -642,16 +641,6 @@ atomicTypeOf(sqInt typeSpec) } -/* Answer if a struct result of a given size is returned in registers or not. */ - - /* ThreadedX64SysVFFIPlugin>>#canReturnInRegistersStructOfSize: */ -static sqInt -canReturnInRegistersStructOfSize(sqInt returnStructSize) -{ - return returnStructSize <= (WordSize * 2); -} - - /* Check the alignment of a structure and return true if correctly aligned. If computed size = declared size, then the struct is assumed correctly aligned. @@ -750,32 +739,6 @@ cleanupCalloutState(CalloutState *calloutState) } -/* Set the return type to an integer encoding the type of registers used to - return the struct - * 2r00 for float float (XMM0 XMM1) - * 2r01 for int float (RAX XMM0) - * 2r10 for float int (XMM0 RAX) - * 2r11 for int int (RAX RDX) - * 2r100 for float (XMM0) - * 2r101 for int (RAX) - * 2r110 For return thru memory (struct field not aligned or struct too - big) - */ - - /* ThreadedX64SysVFFIPlugin>>#encodeStructReturnTypeIn: */ -static sqInt -encodeStructReturnTypeIn(CalloutState *calloutState) -{ - sqInt registerType; - - registerType = (((calloutState->structReturnSize)) <= (WordSize * 2) - ? registerTypeForStructSpecsOfLength(firstIndexableField((calloutState->ffiRetSpec)), slotSizeOf((calloutState->ffiRetSpec))) - : 6); - (calloutState->structReturnType = registerType); - return 0; -} - - /* Answer a long of the address of the byteSize slot (byte, short, int, whatever) at byteOffset in rcvr. Nominally intended for use with ExternalAddress objects, this code will @@ -790,17 +753,14 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) sqInt rcvrClass; sqInt rcvrSize; - if (!(isBytes(rcvr))) { - return 0; - } if (!(byteOffset > 0)) { - return 0; + return null; } rcvrClass = fetchClassOf(rcvr); rcvrSize = byteSizeOf(rcvr); if (rcvrClass == (classExternalAddress())) { if (!(rcvrSize == BytesPerWord)) { - return 0; + return null; } /* Hack!! */ @@ -809,17 +769,16 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) if (addr == 0) { /* or: [(interpreterProxy isInMemory: addr) or: [(interpreterProxy isPinned: rcvr) not]] */ - return 0; + return null; } } else { if (!(((byteOffset + byteSize) - 1) <= rcvrSize)) { - return 0; + return null; } addr = ((sqIntptr_t) (firstIndexableField(rcvr))); } - addr = (addr + byteOffset) - 1; - return ((void *)addr); + return ((void *)((addr + byteOffset) - 1)); } @@ -833,6 +792,8 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) double floatValue; sqInt intValue; sqInt typeSpec; + usqLong value; + sqLong value1; /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiArgHeader); @@ -844,7 +805,7 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) if (atomicType < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = oop; @@ -919,27 +880,191 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value1)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value1); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; default: error("Case not found"); @@ -1047,6 +1172,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c sqInt typeSpec; sqInt typeSpec1; sqInt typeSpec2; + usqLong value; + sqLong value1; sqInt valueOop; sqInt valueOop1; @@ -1435,8 +1562,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { err = FFIErrorCoercionFailed; goto l3; @@ -1462,7 +1589,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) ? 0 : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* string value (char*) */ /* note: the only types allowed for passing into char* types are @@ -1502,7 +1629,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } return 0; } - atomicType1 = FFITypeUnsignedByte; + atomicType1 = FFITypeUnsignedInt8; } # if COGMTVM @@ -1517,7 +1644,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } # endif // COGMTVM if ((atomicType1 == FFITypeVoid) - || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { + || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedInt8)) >> 1))) { /* byte* -- see comment on string above */ if (isString @@ -1656,7 +1783,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c if (atomicType2 < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = valueOop; @@ -1666,20 +1793,20 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c if (((valueOop & (BytesPerWord - 1)) != 0)) { if (isIntegerObject(valueOop)) { intValue = integerValueOf(valueOop); - goto l34; + goto l33; } # if SPURVM if (isCharacterObject(valueOop)) { /* Immediate in Spur */ intValue = characterValueOf(valueOop); - goto l34; + goto l33; } if (isFloatObject(valueOop)) { /* Immediate in 64-bit Spur */ intValue = floatValueOf(valueOop); - goto l34; + goto l33; } # endif // SPURVM } @@ -1690,39 +1817,39 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c # else if (isCharacterObject(valueOop)) { intValue = characterValueOf(valueOop); - goto l34; + goto l33; } # endif if (isFloatObject(valueOop)) { intValue = floatValueOf(valueOop); - goto l34; + goto l33; } if (valueOop == (nilObject())) { intValue = 0; - goto l34; + goto l33; } if (valueOop == (falseObject())) { intValue = 0; - goto l34; + goto l33; } if (valueOop == (trueObject())) { intValue = 1; - goto l34; + goto l33; } if (isLargePositiveIntegerObject(valueOop)) { # if BytesPerWord == 8 /* Use cppIf: to get the return type of the function right. Should be sqInt on 32-bits. */ intValue = positive64BitValueOf(valueOop); - goto l34; + goto l33; # else // BytesPerWord == 8 intValue = positive32BitValueOf(valueOop); - goto l34; + goto l33; # endif } } intValue = signedMachineIntegerValueOf(valueOop); - l34: /* end ffiIntegerValueOf: */; + l33: /* end ffiIntegerValueOf: */; } if (failed()) { return FFIErrorCoercionFailed; @@ -1731,27 +1858,191 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value1)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value1); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; default: error("Case not found"); @@ -1761,10 +2052,10 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c /* begin ffiFloatValueOf: */ if (isFloatObject(valueOop)) { floatValue = floatValueOf(valueOop); - goto l30; + goto l34; } floatValue = ((double) (ffiIntegerValueOf(valueOop)) ); - l30: /* end ffiFloatValueOf: */; + l34: /* end ffiFloatValueOf: */; if (failed()) { return FFIErrorCoercionFailed; } @@ -1806,309 +2097,25 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } -/* Support for generic callout. Prepare a pointer reference to an atomic type - for callout. - Note: - for type 'void*' we allow ByteArray/String/Symbol, wordVariableSubclass, - Alien or ExternalAddress. - for other types we allow ByteArray, wordVariableSubclass, Alien or - ExternalAddress. - */ +/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes + args from the stack + and the spec from the method. If argArrayOrNil is not nil takes args from + argArrayOrNil and the spec from the receiver. */ - /* ThreadedFFIPlugin>>#ffiAtomicArgByReference:Class:in: */ + /* ThreadedFFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ static sqInt -ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) +ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) { - sqInt argIsAlien; - sqInt atomicType; - char *copy; - sqInt isString; - sqInt length; - char *pointer; - void *pointer1; - void *pointer2; - void *pointer3; - void *pointer4; - void *pointer5; - void *pointer6; - sqInt typeSpec; - - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType == FFITypeBool) { - - /* No bools on input */ - return FFIErrorCoercionFailed; - } - argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) - ? 0 - : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { - - /* string value (char*) */ - /* note: the only types allowed for passing into char* types are - ByteArray, String, Symbol, Alien and *no* other byte indexed objects - (e.g., CompiledMethod, LargeInteger). We only check for strings - here and fall through to the byte* check otherwise. */ - if (isString) { - - /* String/Symbol */ - /* Strings must be allocated by the ffi support code */ - /* begin ffiPushString:OfLength:in: */ - pointer = firstIndexableField(oop); - length = byteSizeOf(oop); - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - atomicType = FFITypeUnsignedByte; - } -# if COGMTVM - - /* Since all the following pass the address of the first indexable field we need to fail - the call if it is threaded and the object is young, since it may move during the call. */ - if ((((((calloutState->callFlags)) & FFICallFlagThreaded) != 0)) - && (((!argIsAlien) - || ((assert(isAlien(oop)), - (longAt(oop + BaseHeaderSize)) > 0))) - && (isYoung(oop)))) { - return -PrimErrObjectMayMove; - } -# endif // COGMTVM - if ((atomicType == FFITypeVoid) - || ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { - - /* byte* -- see comment on string above */ - if (isString - || (oopClass == (classByteArray()))) { - - /* String/Symbol/ByteArray */ - /* begin ffiPushPointer:in: */ - pointer1 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer1)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer1); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer2 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer2)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer2); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer3 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer3)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer3); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (!(atomicType == FFITypeVoid)) { - return FFIErrorCoercionFailed; - } - } - if (atomicType <= FFITypeDoubleFloat) { - if ((isWords(oop)) - || (oopClass == (classByteArray()))) { - /* begin ffiPushPointer:in: */ - pointer4 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer4)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer4); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer5 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer5)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer5); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer6 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer6)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer6); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - } - return FFIErrorCoercionFailed; -} - - -/* Support for generic callout. Prepare an external pointer reference to an - atomic type for callout. - */ - - /* ThreadedFFIPlugin>>#ffiAtomicStructByReference:Class:in: */ -static sqInt -ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) -{ - sqInt atomicType; - sqInt err; - sqInt ptrType; - sqInt spec; - sqInt specOop; - sqInt specType; - sqInt typeSpec; - sqInt valueOop; - - - /* must be external data to pass pointers to atomic type */ - if (!(oopClass == (classExternalData()))) { - return FFIErrorCoercionFailed; - } - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType != FFITypeVoid) { - /* begin ffiValidateExternalData:AtomicType: */ - ptrType = fetchPointerofObject(1, oop); - if (!((isPointers(ptrType)) - && ((slotSizeOf(ptrType)) >= 2))) { - err = FFIErrorWrongType; - goto l3; - } - specOop = fetchPointerofObject(0, ptrType); - if (!((isWords(specOop)) - && ((slotSizeOf(specOop)) > 0))) { - err = FFIErrorWrongType; - goto l3; - } - spec = fetchPointerofObject(0, specOop); - if (!(((spec & FFIFlagAtomic) != 0))) { - err = FFIErrorWrongType; - goto l3; - } - /* begin atomicTypeOf: */ - specType = ((usqInt)((spec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (specType != atomicType) { - - /* Allow for signed/unsigned conversion but nothing else. - See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) - && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { - err = FFIErrorCoercionFailed; - goto l3; - } - } - err = 0; - l3: /* end ffiValidateExternalData:AtomicType: */; - if (err != 0) { - return err; - } - } - valueOop = fetchPointerofObject(0, oop); - return ffiPushPointerContentsOfin(valueOop, calloutState); -} - - -/* Generic callout. Does the actual work. If argArrayOrNil is nil it takes - args from the stack - and the spec from the method. If argArrayOrNil is not nil takes args from - argArrayOrNil and the spec from the receiver. */ - - /* ThreadedFFIPlugin>>#ffiCall:ArgArrayOrNil:NumArgs: */ -static sqInt -ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs) -{ - sqInt address; - sqInt address1; - sqInt addressPtr; - char *allocation; - sqInt argClass; - sqInt argSpec; - sqInt argType; - sqInt argTypeArray; - sqInt argTypes; - sqInt argTypes1; + sqInt address; + sqInt address1; + sqInt addressPtr; + char *allocation; + sqInt argClass; + sqInt argSpec; + sqInt argType; + sqInt argTypeArray; + sqInt argTypes; + sqInt argTypes1; sqInt atomicType; sqInt atomicType1; sqInt byteSize; @@ -2372,7 +2379,7 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -2456,18 +2463,18 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : trueObject()); goto l7; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -2489,19 +2496,15 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : positive32BitIntegerFor(intRet))); goto l7; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l7; } -# if SPURVM - result = characterObjectOf(intRet & 0x3FFFFFFF); - goto l7; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result = characterObjectOf(intRet & 0xFF); goto l7; -# endif } registerType = (calloutState->structReturnType); switch (registerType) { @@ -2610,87 +2613,6 @@ ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState) } -/* Make sure that the given oop is a valid external handle */ - - /* ThreadedFFIPlugin>>#ffiContentsOfHandle:errCode: */ -static sqInt -ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode) -{ - if (!((isBytes(oop)) - && ((byteSizeOf(oop)) == (sizeof(sqInt))))) { - return ffiFail(errCode); - } - return fetchPointerofObject(0, oop); -} - - -/* Callout support. Return the appropriate oop for the given atomic type */ - - /* ThreadedFFIPlugin>>#ffiCreateIntegralResultOop:ofAtomicType:in: */ -static sqInt -ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState) -{ - sqInt byteSize; - usqLong mask; - sqInt shift; - usqLong value; - - assert(atomicType < FFITypeSingleFloat); - if (atomicType == FFITypeBool) { - - /* Make sure bool honors the byte size requested */ - byteSize = ((calloutState->ffiRetHeader)) & FFIStructSizeMask; - value = (byteSize == (sizeof(retVal)) - ? retVal - : retVal & (((((unsigned long long)1)) << (byteSize * 8)) - 1)); - return (value == 0 - ? falseObject() - : trueObject()); - } - if (atomicType <= FFITypeSignedInt) { - - /* these are all generall integer returns */ - if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { - - /* byte/short. first extract partial word, then sign extend */ - - /* # of significant bits */ - shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) - ? 32 - : (((usqInt)(atomicType)) >> 1) * 8); - value = retVal & (((((unsigned long long)1)) << shift) - 1); - if (((atomicType & 1) != 0)) { - - /* make the guy signed */ - mask = (((unsigned long long)1)) << (shift - 1); - value = (value & (mask - 1)) - (value & mask); - } - return integerObjectOf(value); - } - return (((atomicType & 1) != 0) - ? (BytesPerWord == 8 - ? signed64BitIntegerFor(retVal) - : signed32BitIntegerFor(retVal)) - : (BytesPerWord == 8 - ? positive64BitIntegerFor(retVal) - : positive32BitIntegerFor(retVal))); - } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { - return (((atomicType & 1) != 0) - ? signed64BitIntegerFor(retVal) - : positive64BitIntegerFor(retVal)); - } -# if SPURVM - return characterObjectOf(retVal & 0x3FFFFFFF); -# else - return characterObjectOf(retVal & 0xFF); -# endif -} - - /* Map the FFI error code into a primitive error code. If reason is negative it encodes one of the standard PrimErr... codes, negated to distinguish it from the FFIError @@ -2714,21 +2636,6 @@ ffiFail(sqInt reason) } -/* Support for generic callout. Return a float value that is coerced as C - would do. - */ - - /* ThreadedFFIPlugin>>#ffiFloatValueOf: */ -static double -ffiFloatValueOf(sqInt oop) -{ - if (isFloatObject(oop)) { - return floatValueOf(oop); - } - return ((double) (ffiIntegerValueOf(oop)) ); -} - - /* Support for generic callout. Answer an integer value that is coerced as C would do. */ @@ -2821,52 +2728,6 @@ ffiLoadCalloutAddressFrom(sqInt oop) } -/* Load the address of the foreign function from the given object */ - - /* ThreadedFFIPlugin>>#ffiLoadCalloutAddress: */ -static sqInt -ffiLoadCalloutAddress(sqInt lit) -{ - sqInt address; - sqInt addressPtr; - sqIntptr_t *ptr; - - - /* Lookup the address */ - - /* Make sure it's an external handle */ - addressPtr = fetchPointerofObject(0, lit); - /* begin ffiContentsOfHandle:errCode: */ - if (!((isBytes(addressPtr)) - && ((byteSizeOf(addressPtr)) == (sizeof(sqInt))))) { - address = ffiFail(FFIErrorBadAddress); - goto l1; - } - address = fetchPointerofObject(0, addressPtr); - l1: /* end ffiContentsOfHandle:errCode: */; - if (failed()) { - return 0; - } - if (address == 0) { - - /* Go look it up in the module */ - if (externalFunctionInstSize > ExternalFunctionStackSizeIndex) { - storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, lit, -1); - } - if ((slotSizeOf(lit)) < 5) { - return ffiFail(FFIErrorNoModule); - } - address = ffiLoadCalloutAddressFrom(lit); - if (failed()) { - return 0; - } - ptr = firstIndexableField(addressPtr); - ptr[0] = address; - } - return address; -} - - /* Load the given module and return its handle */ /* ThreadedFFIPlugin>>#ffiLoadCalloutModule: */ @@ -3065,198 +2926,10 @@ ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedX64FFIPlugin>>#ffiPushPointer:in: */ -static sqInt -ffiPushPointerin(void *pointer, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - /* ThreadedX64FFIPlugin>>#ffiPushSignedByte:in: */ -static sqInt -ffiPushSignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedChar:in: */ -static sqInt -ffiPushSignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedInt:in: */ -static sqInt -ffiPushSignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - -/* Push a longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushSignedLongLongOop:in: */ -static sqInt -ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - sqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = signed64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushSignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedLongLong:in: */ -static sqInt -ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedShort:in: */ -static sqInt -ffiPushSignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedFFIPlugin>>#ffiPushString:OfLength:in: */ -static sqInt -ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState) -{ - char *copy; - - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - -/* Push the contents of the given external structure */ - - /* ThreadedFFIPlugin>>#ffiPushStructureContentsOf:in: */ +/* Push the contents of the given external structure */ + + /* ThreadedFFIPlugin>>#ffiPushStructureContentsOf:in: */ static sqInt ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) { @@ -3556,273 +3229,6 @@ ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedX64SysVFFIPlugin>>#ffiPushStructure:ofSize:typeSpec:ofLength:in: */ -static sqInt -ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState) -{ - sqInt numDoubleRegisters; - sqInt numIntegerRegisters; - int passField0InXmmReg; - int passField1InXmmReg; - sqInt registerType; - sqInt roundedSize; - - passField1InXmmReg = 0; - if (structSize <= 16) { - - /* See sec 3.2.3 of http://people.freebsd.org/~obrien/amd64-elf-abi.pdf. (dravft version 0.90). - All of the folowing are passed in registers: - typedef struct { long a; } s0; - typedef struct { double a; } s1; - typedef struct { long a; double b; } s2; - typedef struct { int a; int b; double c; } s2a; - typedef struct { short a; short b; short c; short d; double e; } s2b; - typedef struct { long a; float b; } s2f; - typedef struct { long a; float b; float c; } s2g; - typedef struct { int a; float b; int c; float d; } s2h; */ - registerType = registerTypeForStructSpecsOfLength(((unsigned int *) argSpec), argSpecSize); - if (!(registerType == 6)) { - - /* check case of invalid alignment => pass by memory */ - passField0InXmmReg = (registerType & 1) == 0; - if (structSize <= 8) { - numIntegerRegisters = registerType & 1; - numDoubleRegisters = 1 - numIntegerRegisters; - } - else { - passField1InXmmReg = (registerType & 2) == 0; - numIntegerRegisters = (((usqInt)((registerType & 2))) >> 1) + (registerType & 1); - numDoubleRegisters = 2 - numIntegerRegisters; - } - if (((((calloutState->floatRegisterIndex)) + numDoubleRegisters) <= NumFloatRegArgs) - && ((((calloutState->integerRegisterIndex)) + numIntegerRegisters) <= NumIntRegArgs)) { - if (passField0InXmmReg) { - /* begin ffiPushDoubleFloat:in: */ - if (((calloutState->floatRegisterIndex)) < NumFloatRegArgs) { - ((calloutState->floatRegisters))[(calloutState->floatRegisterIndex)] = ((*((double *) pointer))); - /* begin incrementFloatRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->floatRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - goto l2; - } - storeFloatAtPointerfrom((calloutState->currentArg), (*((double *) pointer))); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - l2: /* end ffiPushDoubleFloat:in: */; - } - else { - /* begin ffiPushSignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) ((*((long long *) pointer))))); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - goto l4; - } - longAtput((calloutState->currentArg), (*((long long *) pointer))); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - l4: /* end ffiPushSignedLongLong:in: */; - } - if (structSize > 8) { - if (passField1InXmmReg) { - /* begin ffiPushDoubleFloat:in: */ - if (((calloutState->floatRegisterIndex)) < NumFloatRegArgs) { - ((calloutState->floatRegisters))[(calloutState->floatRegisterIndex)] = ((((double *) pointer))[1]); - /* begin incrementFloatRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->floatRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - goto l6; - } - storeFloatAtPointerfrom((calloutState->currentArg), (((double *) pointer))[1]); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - l6: /* end ffiPushDoubleFloat:in: */; - } - else { - /* begin ffiPushSignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) ((((long long *) pointer))[1]))); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - goto l8; - } - longAtput((calloutState->currentArg), (((long long *) pointer))[1]); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - l8: /* end ffiPushSignedLongLong:in: */; - } - } - return 0; - } - } - } - roundedSize = (((structSize + 7) | 7) - 7); - if ((((calloutState->currentArg)) + roundedSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - memcpy((calloutState->currentArg), ((char *) pointer), structSize); - (calloutState->currentArg = ((calloutState->currentArg)) + roundedSize); - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedByte:in: */ -static sqInt -ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedChar:in: */ -static sqInt -ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedInt:in: */ -static sqInt -ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - -/* Push an unsigned longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushUnsignedLongLongOop:in: */ -static sqInt -ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - usqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = positive64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushUnsignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedLongLong:in: */ -static sqInt -ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedShort:in: */ -static sqInt -ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1; - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - -/* This is a fallback in case somebody tries to pass a 'void' value. - We could simply ignore the argument but I think it's better to let - the caller know what he did */ - - /* ThreadedFFIPlugin>>#ffiPushVoid:in: */ -static sqInt -ffiPushVoidin(sqInt ignored, CalloutState *calloutState) -{ - return FFIErrorAttemptToPassVoid; -} - /* Create a Smalltalk string from a zero terminated C string */ @@ -3881,7 +3287,7 @@ ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutSta /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiRetHeader); atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4041,8 +3447,8 @@ ffiValidateExternalDataAtomicType(sqInt oop, sqInt atomicType) /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { return FFIErrorCoercionFailed; } @@ -4551,7 +3957,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4635,18 +4041,18 @@ primitiveCallout(void) : trueObject()); goto l7; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -4668,19 +4074,15 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet))); goto l7; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l7; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l7; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); goto l7; -# endif } registerType = (calloutState->structReturnType); switch (registerType) { @@ -4980,7 +4382,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -5064,18 +4466,18 @@ primitiveCallout(void) : trueObject()); goto l14; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -5097,19 +4499,15 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet1))); goto l14; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l14; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l14; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); goto l14; -# endif } registerType1 = (calloutState1->structReturnType); switch (registerType1) { @@ -5554,7 +4952,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -5638,18 +5036,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l7; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -5671,19 +5069,15 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet))); goto l7; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l7; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l7; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); goto l7; -# endif } registerType = (calloutState->structReturnType); switch (registerType) { @@ -5989,7 +5383,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -6073,18 +5467,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l14; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -6106,19 +5500,15 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet1))); goto l14; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l14; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l14; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); goto l14; -# endif } registerType1 = (calloutState1->structReturnType); switch (registerType1) { @@ -6377,15 +5767,61 @@ primitiveDestroyManualSurface(void) } -/* Primitive. Allocate an object on the external heap. */ +/* Answer the address of a 4 byte or 8 byte ExternalAddress. */ - /* ThreadedFFIPlugin>>#primitiveFFIAllocate */ + /* ThreadedFFIPlugin>>#primitiveExternalAddressAsInteger */ EXPORT(sqInt) -primitiveFFIAllocate(void) +primitiveExternalAddressAsInteger(void) { - sqInt addr; - sqInt byteSize; - sqInt oop; + sqInt rcvr; + sqInt size; + + rcvr = stackValue(0); + size = byteSizeOf(rcvr); + if (size == 8) { + return methodReturnValue(positive64BitIntegerFor((*((usqLong *) (firstIndexableField(rcvr)))))); + } + if (size == 4) { + return methodReturnValue(positive32BitIntegerFor((*((unsigned int *) (firstIndexableField(rcvr)))))); + } + primitiveFailFor(PrimErrBadReceiver); + return 0; +} + + +/* Answer a 4 byte or 8 byte ExternalAddress with value of the argument. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressFromInteger */ +EXPORT(sqInt) +primitiveExternalAddressFromInteger(void) +{ + sqInt address; + usqIntptr_t value; + + value = positiveMachineIntegerValueOf(stackValue(0)); + if (failed()) { + return primitiveFailFor(PrimErrBadArgument); + } + address = instantiateClassindexableSize(classExternalAddress(), BytesPerWord); + if (address == null) { + return primitiveFailFor(PrimErrNoMemory); + } + else { + (*((usqIntptr_t *) (firstIndexableField(address))) = value); + return methodReturnValue(address); + } +} + + +/* Primitive. Allocate an object on the external heap. */ + + /* ThreadedFFIPlugin>>#primitiveFFIAllocate */ +EXPORT(sqInt) +primitiveFFIAllocate(void) +{ + sqInt addr; + sqInt byteSize; + sqInt oop; sqIntptr_t *ptr; byteSize = stackIntegerValue(0); @@ -6403,7 +5839,7 @@ primitiveFFIAllocate(void) } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAt */ EXPORT(sqInt) @@ -6414,22 +5850,23 @@ primitiveFFIDoubleAt(void) double floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(double)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAtPut */ EXPORT(sqInt) @@ -6437,32 +5874,39 @@ primitiveFFIDoubleAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; double floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((double) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((double) (floatValueOf(valueOop))); } else { - floatValue = ((double) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((double) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(double)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAt */ EXPORT(sqInt) @@ -6473,22 +5917,23 @@ primitiveFFIFloatAt(void) float floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(float)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAtPut */ EXPORT(sqInt) @@ -6496,28 +5941,35 @@ primitiveFFIFloatAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; float floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((float) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((float) (floatValueOf(valueOop))); } else { - floatValue = ((float) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((float) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(floatValue)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } @@ -6594,51 +6046,53 @@ primitiveFFIIntegerAt(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (byteSize <= 2) { - if (byteSize == 1) { - value = ((unsigned char) (byteAt(addr))); - } - else { - value = ((unsigned short) (unalignedShortAt(addr))); - } + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - if (byteSize == 4) { - value = ((unsigned int) (unalignedLong32At(addr))); + if (byteSize <= 2) { + if (byteSize == 1) { + value = ((unsigned char) (byteAt(addr))); + } + else { + value = ((unsigned short) (unalignedShortAt(addr))); + } } else { - value = unalignedLong64At(addr); + if (byteSize == 4) { + value = ((unsigned int) (unalignedLong32At(addr))); + } + else { + value = unalignedLong64At(addr); + } } - } - if (byteSize < BytesPerWord) { - if (isSigned) { - - /* sign extend value */ - mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); - value = (value & (mask - 1)) - (value & mask); - } - valueOop = integerObjectOf(value); - } - else { - - /* general 64 bit integer; note these never fail */ - if (isSigned) { - if (byteSize < 8) { + if (byteSize < BytesPerWord) { + if (isSigned) { /* sign extend value */ mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); value = (value & (mask - 1)) - (value & mask); } - valueOop = signed64BitIntegerFor(value); + valueOop = integerObjectOf(value); } else { - valueOop = positive64BitIntegerFor(value); + + /* general 64 bit integer; note these never fail */ + if (isSigned) { + if (byteSize < 8) { + + /* sign extend value */ + mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); + value = (value & (mask - 1)) - (value & mask); + } + valueOop = signed64BitIntegerFor(value); + } + else { + valueOop = positive64BitIntegerFor(value); + } } + return methodReturnValue(valueOop); } - return popthenPush(4, valueOop); } @@ -6672,49 +6126,51 @@ primitiveFFIIntegerAtPut(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (isSigned) { - value = signed64BitValueOf(valueOop); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - value = positive64BitValueOf(valueOop); - } - if (failed()) { - return 0; - } - if (byteSize < 8) { if (isSigned) { - max = (((unsigned long long)1)) << ((8 * byteSize) - 1); - if (!((value >= (0 - max)) - && (value < max))) { - return primitiveFail(); - } + value = signed64BitValueOf(valueOop); } else { - if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { - return primitiveFail(); - } + value = positive64BitValueOf(valueOop); } - } - if (byteSize <= 2) { - if (byteSize == 1) { - byteAtput(addr, value); + if (failed()) { + return 0; } - else { - unalignedShortAtput(addr, value); + if (byteSize < 8) { + if (isSigned) { + max = (((unsigned long long)1)) << ((8 * byteSize) - 1); + if (!((value >= (0 - max)) + && (value < max))) { + return primitiveFail(); + } + } + else { + if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { + return primitiveFail(); + } + } } - } - else { - if (byteSize == 4) { - unalignedLong32Atput(addr, value); + if (byteSize <= 2) { + if (byteSize == 1) { + byteAtput(addr, value); + } + else { + unalignedShortAtput(addr, value); + } } else { - unalignedLong64Atput(addr, value); + if (byteSize == 4) { + unalignedLong32Atput(addr, value); + } + else { + unalignedLong64Atput(addr, value); + } } + return methodReturnValue(valueOop); } - return popthenPush(5, valueOop); } @@ -6840,6 +6296,19 @@ primitiveLogCallsTo(void) } +/* Answer the plugins current version to ensure compatibility with data + structures shared between plugin an image code such as: + - Type codes in FFIConstants + - Known classes in the special-objects array */ + + /* ThreadedFFIPlugin>>#primitivePluginVersion */ +EXPORT(sqInt) +primitivePluginVersion(void) +{ + return methodReturnInteger(1); +} + + /* Create a 'manual surface' data-structure. See the ExternalForm class in the FFI package for example usage. */ /* arguments: name(type, stack offset) @@ -6870,6 +6339,244 @@ primitiveSetManualSurfacePointer(void) } +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16At */ +EXPORT(sqInt) +primitiveSignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16AtPut */ +EXPORT(sqInt) +primitiveSignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -32768) && (value <= 0x7FFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32At */ +EXPORT(sqInt) +primitiveSignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed32BitIntegerFor(((signed int) (unalignedLong32At(addr))))); + } +} + + +/* Store the signed 32-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32AtPut */ +EXPORT(sqInt) +primitiveSignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + int value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64At */ +EXPORT(sqInt) +primitiveSignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed64BitIntegerFor(((sqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64AtPut */ +EXPORT(sqInt) +primitiveSignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 8-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8At */ +EXPORT(sqInt) +primitiveSignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed char) (byteAt(addr)))); + } +} + + +/* Store the signed 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8AtPut */ +EXPORT(sqInt) +primitiveSignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -128) && (value <= 0x7F))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + /* Answer the alignment of an element of an atomic type, or a structure, within a structure on the current platform. */ @@ -6883,28 +6590,40 @@ primitiveStructureElementAlignment(void) typeCode = stackValue(0); if (!((isIntegerObject(typeCode)) - && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedByte) && (typeCode <= FFITypeDoubleFloat))) + && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedInt8) && (typeCode <= FFITypeDoubleFloat))) || (typeCode == FFIFlagStructure)))) { return primitiveFailFor(PrimErrBadArgument); } switch (typeCode) { - case FFITypeUnsignedByte: - case FFITypeSignedByte: + case FFITypeUnsignedInt8: alignment = (&(((((structByte *) 0))->element))); break; - case FFITypeUnsignedShort: - case FFITypeSignedShort: + case FFITypeSignedInt8: + alignment = (&(((((structByte *) 0))->element))); + break; + + case FFITypeUnsignedInt16: + alignment = (&(((((structShort *) 0))->element))); + break; + + case FFITypeSignedInt16: alignment = (&(((((structShort *) 0))->element))); break; - case FFITypeUnsignedInt: - case FFITypeSignedInt: + case FFITypeUnsignedInt32: alignment = (&(((((structInt *) 0))->element))); break; - case FFITypeUnsignedLongLong: - case FFITypeSignedLongLong: + case FFITypeSignedInt32: + alignment = (&(((((structInt *) 0))->element))); + break; + + case FFITypeUnsignedInt64: + alignment = (&(((((structLongLong *) 0))->element))); + break; + + case FFITypeSignedInt64: alignment = (&(((((structLongLong *) 0))->element))); break; @@ -6923,6 +6642,244 @@ primitiveStructureElementAlignment(void) } +/* Answer the unsigned 16-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16At */ +EXPORT(sqInt) +primitiveUnsignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFFFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32At */ +EXPORT(sqInt) +primitiveUnsignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive32BitIntegerFor(((unsigned int) (unalignedLong32At(addr))))); + } +} + + +/* Store the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64At */ +EXPORT(sqInt) +primitiveUnsignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(usqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive64BitIntegerFor(((usqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 8-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8At */ +EXPORT(sqInt) +primitiveUnsignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned char) (byteAt(addr)))); + } +} + + +/* Store the unsigned 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + /* Answer with a number characterizing the register type for passing a struct of size <= 16 bytes. The bit at offset i of registerType is set to 1 if eightbyte at offset i @@ -7154,18 +7111,6 @@ registerTypeForUnionSpecsOfLengthStartingAtByteOffsetEightbyteOffset(sqInt initi } -/* Use the register type encoding stored in structReturnType - 2r110 means impossible, pass thru memory. - Anything smaller encodes the type of register used, thus means true. */ - - /* ThreadedX64SysVFFIPlugin>>#returnStructInRegisters: */ -static sqInt -returnStructInRegisters(CalloutState *calloutState) -{ - return ((calloutState->structReturnType)) < 6; -} - - /* Note: This is coded so that it can be run in Squeak. */ /* Initialization of the plugin in the simulator. The real routine is in the superclass. */ @@ -7288,6 +7233,7 @@ setInterpreter(struct VirtualMachine *anInterpreter) primitiveMethod = interpreterProxy->primitiveMethod; pushRemappableOop = interpreterProxy->pushRemappableOop; signed32BitIntegerFor = interpreterProxy->signed32BitIntegerFor; + signed32BitValueOf = interpreterProxy->signed32BitValueOf; signed64BitIntegerFor = interpreterProxy->signed64BitIntegerFor; signed64BitValueOf = interpreterProxy->signed64BitValueOf; signedMachineIntegerValueOf = interpreterProxy->signedMachineIntegerValueOf; @@ -7338,48 +7284,88 @@ void* X64SysVFFIPlugin_exports[][3] = { {(void*)_m, "ffiLogCallsTo", (void*)ffiLogCallsTo}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveCallout\000\002", (void*)primitiveCallout}, - {(void*)_m, "primitiveCalloutWithArgs\000\004", (void*)primitiveCalloutWithArgs}, - {(void*)_m, "primitiveCDataModel\000\000", (void*)primitiveCDataModel}, - {(void*)_m, "primitiveCreateManualSurface\000\000", (void*)primitiveCreateManualSurface}, - {(void*)_m, "primitiveDestroyManualSurface\000\000", (void*)primitiveDestroyManualSurface}, - {(void*)_m, "primitiveFFIAllocate\000\001", (void*)primitiveFFIAllocate}, - {(void*)_m, "primitiveFFIDoubleAt\000\001", (void*)primitiveFFIDoubleAt}, - {(void*)_m, "primitiveFFIDoubleAtPut\000\001", (void*)primitiveFFIDoubleAtPut}, - {(void*)_m, "primitiveFFIFloatAt\000\001", (void*)primitiveFFIFloatAt}, - {(void*)_m, "primitiveFFIFloatAtPut\000\001", (void*)primitiveFFIFloatAtPut}, - {(void*)_m, "primitiveFFIFree\000\001", (void*)primitiveFFIFree}, - {(void*)_m, "primitiveFFIGetLastError\000\377", (void*)primitiveFFIGetLastError}, - {(void*)_m, "primitiveFFIIntegerAt\000\001", (void*)primitiveFFIIntegerAt}, - {(void*)_m, "primitiveFFIIntegerAtPut\000\001", (void*)primitiveFFIIntegerAtPut}, - {(void*)_m, "primitiveForceLoad\000\002", (void*)primitiveForceLoad}, - {(void*)_m, "primitiveLoadSymbolFromModule\000\002", (void*)primitiveLoadSymbolFromModule}, - {(void*)_m, "primitiveLogCallsTo\000\000", (void*)primitiveLogCallsTo}, - {(void*)_m, "primitiveSetManualSurfacePointer\000\000", (void*)primitiveSetManualSurfacePointer}, - {(void*)_m, "primitiveStructureElementAlignment\000\000", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveCallout\000\377\000", (void*)primitiveCallout}, + {(void*)_m, "primitiveCalloutWithArgs\000\005\000", (void*)primitiveCalloutWithArgs}, + {(void*)_m, "primitiveCDataModel\000\000\001", (void*)primitiveCDataModel}, + {(void*)_m, "primitiveCreateManualSurface\000\000\000", (void*)primitiveCreateManualSurface}, + {(void*)_m, "primitiveDestroyManualSurface\000\000\000", (void*)primitiveDestroyManualSurface}, + {(void*)_m, "primitiveExternalAddressAsInteger\000\000\001", (void*)primitiveExternalAddressAsInteger}, + {(void*)_m, "primitiveExternalAddressFromInteger\000\377\001", (void*)primitiveExternalAddressFromInteger}, + {(void*)_m, "primitiveFFIAllocate\000\001\000", (void*)primitiveFFIAllocate}, + {(void*)_m, "primitiveFFIDoubleAt\000\001\003", (void*)primitiveFFIDoubleAt}, + {(void*)_m, "primitiveFFIDoubleAtPut\000\001\003", (void*)primitiveFFIDoubleAtPut}, + {(void*)_m, "primitiveFFIFloatAt\000\001\003", (void*)primitiveFFIFloatAt}, + {(void*)_m, "primitiveFFIFloatAtPut\000\001\003", (void*)primitiveFFIFloatAtPut}, + {(void*)_m, "primitiveFFIFree\000\001\000", (void*)primitiveFFIFree}, + {(void*)_m, "primitiveFFIGetLastError\000\377\001", (void*)primitiveFFIGetLastError}, + {(void*)_m, "primitiveFFIIntegerAt\000\001\001", (void*)primitiveFFIIntegerAt}, + {(void*)_m, "primitiveFFIIntegerAtPut\000\001\001", (void*)primitiveFFIIntegerAtPut}, + {(void*)_m, "primitiveForceLoad\000\002\000", (void*)primitiveForceLoad}, + {(void*)_m, "primitiveLoadSymbolFromModule\000\002\000", (void*)primitiveLoadSymbolFromModule}, + {(void*)_m, "primitiveLogCallsTo\000\000\000", (void*)primitiveLogCallsTo}, + {(void*)_m, "primitivePluginVersion\000\377\001", (void*)primitivePluginVersion}, + {(void*)_m, "primitiveSetManualSurfacePointer\000\000\000", (void*)primitiveSetManualSurfacePointer}, + {(void*)_m, "primitiveSignedInt16At\000\001\001", (void*)primitiveSignedInt16At}, + {(void*)_m, "primitiveSignedInt16AtPut\000\001\001", (void*)primitiveSignedInt16AtPut}, + {(void*)_m, "primitiveSignedInt32At\000\001\001", (void*)primitiveSignedInt32At}, + {(void*)_m, "primitiveSignedInt32AtPut\000\001\001", (void*)primitiveSignedInt32AtPut}, + {(void*)_m, "primitiveSignedInt64At\000\001\001", (void*)primitiveSignedInt64At}, + {(void*)_m, "primitiveSignedInt64AtPut\000\001\001", (void*)primitiveSignedInt64AtPut}, + {(void*)_m, "primitiveSignedInt8At\000\001\001", (void*)primitiveSignedInt8At}, + {(void*)_m, "primitiveSignedInt8AtPut\000\001\001", (void*)primitiveSignedInt8AtPut}, + {(void*)_m, "primitiveStructureElementAlignment\000\000\001", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveUnsignedInt16At\000\001\001", (void*)primitiveUnsignedInt16At}, + {(void*)_m, "primitiveUnsignedInt16AtPut\000\001\001", (void*)primitiveUnsignedInt16AtPut}, + {(void*)_m, "primitiveUnsignedInt32At\000\001\001", (void*)primitiveUnsignedInt32At}, + {(void*)_m, "primitiveUnsignedInt32AtPut\000\001\001", (void*)primitiveUnsignedInt32AtPut}, + {(void*)_m, "primitiveUnsignedInt64At\000\001\001", (void*)primitiveUnsignedInt64At}, + {(void*)_m, "primitiveUnsignedInt64AtPut\000\001\001", (void*)primitiveUnsignedInt64AtPut}, + {(void*)_m, "primitiveUnsignedInt8At\000\001\001", (void*)primitiveUnsignedInt8At}, + {(void*)_m, "primitiveUnsignedInt8AtPut\000\001\001", (void*)primitiveUnsignedInt8AtPut}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveCalloutAccessorDepth = 2; -EXPORT(signed char) primitiveCalloutWithArgsAccessorDepth = 4; -EXPORT(signed char) primitiveCDataModelAccessorDepth = 0; -EXPORT(signed char) primitiveCreateManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveFFIAllocateAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFreeAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveForceLoadAccessorDepth = 2; -EXPORT(signed char) primitiveLoadSymbolFromModuleAccessorDepth = 2; -EXPORT(signed char) primitiveLogCallsToAccessorDepth = 0; -EXPORT(signed char) primitiveSetManualSurfacePointerAccessorDepth = 0; -EXPORT(signed char) primitiveStructureElementAlignmentAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveCalloutWithArgsMetadata = 0x500; +EXPORT(signed short) primitiveCDataModelMetadata = 1; +EXPORT(signed short) primitiveCreateManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveDestroyManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveExternalAddressAsIntegerMetadata = 1; +EXPORT(signed short) primitiveExternalAddressFromIntegerMetadata = -255; +EXPORT(signed short) primitiveFFIAllocateMetadata = 0x100; +EXPORT(signed short) primitiveFFIDoubleAtMetadata = 259; +EXPORT(signed short) primitiveFFIDoubleAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFreeMetadata = 0x100; +EXPORT(signed short) primitiveFFIGetLastErrorMetadata = -255; +EXPORT(signed short) primitiveFFIIntegerAtMetadata = 0x101; +EXPORT(signed short) primitiveFFIIntegerAtPutMetadata = 0x101; +EXPORT(signed short) primitiveForceLoadMetadata = 0x200; +EXPORT(signed short) primitiveLoadSymbolFromModuleMetadata = 0x200; +EXPORT(signed short) primitiveLogCallsToMetadata = 0; +EXPORT(signed short) primitivePluginVersionMetadata = -255; +EXPORT(signed short) primitiveSetManualSurfacePointerMetadata = 0; +EXPORT(signed short) primitiveSignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtPutMetadata = 0x101; +EXPORT(signed short) primitiveStructureElementAlignmentMetadata = 1; +EXPORT(signed short) primitiveUnsignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtPutMetadata = 0x101; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c b/src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c index c6adacad6f..21f63b6052 100644 --- a/src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c +++ b/src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 from - ThreadedX64Win64FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + ThreadedX64Win64FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 */ -static char __buildInfo[] = "ThreadedX64Win64FFIPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "ThreadedX64Win64FFIPlugin VMMaker.oscog-eem.3041 uuid: d49739b7-03f7-49a6-817b-f6f232342ad7 " __DATE__ ; #include "config.h" @@ -158,27 +158,30 @@ static char __buildInfo[] = "ThreadedX64Win64FFIPlugin VMMaker.oscog-eem.2985 uu #define FFIStructSizeMask 0xFFFF #define FFITypeBool 1 #define FFITypeDoubleFloat 13 -#define FFITypeSignedByte 3 -#define FFITypeSignedChar 11 -#define FFITypeSignedInt 7 -#define FFITypeSignedLongLong 9 -#define FFITypeSignedShort 5 +#define FFITypeSignedChar32 11 +#define FFITypeSignedChar8 11 +#define FFITypeSignedInt16 5 +#define FFITypeSignedInt32 7 +#define FFITypeSignedInt64 9 +#define FFITypeSignedInt8 3 #define FFITypeSingleFloat 12 -#define FFITypeUnsignedByte 2 -#define FFITypeUnsignedInt 6 -#define FFITypeUnsignedLongLong 8 -#define FFITypeUnsignedShort 4 +#define FFITypeUnsignedInt16 4 +#define FFITypeUnsignedInt32 6 +#define FFITypeUnsignedInt64 8 +#define FFITypeUnsignedInt8 2 #define FFITypeVoid 0 #define MaxNumArgs 15 #define NumFloatRegArgs 4 #define NumIntRegArgs 4 -#define PluginVersionInfo " VMMaker.oscog-eem.2985" +#define PluginVersionInfo " VMMaker.oscog-eem.3041" #define PrimErrBadArgument 3 +#define PrimErrBadIndex 4 #define PrimErrBadMethod 12 #define PrimErrBadNumArgs 5 #define PrimErrBadReceiver 2 #define PrimErrFFIException 22 #define PrimErrNoCMemory 10 +#define PrimErrNoMemory 9 #define PrimErrNotFound 11 #define PrimErrObjectMayMove 14 #if !defined(SPURVM) /* Allow this to be overridden on the compiler command line */ @@ -232,46 +235,22 @@ typedef struct { char pad_to_misalgnment; struct {char c; } element; } structStr /*** Function Prototypes ***/ static sqInt alignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt *indexPtr); static sqInt atomicTypeOf(sqInt typeSpec); -static sqInt canReturnInRegistersStructOfSize(sqInt returnStructSize); static sqInt checkAlignmentOfStructSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static sqInt checkAlignmentOfUnionSpecOfLengthStartingAt(unsigned int *specs, sqInt specSize, sqInt startIndex); static void cleanupCalloutState(CalloutState *calloutState); -static sqInt encodeStructReturnTypeIn(CalloutState *calloutState); static void * ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize); static sqInt ffiArgByValuein(sqInt oop, CalloutState *calloutState); static sqInt ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *calloutState); -static sqInt ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); -static sqInt ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState); static sqInt ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt nArgs); static sqInt ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState); -static sqInt ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode); -static sqInt ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState); static sqInt ffiFail(sqInt reason); -static double ffiFloatValueOf(sqInt oop); static sqInt ffiIntegerValueOf(sqInt oop); static sqInt ffiLoadCalloutAddressFrom(sqInt oop); -static sqInt ffiLoadCalloutAddress(sqInt lit); static sqInt ffiLoadCalloutModule(sqInt module); static void ffiLogCallout(sqInt lit); EXPORT(sqInt) ffiLogCallsTo(char *fileName); static sqInt ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushPointerin(void *pointer, CalloutState *calloutState); -static sqInt ffiPushSignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState); -static sqInt ffiPushSignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState); static sqInt ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState); -static sqInt ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState); -static sqInt ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState); -static sqInt ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState); -static sqInt ffiPushVoidin(sqInt ignored, CalloutState *calloutState); static sqInt ffiReturnCStringFrom(sqInt cPointer); static sqInt ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutState); static sqInt ffiReturnStructofTypein(void *intRetPtr, sqInt ffiRetType, CalloutState *calloutState); @@ -293,6 +272,8 @@ EXPORT(void) primitiveCalloutWithArgs(void); EXPORT(sqInt) primitiveCDataModel(void); EXPORT(sqInt) primitiveCreateManualSurface(void); EXPORT(sqInt) primitiveDestroyManualSurface(void); +EXPORT(sqInt) primitiveExternalAddressAsInteger(void); +EXPORT(sqInt) primitiveExternalAddressFromInteger(void); EXPORT(sqInt) primitiveFFIAllocate(void); EXPORT(sqInt) primitiveFFIDoubleAt(void); EXPORT(sqInt) primitiveFFIDoubleAtPut(void); @@ -305,9 +286,25 @@ EXPORT(sqInt) primitiveFFIIntegerAtPut(void); EXPORT(sqInt) primitiveForceLoad(void); EXPORT(sqInt) primitiveLoadSymbolFromModule(void); EXPORT(sqInt) primitiveLogCallsTo(void); +EXPORT(sqInt) primitivePluginVersion(void); EXPORT(sqInt) primitiveSetManualSurfacePointer(void); +EXPORT(sqInt) primitiveSignedInt16At(void); +EXPORT(sqInt) primitiveSignedInt16AtPut(void); +EXPORT(sqInt) primitiveSignedInt32At(void); +EXPORT(sqInt) primitiveSignedInt32AtPut(void); +EXPORT(sqInt) primitiveSignedInt64At(void); +EXPORT(sqInt) primitiveSignedInt64AtPut(void); +EXPORT(sqInt) primitiveSignedInt8At(void); +EXPORT(sqInt) primitiveSignedInt8AtPut(void); EXPORT(sqInt) primitiveStructureElementAlignment(void); -static sqInt returnStructInRegisters(CalloutState *calloutState); +EXPORT(sqInt) primitiveUnsignedInt16At(void); +EXPORT(sqInt) primitiveUnsignedInt16AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt32At(void); +EXPORT(sqInt) primitiveUnsignedInt32AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt64At(void); +EXPORT(sqInt) primitiveUnsignedInt64AtPut(void); +EXPORT(sqInt) primitiveUnsignedInt8At(void); +EXPORT(sqInt) primitiveUnsignedInt8AtPut(void); EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); static sqInt sizeField(sqInt alienOop); static sqInt startOfData(sqInt alienOop); @@ -421,6 +418,7 @@ static sqInt (*primitiveFailForOSError)(sqLong osError); static sqInt (*primitiveMethod)(void); static sqInt (*pushRemappableOop)(sqInt oop); static sqInt (*signed32BitIntegerFor)(sqInt integerValue); +static int (*signed32BitValueOf)(sqInt oop); static sqInt (*signed64BitIntegerFor)(sqLong integerValue); static sqLong (*signed64BitValueOf)(sqInt oop); static sqIntptr_t (*signedMachineIntegerValueOf)(sqInt oop); @@ -526,6 +524,7 @@ extern sqInt primitiveFailForOSError(sqLong osError); extern sqInt primitiveMethod(void); extern sqInt pushRemappableOop(sqInt oop); extern sqInt signed32BitIntegerFor(sqInt integerValue); +extern int signed32BitValueOf(sqInt oop); extern sqInt signed64BitIntegerFor(sqLong integerValue); extern sqLong signed64BitValueOf(sqInt oop); extern sqIntptr_t signedMachineIntegerValueOf(sqInt oop); @@ -540,7 +539,7 @@ extern sqInt trueObject(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "X64Win64FFIPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "X64Win64FFIPlugin VMMaker.oscog-eem.3041 " INT_EXT; /*** Macros ***/ @@ -608,17 +607,6 @@ atomicTypeOf(sqInt typeSpec) } -/* Answer if a struct result of a given size is returned in registers or not. */ - - /* ThreadedX64Win64FFIPlugin>>#canReturnInRegistersStructOfSize: */ -static sqInt -canReturnInRegistersStructOfSize(sqInt returnStructSize) -{ - return (returnStructSize <= WordSize) - && ((returnStructSize & (returnStructSize - 1)) == 0); -} - - /* Check the alignment of a structure and return true if correctly aligned. If computed size = declared size, then the struct is assumed correctly aligned. @@ -717,18 +705,6 @@ cleanupCalloutState(CalloutState *calloutState) } -/* Set the return type to true if returning the struct via register */ - - /* ThreadedX64Win64FFIPlugin>>#encodeStructReturnTypeIn: */ -static sqInt -encodeStructReturnTypeIn(CalloutState *calloutState) -{ - (calloutState->structReturnType = (((calloutState->structReturnSize)) <= WordSize) - && ((((calloutState->structReturnSize)) & (((calloutState->structReturnSize)) - 1)) == 0)); - return 0; -} - - /* Answer a long of the address of the byteSize slot (byte, short, int, whatever) at byteOffset in rcvr. Nominally intended for use with ExternalAddress objects, this code will @@ -743,17 +719,14 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) sqInt rcvrClass; sqInt rcvrSize; - if (!(isBytes(rcvr))) { - return 0; - } if (!(byteOffset > 0)) { - return 0; + return null; } rcvrClass = fetchClassOf(rcvr); rcvrSize = byteSizeOf(rcvr); if (rcvrClass == (classExternalAddress())) { if (!(rcvrSize == BytesPerWord)) { - return 0; + return null; } /* Hack!! */ @@ -762,17 +735,16 @@ ffiAddressOfstartingAtsize(sqInt rcvr, sqInt byteOffset, sqInt byteSize) if (addr == 0) { /* or: [(interpreterProxy isInMemory: addr) or: [(interpreterProxy isPinned: rcvr) not]] */ - return 0; + return null; } } else { if (!(((byteOffset + byteSize) - 1) <= rcvrSize)) { - return 0; + return null; } addr = ((sqIntptr_t) (firstIndexableField(rcvr))); } - addr = (addr + byteOffset) - 1; - return ((void *)addr); + return ((void *)((addr + byteOffset) - 1)); } @@ -786,6 +758,8 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) double floatValue; sqInt intValue; sqInt typeSpec; + usqLong value; + sqLong value1; /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiArgHeader); @@ -797,7 +771,7 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) if (atomicType < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = oop; @@ -872,27 +846,191 @@ ffiArgByValuein(sqInt oop, CalloutState *calloutState) case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value1)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value1); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 10: - return ffiPushUnsignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 11: - return ffiPushSignedCharin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; default: error("Case not found"); @@ -988,6 +1126,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c sqInt typeSpec; sqInt typeSpec1; sqInt typeSpec2; + usqLong value; + sqLong value1; sqInt valueOop; sqInt valueOop1; @@ -1238,8 +1378,8 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { err = FFIErrorCoercionFailed; goto l3; @@ -1265,7 +1405,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) ? 0 : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* string value (char*) */ /* note: the only types allowed for passing into char* types are @@ -1305,7 +1445,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } return 0; } - atomicType1 = FFITypeUnsignedByte; + atomicType1 = FFITypeUnsignedInt8; } # if COGMTVM @@ -1320,7 +1460,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } # endif // COGMTVM if ((atomicType1 == FFITypeVoid) - || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { + || ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedInt8)) >> 1))) { /* byte* -- see comment on string above */ if (isString @@ -1459,7 +1599,7 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c if (atomicType2 < FFITypeSingleFloat) { /* integer types */ - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { /* ffi support code must coerce longlong */ intValue = valueOop; @@ -1469,20 +1609,20 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c if (((valueOop & (BytesPerWord - 1)) != 0)) { if (isIntegerObject(valueOop)) { intValue = integerValueOf(valueOop); - goto l17; + goto l19; } # if SPURVM if (isCharacterObject(valueOop)) { /* Immediate in Spur */ intValue = characterValueOf(valueOop); - goto l17; + goto l19; } if (isFloatObject(valueOop)) { /* Immediate in 64-bit Spur */ intValue = floatValueOf(valueOop); - goto l17; + goto l19; } # endif // SPURVM } @@ -1493,39 +1633,39 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c # else if (isCharacterObject(valueOop)) { intValue = characterValueOf(valueOop); - goto l17; + goto l19; } # endif if (isFloatObject(valueOop)) { intValue = floatValueOf(valueOop); - goto l17; + goto l19; } if (valueOop == (nilObject())) { intValue = 0; - goto l17; + goto l19; } if (valueOop == (falseObject())) { intValue = 0; - goto l17; + goto l19; } if (valueOop == (trueObject())) { intValue = 1; - goto l17; + goto l19; } if (isLargePositiveIntegerObject(valueOop)) { # if BytesPerWord == 8 /* Use cppIf: to get the return type of the function right. Should be sqInt on 32-bits. */ intValue = positive64BitValueOf(valueOop); - goto l17; + goto l19; # else // BytesPerWord == 8 intValue = positive32BitValueOf(valueOop); - goto l17; + goto l19; # endif } } intValue = signedMachineIntegerValueOf(valueOop); - l17: /* end ffiIntegerValueOf: */; + l19: /* end ffiIntegerValueOf: */; } if (failed()) { return FFIErrorCoercionFailed; @@ -1534,27 +1674,191 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c case 0: return FFIErrorAttemptToPassVoid; case 1: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 2: - return ffiPushUnsignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 3: - return ffiPushSignedBytein(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 4: - return ffiPushUnsignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 5: - return ffiPushSignedShortin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed short) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 6: - return ffiPushUnsignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 7: - return ffiPushSignedIntin(intValue, calloutState); + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = intValue; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), intValue); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 8: - return ffiPushUnsignedLongLongOopin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value = 0; + } + else { + if (intValue == (trueObject())) { + value = 1; + } + else { + value = positive64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushUnsignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; case 9: - return ffiPushSignedLongLongOopin(intValue, calloutState); - case 10: - return ffiPushUnsignedCharin(intValue, calloutState); - case 11: - return ffiPushSignedCharin(intValue, calloutState); + if ((intValue == (nilObject())) + || (intValue == (falseObject()))) { + value1 = 0; + } + else { + if (intValue == (trueObject())) { + value1 = 1; + } + else { + value1 = signed64BitValueOf(intValue); + if (failed()) { + return FFIErrorCoercionFailed; + } + } + } + /* begin ffiPushSignedLongLong:in: */ + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value1)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), value1); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; + case 10: + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((unsigned char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; + case 11: + if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { + ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) intValue)); + /* begin incrementIntegerRegisterIndex */ + (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); + } + else { + if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { + return FFIErrorCallFrameTooBig; + } + longAtput((calloutState->currentArg), ((signed char) intValue)); + (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); + } + return 0; default: error("Case not found"); @@ -1564,10 +1868,10 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c /* begin ffiFloatValueOf: */ if (isFloatObject(valueOop)) { floatValue = floatValueOf(valueOop); - goto l13; + goto l20; } floatValue = ((double) (ffiIntegerValueOf(valueOop)) ); - l13: /* end ffiFloatValueOf: */; + l20: /* end ffiFloatValueOf: */; if (failed()) { return FFIErrorCoercionFailed; } @@ -1611,290 +1915,6 @@ ffiArgumentSpecClassin(sqInt oop, sqInt argSpec, sqInt argClass, CalloutState *c } -/* Support for generic callout. Prepare a pointer reference to an atomic type - for callout. - Note: - for type 'void*' we allow ByteArray/String/Symbol, wordVariableSubclass, - Alien or ExternalAddress. - for other types we allow ByteArray, wordVariableSubclass, Alien or - ExternalAddress. - */ - - /* ThreadedFFIPlugin>>#ffiAtomicArgByReference:Class:in: */ -static sqInt -ffiAtomicArgByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) -{ - sqInt argIsAlien; - sqInt atomicType; - char *copy; - sqInt isString; - sqInt length; - char *pointer; - void *pointer1; - void *pointer2; - void *pointer3; - void *pointer4; - void *pointer5; - void *pointer6; - sqInt typeSpec; - - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType == FFITypeBool) { - - /* No bools on input */ - return FFIErrorCoercionFailed; - } - argIsAlien = ((isString = includesBehaviorThatOf(oopClass, classString())) - ? 0 - : includesBehaviorThatOf(oopClass, classAlien())); - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { - - /* string value (char*) */ - /* note: the only types allowed for passing into char* types are - ByteArray, String, Symbol, Alien and *no* other byte indexed objects - (e.g., CompiledMethod, LargeInteger). We only check for strings - here and fall through to the byte* check otherwise. */ - if (isString) { - - /* String/Symbol */ - /* Strings must be allocated by the ffi support code */ - /* begin ffiPushString:OfLength:in: */ - pointer = firstIndexableField(oop); - length = byteSizeOf(oop); - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - atomicType = FFITypeUnsignedByte; - } -# if COGMTVM - - /* Since all the following pass the address of the first indexable field we need to fail - the call if it is threaded and the object is young, since it may move during the call. */ - if ((((((calloutState->callFlags)) & FFICallFlagThreaded) != 0)) - && (((!argIsAlien) - || ((assert(isAlien(oop)), - (longAt(oop + BaseHeaderSize)) > 0))) - && (isYoung(oop)))) { - return -PrimErrObjectMayMove; - } -# endif // COGMTVM - if ((atomicType == FFITypeVoid) - || ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedByte)) >> 1))) { - - /* byte* -- see comment on string above */ - if (isString - || (oopClass == (classByteArray()))) { - - /* String/Symbol/ByteArray */ - /* begin ffiPushPointer:in: */ - pointer1 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer1)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer1); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer2 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer2)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer2); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer3 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer3)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer3); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (!(atomicType == FFITypeVoid)) { - return FFIErrorCoercionFailed; - } - } - if (atomicType <= FFITypeDoubleFloat) { - if ((isWords(oop)) - || (oopClass == (classByteArray()))) { - /* begin ffiPushPointer:in: */ - pointer4 = firstIndexableField(oop); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer4)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer4); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (oopClass == (classExternalAddress())) { - /* begin ffiPushPointer:in: */ - pointer5 = ((void *) (longAt(oop + BaseHeaderSize))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer5)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer5); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - if (argIsAlien) { - /* begin ffiPushPointer:in: */ - pointer6 = pointerForOop(((longAt(oop + BaseHeaderSize)) > 0 - ? (oop + BaseHeaderSize) + BytesPerOop - : longAt((oop + BaseHeaderSize) + BytesPerOop))); - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer6)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer6); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - } - return FFIErrorCoercionFailed; -} - - -/* Support for generic callout. Prepare an external pointer reference to an - atomic type for callout. - */ - - /* ThreadedFFIPlugin>>#ffiAtomicStructByReference:Class:in: */ -static sqInt -ffiAtomicStructByReferenceClassin(sqInt oop, sqInt oopClass, CalloutState *calloutState) -{ - sqInt atomicType; - sqInt err; - sqInt ptrType; - sqInt spec; - sqInt specOop; - sqInt specType; - sqInt typeSpec; - sqInt valueOop; - - - /* must be external data to pass pointers to atomic type */ - if (!(oopClass == (classExternalData()))) { - return FFIErrorCoercionFailed; - } - /* begin atomicTypeOf: */ - typeSpec = (calloutState->ffiArgHeader); - atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (atomicType != FFITypeVoid) { - /* begin ffiValidateExternalData:AtomicType: */ - ptrType = fetchPointerofObject(1, oop); - if (!((isPointers(ptrType)) - && ((slotSizeOf(ptrType)) >= 2))) { - err = FFIErrorWrongType; - goto l3; - } - specOop = fetchPointerofObject(0, ptrType); - if (!((isWords(specOop)) - && ((slotSizeOf(specOop)) > 0))) { - err = FFIErrorWrongType; - goto l3; - } - spec = fetchPointerofObject(0, specOop); - if (!(((spec & FFIFlagAtomic) != 0))) { - err = FFIErrorWrongType; - goto l3; - } - /* begin atomicTypeOf: */ - specType = ((usqInt)((spec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if (specType != atomicType) { - - /* Allow for signed/unsigned conversion but nothing else. - See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) - && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { - err = FFIErrorCoercionFailed; - goto l3; - } - } - err = 0; - l3: /* end ffiValidateExternalData:AtomicType: */; - if (err != 0) { - return err; - } - } - valueOop = fetchPointerofObject(0, oop); - return ffiPushPointerContentsOfin(valueOop, calloutState); -} - - /* Generic callout. Does the actual work. If argArrayOrNil is nil it takes args from the stack and the spec from the method. If argArrayOrNil is not nil takes args from @@ -2181,7 +2201,7 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -2290,18 +2310,18 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : trueObject()); goto l7; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -2323,19 +2343,14 @@ ffiCallArgArrayOrNilNumArgs(sqInt externalFunction, sqInt argArrayOrNil, sqInt n : positive32BitIntegerFor(intRet))); goto l7; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l7; } -# if SPURVM - result = characterObjectOf(intRet & 0x3FFFFFFF); - goto l7; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result = characterObjectOf(intRet & 0xFF); - goto l7; -# endif l7: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -2378,87 +2393,6 @@ ffiCheckReturnWithin(sqInt retSpec, sqInt retClass, CalloutState *calloutState) } -/* Make sure that the given oop is a valid external handle */ - - /* ThreadedFFIPlugin>>#ffiContentsOfHandle:errCode: */ -static sqInt -ffiContentsOfHandleerrCode(sqInt oop, sqInt errCode) -{ - if (!((isBytes(oop)) - && ((byteSizeOf(oop)) == (sizeof(sqInt))))) { - return ffiFail(errCode); - } - return fetchPointerofObject(0, oop); -} - - -/* Callout support. Return the appropriate oop for the given atomic type */ - - /* ThreadedFFIPlugin>>#ffiCreateIntegralResultOop:ofAtomicType:in: */ -static sqInt -ffiCreateIntegralResultOopofAtomicTypein(usqLong retVal, sqInt atomicType, CalloutState *calloutState) -{ - sqInt byteSize; - usqLong mask; - sqInt shift; - usqLong value; - - assert(atomicType < FFITypeSingleFloat); - if (atomicType == FFITypeBool) { - - /* Make sure bool honors the byte size requested */ - byteSize = ((calloutState->ffiRetHeader)) & FFIStructSizeMask; - value = (byteSize == (sizeof(retVal)) - ? retVal - : retVal & (((((unsigned long long)1)) << (byteSize * 8)) - 1)); - return (value == 0 - ? falseObject() - : trueObject()); - } - if (atomicType <= FFITypeSignedInt) { - - /* these are all generall integer returns */ - if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { - - /* byte/short. first extract partial word, then sign extend */ - - /* # of significant bits */ - shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) - ? 32 - : (((usqInt)(atomicType)) >> 1) * 8); - value = retVal & (((((unsigned long long)1)) << shift) - 1); - if (((atomicType & 1) != 0)) { - - /* make the guy signed */ - mask = (((unsigned long long)1)) << (shift - 1); - value = (value & (mask - 1)) - (value & mask); - } - return integerObjectOf(value); - } - return (((atomicType & 1) != 0) - ? (BytesPerWord == 8 - ? signed64BitIntegerFor(retVal) - : signed32BitIntegerFor(retVal)) - : (BytesPerWord == 8 - ? positive64BitIntegerFor(retVal) - : positive32BitIntegerFor(retVal))); - } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { - return (((atomicType & 1) != 0) - ? signed64BitIntegerFor(retVal) - : positive64BitIntegerFor(retVal)); - } -# if SPURVM - return characterObjectOf(retVal & 0x3FFFFFFF); -# else - return characterObjectOf(retVal & 0xFF); -# endif -} - - /* Map the FFI error code into a primitive error code. If reason is negative it encodes one of the standard PrimErr... codes, negated to distinguish it from the FFIError @@ -2482,21 +2416,6 @@ ffiFail(sqInt reason) } -/* Support for generic callout. Return a float value that is coerced as C - would do. - */ - - /* ThreadedFFIPlugin>>#ffiFloatValueOf: */ -static double -ffiFloatValueOf(sqInt oop) -{ - if (isFloatObject(oop)) { - return floatValueOf(oop); - } - return ((double) (ffiIntegerValueOf(oop)) ); -} - - /* Support for generic callout. Answer an integer value that is coerced as C would do. */ @@ -2589,52 +2508,6 @@ ffiLoadCalloutAddressFrom(sqInt oop) } -/* Load the address of the foreign function from the given object */ - - /* ThreadedFFIPlugin>>#ffiLoadCalloutAddress: */ -static sqInt -ffiLoadCalloutAddress(sqInt lit) -{ - sqInt address; - sqInt addressPtr; - sqIntptr_t *ptr; - - - /* Lookup the address */ - - /* Make sure it's an external handle */ - addressPtr = fetchPointerofObject(0, lit); - /* begin ffiContentsOfHandle:errCode: */ - if (!((isBytes(addressPtr)) - && ((byteSizeOf(addressPtr)) == (sizeof(sqInt))))) { - address = ffiFail(FFIErrorBadAddress); - goto l1; - } - address = fetchPointerofObject(0, addressPtr); - l1: /* end ffiContentsOfHandle:errCode: */; - if (failed()) { - return 0; - } - if (address == 0) { - - /* Go look it up in the module */ - if (externalFunctionInstSize > ExternalFunctionStackSizeIndex) { - storeIntegerofObjectwithValue(ExternalFunctionStackSizeIndex, lit, -1); - } - if ((slotSizeOf(lit)) < 5) { - return ffiFail(FFIErrorNoModule); - } - address = ffiLoadCalloutAddressFrom(lit); - if (failed()) { - return 0; - } - ptr = firstIndexableField(addressPtr); - ptr[0] = address; - } - return address; -} - - /* Load the given module and return its handle */ /* ThreadedFFIPlugin>>#ffiLoadCalloutModule: */ @@ -2833,194 +2706,6 @@ ffiPushPointerContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedX64FFIPlugin>>#ffiPushPointer:in: */ -static sqInt -ffiPushPointerin(void *pointer, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedByte:in: */ -static sqInt -ffiPushSignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedChar:in: */ -static sqInt -ffiPushSignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedInt:in: */ -static sqInt -ffiPushSignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - -/* Push a longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushSignedLongLongOop:in: */ -static sqInt -ffiPushSignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - sqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = signed64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushSignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedLongLong:in: */ -static sqInt -ffiPushSignedLongLongin(sqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((usqInt) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushSignedShort:in: */ -static sqInt -ffiPushSignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((signed short) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((signed short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedFFIPlugin>>#ffiPushString:OfLength:in: */ -static sqInt -ffiPushStringOfLengthin(char *pointer, sqInt length, CalloutState *calloutState) -{ - char *copy; - - if (((calloutState->stringArgIndex)) >= MaxNumArgs) { - return -PrimErrBadNumArgs; - } - copy = malloc(length + 1); - if (copy == null) { - return -PrimErrNoCMemory; - } - memcpy(copy, pointer, length); - copy[length] = 0; - ((calloutState->stringArgs))[(calloutState->stringArgIndex)] = copy; - (calloutState->stringArgIndex = ((calloutState->stringArgIndex)) + 1); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)copy)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), copy); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - /* Push the contents of the given external structure */ @@ -3172,199 +2857,6 @@ ffiPushStructureContentsOfin(sqInt oop, CalloutState *calloutState) return FFIErrorBadArg; } - /* ThreadedX64Win64FFIPlugin>>#ffiPushStructure:ofSize:typeSpec:ofLength:in: */ -static sqInt -ffiPushStructureofSizetypeSpecofLengthin(void *pointer, sqInt structSize, sqInt *argSpec, sqInt argSpecSize, CalloutState *calloutState) -{ - usqLong arg; - - arg = 0; - if (structSize <= 0) { - return FFIErrorStructSize; - } - if ((structSize <= WordSize) - && ((structSize & (structSize - 1)) == 0)) { - memcpy((&arg), pointer, structSize); - /* begin ffiPushUnsignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = arg; - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), arg); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; - } - flag("bug"); - /* begin ffiPushPointer:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((sqInt)pointer)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), pointer); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedByte:in: */ -static sqInt -ffiPushUnsignedBytein(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedChar:in: */ -static sqInt -ffiPushUnsignedCharin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned char) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned char) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedInt:in: */ -static sqInt -ffiPushUnsignedIntin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - -/* Push an unsigned longlong type (e.g., a 64bit integer). - Note: Coercions from float are *not* supported. */ - - /* ThreadedFFIPlugin>>#ffiPushUnsignedLongLongOop:in: */ -static sqInt -ffiPushUnsignedLongLongOopin(sqInt oop, CalloutState *calloutState) -{ - usqLong value; - - if ((oop == (nilObject())) - || (oop == (falseObject()))) { - value = 0; - } - else { - if (oop == (trueObject())) { - value = 1; - } - else { - value = positive64BitValueOf(oop); - if (failed()) { - return FFIErrorCoercionFailed; - } - } - } - /* begin ffiPushUnsignedLongLong:in: */ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedLongLong:in: */ -static sqInt -ffiPushUnsignedLongLongin(usqLong value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = value; - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), value); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - /* ThreadedX64FFIPlugin>>#ffiPushUnsignedShort:in: */ -static sqInt -ffiPushUnsignedShortin(sqInt value, CalloutState *calloutState) -{ - if (((calloutState->integerRegisterIndex)) < NumIntRegArgs) { - ((calloutState->integerRegisters))[(calloutState->integerRegisterIndex)] = (((unsigned short) value)); - /* begin incrementIntegerRegisterIndex */ - (calloutState->floatRegisterIndex) = ((calloutState->integerRegisterIndex) = ((calloutState->integerRegisterIndex)) + 1); - } - else { - if ((((calloutState->currentArg)) + WordSize) > ((calloutState->limit))) { - return FFIErrorCallFrameTooBig; - } - longAtput((calloutState->currentArg), ((unsigned short) value)); - (calloutState->currentArg = ((calloutState->currentArg)) + WordSize); - } - return 0; -} - - -/* This is a fallback in case somebody tries to pass a 'void' value. - We could simply ignore the argument but I think it's better to let - the caller know what he did */ - - /* ThreadedFFIPlugin>>#ffiPushVoid:in: */ -static sqInt -ffiPushVoidin(sqInt ignored, CalloutState *calloutState) -{ - return FFIErrorAttemptToPassVoid; -} - /* Create a Smalltalk string from a zero terminated C string */ @@ -3423,7 +2915,7 @@ ffiReturnPointerofTypein(usqLong retVal, sqInt retType, CalloutState *calloutSta /* begin atomicTypeOf: */ typeSpec = (calloutState->ffiRetHeader); atomicType = ((usqInt)((typeSpec & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -3585,8 +3077,8 @@ ffiValidateExternalDataAtomicType(sqInt oop, sqInt atomicType) /* Allow for signed/unsigned conversion but nothing else. See FFIConstants class>>#initializeTypeConstants */ - if (!((atomicType >= FFITypeUnsignedByte) - && ((atomicType <= FFITypeSignedChar) + if (!((atomicType >= FFITypeUnsignedInt8) + && ((atomicType <= FFITypeSignedChar32) && ((((usqInt)(atomicType)) >> 1) == (((usqInt)(specType)) >> 1))))) { return FFIErrorCoercionFailed; } @@ -4120,7 +3612,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4229,18 +3721,18 @@ primitiveCallout(void) : trueObject()); goto l7; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -4262,19 +3754,14 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet))); goto l7; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l7; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l7; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); - goto l7; -# endif l7: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -4522,7 +4009,7 @@ primitiveCallout(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -4631,18 +4118,18 @@ primitiveCallout(void) : trueObject()); goto l14; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -4664,19 +4151,14 @@ primitiveCallout(void) : positive32BitIntegerFor(intRet1))); goto l14; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l14; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l14; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); - goto l14; -# endif l14: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState1->stringArgIndex)) > 0) { @@ -5057,7 +4539,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec1 = (calloutState->ffiRetHeader); atomicType1 = ((usqInt)((typeSpec1 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType1)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -5166,18 +4648,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l7; } - if (atomicType <= FFITypeSignedInt) { + if (atomicType <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift = ((BytesPerWord == 8) - && (atomicType >= FFITypeUnsignedInt) + && (atomicType >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType)) >> 1) * 8); value = intRet & (((((unsigned long long)1)) << shift) - 1); @@ -5199,19 +4681,14 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet))); goto l7; } - if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result1 = (((atomicType & 1) != 0) ? signed64BitIntegerFor(intRet) : positive64BitIntegerFor(intRet)); goto l7; } -# if SPURVM - result1 = characterObjectOf(intRet & 0x3FFFFFFF); - goto l7; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result1 = characterObjectOf(intRet & 0xFF); - goto l7; -# endif l7: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState->stringArgIndex)) > 0) { @@ -5465,7 +4942,7 @@ primitiveCalloutWithArgs(void) /* begin atomicTypeOf: */ typeSpec11 = (calloutState1->ffiRetHeader); atomicType11 = ((usqInt)((typeSpec11 & FFIAtomicTypeMask))) >> FFIAtomicTypeShift; - if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar)) >> 1)) { + if ((((usqInt)(atomicType11)) >> 1) == (((usqInt)(FFITypeSignedChar8)) >> 1)) { /* String return */ /* begin ffiReturnCStringFrom: */ @@ -5574,18 +5051,18 @@ primitiveCalloutWithArgs(void) : trueObject()); goto l14; } - if (atomicType2 <= FFITypeSignedInt) { + if (atomicType2 <= FFITypeSignedInt32) { /* these are all generall integer returns */ if (atomicType2 <= ((BytesPerWord == 8 - ? FFITypeSignedInt - : FFITypeSignedShort))) { + ? FFITypeSignedInt32 + : FFITypeSignedInt16))) { /* byte/short. first extract partial word, then sign extend */ /* # of significant bits */ shift1 = ((BytesPerWord == 8) - && (atomicType2 >= FFITypeUnsignedInt) + && (atomicType2 >= FFITypeUnsignedInt32) ? 32 : (((usqInt)(atomicType2)) >> 1) * 8); value1 = intRet1 & (((((unsigned long long)1)) << shift1) - 1); @@ -5607,19 +5084,14 @@ primitiveCalloutWithArgs(void) : positive32BitIntegerFor(intRet1))); goto l14; } - if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedLongLong)) >> 1)) { + if ((((usqInt)(atomicType2)) >> 1) == (((usqInt)(FFITypeSignedInt64)) >> 1)) { result2 = (((atomicType2 & 1) != 0) ? signed64BitIntegerFor(intRet1) : positive64BitIntegerFor(intRet1)); goto l14; } -# if SPURVM - result2 = characterObjectOf(intRet1 & 0x3FFFFFFF); - goto l14; -# else + flag("we need a solution for wide characters; spur supports upto 30 bit characters"); result2 = characterObjectOf(intRet1 & 0xFF); - goto l14; -# endif l14: /* end ffiCalloutTo:SpecOnStack:in: */; /* begin cleanupCalloutState: */ while (((calloutState1->stringArgIndex)) > 0) { @@ -5816,22 +5288,68 @@ primitiveDestroyManualSurface(void) } -/* Primitive. Allocate an object on the external heap. */ +/* Answer the address of a 4 byte or 8 byte ExternalAddress. */ - /* ThreadedFFIPlugin>>#primitiveFFIAllocate */ + /* ThreadedFFIPlugin>>#primitiveExternalAddressAsInteger */ EXPORT(sqInt) -primitiveFFIAllocate(void) +primitiveExternalAddressAsInteger(void) { - sqInt addr; - sqInt byteSize; - sqInt oop; - sqIntptr_t *ptr; + sqInt rcvr; + sqInt size; - byteSize = stackIntegerValue(0); - if (failed()) { - return null; + rcvr = stackValue(0); + size = byteSizeOf(rcvr); + if (size == 8) { + return methodReturnValue(positive64BitIntegerFor((*((usqLong *) (firstIndexableField(rcvr)))))); } - addr = ffiAlloc(byteSize); + if (size == 4) { + return methodReturnValue(positive32BitIntegerFor((*((unsigned int *) (firstIndexableField(rcvr)))))); + } + primitiveFailFor(PrimErrBadReceiver); + return 0; +} + + +/* Answer a 4 byte or 8 byte ExternalAddress with value of the argument. */ + + /* ThreadedFFIPlugin>>#primitiveExternalAddressFromInteger */ +EXPORT(sqInt) +primitiveExternalAddressFromInteger(void) +{ + sqInt address; + usqIntptr_t value; + + value = positiveMachineIntegerValueOf(stackValue(0)); + if (failed()) { + return primitiveFailFor(PrimErrBadArgument); + } + address = instantiateClassindexableSize(classExternalAddress(), BytesPerWord); + if (address == null) { + return primitiveFailFor(PrimErrNoMemory); + } + else { + (*((usqIntptr_t *) (firstIndexableField(address))) = value); + return methodReturnValue(address); + } +} + + +/* Primitive. Allocate an object on the external heap. */ + + /* ThreadedFFIPlugin>>#primitiveFFIAllocate */ +EXPORT(sqInt) +primitiveFFIAllocate(void) +{ + sqInt addr; + sqInt byteSize; + sqInt oop; + sqIntptr_t *ptr; + + byteSize = stackIntegerValue(0); + if (failed()) { + return null; + } + addr = ffiAlloc(byteSize); if (addr == 0) { return primitiveFail(); } @@ -5842,7 +5360,7 @@ primitiveFFIAllocate(void) } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAt */ EXPORT(sqInt) @@ -5853,22 +5371,23 @@ primitiveFFIDoubleAt(void) double floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(double)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 64-bit IEEE double the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIDoubleAtPut */ EXPORT(sqInt) @@ -5876,32 +5395,39 @@ primitiveFFIDoubleAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; double floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((double) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((double) (floatValueOf(valueOop))); } else { - floatValue = ((double) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((double) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 8); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(double)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(double)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Answer a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAt */ EXPORT(sqInt) @@ -5912,22 +5438,23 @@ primitiveFFIFloatAt(void) float floatValue; sqInt rcvr; - byteOffset = stackIntegerValue(0); - rcvr = stackObjectValue(1); - if (failed()) { - return 0; + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy((&floatValue), addr, sizeof(float)); + return methodReturnFloat(floatValue); } - memcpy((&floatValue), addr, sizeof(floatValue)); - methodReturnFloat(floatValue); - return 0; } -/* Return a (signed or unsigned) n byte integer from the given byte offset. */ +/* Store a 32-bit IEEE float the given byte offset. */ /* ThreadedFFIPlugin>>#primitiveFFIFloatAtPut */ EXPORT(sqInt) @@ -5935,28 +5462,35 @@ primitiveFFIFloatAtPut(void) { void * addr; sqInt byteOffset; - sqInt floatOop; float floatValue; sqInt rcvr; + sqInt valueOop; - floatOop = stackValue(0); - if (isIntegerObject(floatOop)) { - floatValue = ((float) (integerValueOf(floatOop))); + valueOop = stackValue(0); + if (isFloatObject(valueOop)) { + floatValue = ((float) (floatValueOf(valueOop))); } else { - floatValue = ((float) (floatValueOf(floatOop))); + if (isIntegerObject(valueOop)) { + floatValue = ((float) (integerValueOf(valueOop))); + } + else { + return primitiveFailFor(PrimErrBadArgument); + } } - byteOffset = stackIntegerValue(1); - rcvr = stackObjectValue(2); - if (failed()) { - return 0; + byteOffset = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); } - addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, 4); - if (addr == 0) { - return primitiveFail(); + rcvr = stackValue(2); + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(float)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + memcpy(addr, (&floatValue), sizeof(floatValue)); + return methodReturnValue(valueOop); } - memcpy(addr, (&floatValue), sizeof(floatValue)); - return popthenPush(3, floatOop); } @@ -6033,51 +5567,53 @@ primitiveFFIIntegerAt(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (byteSize <= 2) { - if (byteSize == 1) { - value = ((unsigned char) (byteAt(addr))); - } - else { - value = ((unsigned short) (unalignedShortAt(addr))); - } + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - if (byteSize == 4) { - value = ((unsigned int) (unalignedLong32At(addr))); + if (byteSize <= 2) { + if (byteSize == 1) { + value = ((unsigned char) (byteAt(addr))); + } + else { + value = ((unsigned short) (unalignedShortAt(addr))); + } } else { - value = unalignedLong64At(addr); - } - } - if (byteSize < BytesPerWord) { - if (isSigned) { - - /* sign extend value */ - mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); - value = (value & (mask - 1)) - (value & mask); + if (byteSize == 4) { + value = ((unsigned int) (unalignedLong32At(addr))); + } + else { + value = unalignedLong64At(addr); + } } - valueOop = integerObjectOf(value); - } - else { - - /* general 64 bit integer; note these never fail */ - if (isSigned) { - if (byteSize < 8) { + if (byteSize < BytesPerWord) { + if (isSigned) { /* sign extend value */ mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); value = (value & (mask - 1)) - (value & mask); } - valueOop = signed64BitIntegerFor(value); + valueOop = integerObjectOf(value); } else { - valueOop = positive64BitIntegerFor(value); + + /* general 64 bit integer; note these never fail */ + if (isSigned) { + if (byteSize < 8) { + + /* sign extend value */ + mask = (((unsigned long long)1)) << ((byteSize * 8) - 1); + value = (value & (mask - 1)) - (value & mask); + } + valueOop = signed64BitIntegerFor(value); + } + else { + valueOop = positive64BitIntegerFor(value); + } } + return methodReturnValue(valueOop); } - return popthenPush(4, valueOop); } @@ -6111,49 +5647,51 @@ primitiveFFIIntegerAtPut(void) return primitiveFail(); } addr = ffiAddressOfstartingAtsize(rcvr, byteOffset, byteSize); - if (addr == 0) { - return primitiveFail(); - } - if (isSigned) { - value = signed64BitValueOf(valueOop); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); } else { - value = positive64BitValueOf(valueOop); - } - if (failed()) { - return 0; - } - if (byteSize < 8) { if (isSigned) { - max = (((unsigned long long)1)) << ((8 * byteSize) - 1); - if (!((value >= (0 - max)) - && (value < max))) { - return primitiveFail(); - } + value = signed64BitValueOf(valueOop); } else { - if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { - return primitiveFail(); - } + value = positive64BitValueOf(valueOop); } - } - if (byteSize <= 2) { - if (byteSize == 1) { - byteAtput(addr, value); + if (failed()) { + return 0; } - else { - unalignedShortAtput(addr, value); + if (byteSize < 8) { + if (isSigned) { + max = (((unsigned long long)1)) << ((8 * byteSize) - 1); + if (!((value >= (0 - max)) + && (value < max))) { + return primitiveFail(); + } + } + else { + if (!((((unsigned long long)value)) < ((((unsigned long long)1)) << (8 * byteSize)))) { + return primitiveFail(); + } + } } - } - else { - if (byteSize == 4) { - unalignedLong32Atput(addr, value); + if (byteSize <= 2) { + if (byteSize == 1) { + byteAtput(addr, value); + } + else { + unalignedShortAtput(addr, value); + } } else { - unalignedLong64Atput(addr, value); + if (byteSize == 4) { + unalignedLong32Atput(addr, value); + } + else { + unalignedLong64Atput(addr, value); + } } + return methodReturnValue(valueOop); } - return popthenPush(5, valueOop); } @@ -6279,6 +5817,19 @@ primitiveLogCallsTo(void) } +/* Answer the plugins current version to ensure compatibility with data + structures shared between plugin an image code such as: + - Type codes in FFIConstants + - Known classes in the special-objects array */ + + /* ThreadedFFIPlugin>>#primitivePluginVersion */ +EXPORT(sqInt) +primitivePluginVersion(void) +{ + return methodReturnInteger(1); +} + + /* Create a 'manual surface' data-structure. See the ExternalForm class in the FFI package for example usage. */ /* arguments: name(type, stack offset) @@ -6309,6 +5860,244 @@ primitiveSetManualSurfacePointer(void) } +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16At */ +EXPORT(sqInt) +primitiveSignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt16AtPut */ +EXPORT(sqInt) +primitiveSignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -32768) && (value <= 0x7FFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32At */ +EXPORT(sqInt) +primitiveSignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed32BitIntegerFor(((signed int) (unalignedLong32At(addr))))); + } +} + + +/* Store the signed 32-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt32AtPut */ +EXPORT(sqInt) +primitiveSignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + int value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64At */ +EXPORT(sqInt) +primitiveSignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(signed64BitIntegerFor(((sqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the signed 64-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt64AtPut */ +EXPORT(sqInt) +primitiveSignedInt64AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = signed64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the signed 8-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8At */ +EXPORT(sqInt) +primitiveSignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((signed char) (byteAt(addr)))); + } +} + + +/* Store the signed 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveSignedInt8AtPut */ +EXPORT(sqInt) +primitiveSignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= -128) && (value <= 0x7F))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + /* Answer the alignment of an element of an atomic type, or a structure, within a structure on the current platform. */ @@ -6322,28 +6111,40 @@ primitiveStructureElementAlignment(void) typeCode = stackValue(0); if (!((isIntegerObject(typeCode)) - && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedByte) && (typeCode <= FFITypeDoubleFloat))) + && ((((((typeCode = integerValueOf(typeCode))) >= FFITypeUnsignedInt8) && (typeCode <= FFITypeDoubleFloat))) || (typeCode == FFIFlagStructure)))) { return primitiveFailFor(PrimErrBadArgument); } switch (typeCode) { - case FFITypeUnsignedByte: - case FFITypeSignedByte: + case FFITypeUnsignedInt8: alignment = (&(((((structByte *) 0))->element))); break; - case FFITypeUnsignedShort: - case FFITypeSignedShort: + case FFITypeSignedInt8: + alignment = (&(((((structByte *) 0))->element))); + break; + + case FFITypeUnsignedInt16: + alignment = (&(((((structShort *) 0))->element))); + break; + + case FFITypeSignedInt16: alignment = (&(((((structShort *) 0))->element))); break; - case FFITypeUnsignedInt: - case FFITypeSignedInt: + case FFITypeUnsignedInt32: alignment = (&(((((structInt *) 0))->element))); break; - case FFITypeUnsignedLongLong: - case FFITypeSignedLongLong: + case FFITypeSignedInt32: + alignment = (&(((((structInt *) 0))->element))); + break; + + case FFITypeUnsignedInt64: + alignment = (&(((((structLongLong *) 0))->element))); + break; + + case FFITypeSignedInt64: alignment = (&(((((structLongLong *) 0))->element))); break; @@ -6362,13 +6163,241 @@ primitiveStructureElementAlignment(void) } -/* Return thrue register if structReturnType is true */ +/* Answer the unsigned 16-bit integer starting at the given byte offset + (native endian). + */ - /* ThreadedX64Win64FFIPlugin>>#returnStructInRegisters: */ -static sqInt -returnStructInRegisters(CalloutState *calloutState) + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16At */ +EXPORT(sqInt) +primitiveUnsignedInt16At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned short) (unalignedShortAt(addr)))); + } +} + + +/* Store the signed 16-bit integer starting at the given byte offset (native + endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt16AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt16AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFFFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(short)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedShortAtput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32At */ +EXPORT(sqInt) +primitiveUnsignedInt32At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive32BitIntegerFor(((unsigned int) (unalignedLong32At(addr))))); + } +} + + +/* Store the unsigned 32-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt32AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt32AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive32BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(int)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong32Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64At */ +EXPORT(sqInt) +primitiveUnsignedInt64At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(usqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnValue(positive64BitIntegerFor(((usqLong) (unalignedLong64At(addr))))); + } +} + + +/* Store the unsigned 64-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt64AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt64AtPut(void) { - return (calloutState->structReturnType); + void * addr; + sqInt byteOffset; + sqInt rcvr; + usqLong value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + value = positive64BitValueOf(valueArg); + if (!((!(failed())) + && (isIntegerObject(byteOffset)))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(sqLong)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + unalignedLong64Atput(addr, value); + return methodReturnValue(valueArg); + } +} + + +/* Answer the unsigned 8-bit integer starting at the given byte offset + (native endian). + */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8At */ +EXPORT(sqInt) +primitiveUnsignedInt8At(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + + byteOffset = stackValue(0); + rcvr = stackValue(1); + if (!(isIntegerObject(byteOffset))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + return methodReturnInteger(((unsigned char) (byteAt(addr)))); + } +} + + +/* Store the unsigned 8-bit integer starting at the given byte offset. */ + + /* ThreadedFFIPlugin>>#primitiveUnsignedInt8AtPut */ +EXPORT(sqInt) +primitiveUnsignedInt8AtPut(void) +{ + void * addr; + sqInt byteOffset; + sqInt rcvr; + sqInt value; + sqInt valueArg; + + valueArg = stackValue(0); + byteOffset = stackValue(1); + rcvr = stackValue(2); + if (!((isIntegerObject(valueArg)) + && ((((((value = integerValueOf(valueArg))) >= 0) && (value <= 0xFF))) + && (isIntegerObject(byteOffset))))) { + return primitiveFailFor(PrimErrBadArgument); + } + addr = ffiAddressOfstartingAtsize(rcvr, integerValueOf(byteOffset), sizeof(char)); + if (addr == null) { + return primitiveFailFor(PrimErrBadIndex); + } + else { + byteAtput(addr, value); + return methodReturnValue(valueArg); + } } @@ -6494,6 +6523,7 @@ setInterpreter(struct VirtualMachine *anInterpreter) primitiveMethod = interpreterProxy->primitiveMethod; pushRemappableOop = interpreterProxy->pushRemappableOop; signed32BitIntegerFor = interpreterProxy->signed32BitIntegerFor; + signed32BitValueOf = interpreterProxy->signed32BitValueOf; signed64BitIntegerFor = interpreterProxy->signed64BitIntegerFor; signed64BitValueOf = interpreterProxy->signed64BitValueOf; signedMachineIntegerValueOf = interpreterProxy->signedMachineIntegerValueOf; @@ -6544,48 +6574,88 @@ void* X64Win64FFIPlugin_exports[][3] = { {(void*)_m, "ffiLogCallsTo", (void*)ffiLogCallsTo}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveCallout\000\002", (void*)primitiveCallout}, - {(void*)_m, "primitiveCalloutWithArgs\000\004", (void*)primitiveCalloutWithArgs}, - {(void*)_m, "primitiveCDataModel\000\000", (void*)primitiveCDataModel}, - {(void*)_m, "primitiveCreateManualSurface\000\000", (void*)primitiveCreateManualSurface}, - {(void*)_m, "primitiveDestroyManualSurface\000\000", (void*)primitiveDestroyManualSurface}, - {(void*)_m, "primitiveFFIAllocate\000\001", (void*)primitiveFFIAllocate}, - {(void*)_m, "primitiveFFIDoubleAt\000\001", (void*)primitiveFFIDoubleAt}, - {(void*)_m, "primitiveFFIDoubleAtPut\000\001", (void*)primitiveFFIDoubleAtPut}, - {(void*)_m, "primitiveFFIFloatAt\000\001", (void*)primitiveFFIFloatAt}, - {(void*)_m, "primitiveFFIFloatAtPut\000\001", (void*)primitiveFFIFloatAtPut}, - {(void*)_m, "primitiveFFIFree\000\001", (void*)primitiveFFIFree}, - {(void*)_m, "primitiveFFIGetLastError\000\377", (void*)primitiveFFIGetLastError}, - {(void*)_m, "primitiveFFIIntegerAt\000\001", (void*)primitiveFFIIntegerAt}, - {(void*)_m, "primitiveFFIIntegerAtPut\000\001", (void*)primitiveFFIIntegerAtPut}, - {(void*)_m, "primitiveForceLoad\000\002", (void*)primitiveForceLoad}, - {(void*)_m, "primitiveLoadSymbolFromModule\000\002", (void*)primitiveLoadSymbolFromModule}, - {(void*)_m, "primitiveLogCallsTo\000\000", (void*)primitiveLogCallsTo}, - {(void*)_m, "primitiveSetManualSurfacePointer\000\000", (void*)primitiveSetManualSurfacePointer}, - {(void*)_m, "primitiveStructureElementAlignment\000\000", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveCallout\000\377\000", (void*)primitiveCallout}, + {(void*)_m, "primitiveCalloutWithArgs\000\005\000", (void*)primitiveCalloutWithArgs}, + {(void*)_m, "primitiveCDataModel\000\000\001", (void*)primitiveCDataModel}, + {(void*)_m, "primitiveCreateManualSurface\000\000\000", (void*)primitiveCreateManualSurface}, + {(void*)_m, "primitiveDestroyManualSurface\000\000\000", (void*)primitiveDestroyManualSurface}, + {(void*)_m, "primitiveExternalAddressAsInteger\000\000\001", (void*)primitiveExternalAddressAsInteger}, + {(void*)_m, "primitiveExternalAddressFromInteger\000\377\001", (void*)primitiveExternalAddressFromInteger}, + {(void*)_m, "primitiveFFIAllocate\000\001\000", (void*)primitiveFFIAllocate}, + {(void*)_m, "primitiveFFIDoubleAt\000\001\003", (void*)primitiveFFIDoubleAt}, + {(void*)_m, "primitiveFFIDoubleAtPut\000\001\003", (void*)primitiveFFIDoubleAtPut}, + {(void*)_m, "primitiveFFIFloatAt\000\001\003", (void*)primitiveFFIFloatAt}, + {(void*)_m, "primitiveFFIFloatAtPut\000\001\003", (void*)primitiveFFIFloatAtPut}, + {(void*)_m, "primitiveFFIFree\000\001\000", (void*)primitiveFFIFree}, + {(void*)_m, "primitiveFFIGetLastError\000\377\001", (void*)primitiveFFIGetLastError}, + {(void*)_m, "primitiveFFIIntegerAt\000\001\001", (void*)primitiveFFIIntegerAt}, + {(void*)_m, "primitiveFFIIntegerAtPut\000\001\001", (void*)primitiveFFIIntegerAtPut}, + {(void*)_m, "primitiveForceLoad\000\002\000", (void*)primitiveForceLoad}, + {(void*)_m, "primitiveLoadSymbolFromModule\000\002\000", (void*)primitiveLoadSymbolFromModule}, + {(void*)_m, "primitiveLogCallsTo\000\000\000", (void*)primitiveLogCallsTo}, + {(void*)_m, "primitivePluginVersion\000\377\001", (void*)primitivePluginVersion}, + {(void*)_m, "primitiveSetManualSurfacePointer\000\000\000", (void*)primitiveSetManualSurfacePointer}, + {(void*)_m, "primitiveSignedInt16At\000\001\001", (void*)primitiveSignedInt16At}, + {(void*)_m, "primitiveSignedInt16AtPut\000\001\001", (void*)primitiveSignedInt16AtPut}, + {(void*)_m, "primitiveSignedInt32At\000\001\001", (void*)primitiveSignedInt32At}, + {(void*)_m, "primitiveSignedInt32AtPut\000\001\001", (void*)primitiveSignedInt32AtPut}, + {(void*)_m, "primitiveSignedInt64At\000\001\001", (void*)primitiveSignedInt64At}, + {(void*)_m, "primitiveSignedInt64AtPut\000\001\001", (void*)primitiveSignedInt64AtPut}, + {(void*)_m, "primitiveSignedInt8At\000\001\001", (void*)primitiveSignedInt8At}, + {(void*)_m, "primitiveSignedInt8AtPut\000\001\001", (void*)primitiveSignedInt8AtPut}, + {(void*)_m, "primitiveStructureElementAlignment\000\000\001", (void*)primitiveStructureElementAlignment}, + {(void*)_m, "primitiveUnsignedInt16At\000\001\001", (void*)primitiveUnsignedInt16At}, + {(void*)_m, "primitiveUnsignedInt16AtPut\000\001\001", (void*)primitiveUnsignedInt16AtPut}, + {(void*)_m, "primitiveUnsignedInt32At\000\001\001", (void*)primitiveUnsignedInt32At}, + {(void*)_m, "primitiveUnsignedInt32AtPut\000\001\001", (void*)primitiveUnsignedInt32AtPut}, + {(void*)_m, "primitiveUnsignedInt64At\000\001\001", (void*)primitiveUnsignedInt64At}, + {(void*)_m, "primitiveUnsignedInt64AtPut\000\001\001", (void*)primitiveUnsignedInt64AtPut}, + {(void*)_m, "primitiveUnsignedInt8At\000\001\001", (void*)primitiveUnsignedInt8At}, + {(void*)_m, "primitiveUnsignedInt8AtPut\000\001\001", (void*)primitiveUnsignedInt8AtPut}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveCalloutAccessorDepth = 2; -EXPORT(signed char) primitiveCalloutWithArgsAccessorDepth = 4; -EXPORT(signed char) primitiveCDataModelAccessorDepth = 0; -EXPORT(signed char) primitiveCreateManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveDestroyManualSurfaceAccessorDepth = 0; -EXPORT(signed char) primitiveFFIAllocateAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIDoubleAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFloatAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveFFIFreeAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtAccessorDepth = 1; -EXPORT(signed char) primitiveFFIIntegerAtPutAccessorDepth = 1; -EXPORT(signed char) primitiveForceLoadAccessorDepth = 2; -EXPORT(signed char) primitiveLoadSymbolFromModuleAccessorDepth = 2; -EXPORT(signed char) primitiveLogCallsToAccessorDepth = 0; -EXPORT(signed char) primitiveSetManualSurfacePointerAccessorDepth = 0; -EXPORT(signed char) primitiveStructureElementAlignmentAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveCalloutWithArgsMetadata = 0x500; +EXPORT(signed short) primitiveCDataModelMetadata = 1; +EXPORT(signed short) primitiveCreateManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveDestroyManualSurfaceMetadata = 0; +EXPORT(signed short) primitiveExternalAddressAsIntegerMetadata = 1; +EXPORT(signed short) primitiveExternalAddressFromIntegerMetadata = -255; +EXPORT(signed short) primitiveFFIAllocateMetadata = 0x100; +EXPORT(signed short) primitiveFFIDoubleAtMetadata = 259; +EXPORT(signed short) primitiveFFIDoubleAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtMetadata = 259; +EXPORT(signed short) primitiveFFIFloatAtPutMetadata = 259; +EXPORT(signed short) primitiveFFIFreeMetadata = 0x100; +EXPORT(signed short) primitiveFFIGetLastErrorMetadata = -255; +EXPORT(signed short) primitiveFFIIntegerAtMetadata = 0x101; +EXPORT(signed short) primitiveFFIIntegerAtPutMetadata = 0x101; +EXPORT(signed short) primitiveForceLoadMetadata = 0x200; +EXPORT(signed short) primitiveLoadSymbolFromModuleMetadata = 0x200; +EXPORT(signed short) primitiveLogCallsToMetadata = 0; +EXPORT(signed short) primitivePluginVersionMetadata = -255; +EXPORT(signed short) primitiveSetManualSurfacePointerMetadata = 0; +EXPORT(signed short) primitiveSignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveSignedInt8AtPutMetadata = 0x101; +EXPORT(signed short) primitiveStructureElementAlignmentMetadata = 1; +EXPORT(signed short) primitiveUnsignedInt16AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt16AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt32AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt64AtPutMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtMetadata = 0x101; +EXPORT(signed short) primitiveUnsignedInt8AtPutMetadata = 0x101; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/SqueakSSL/SqueakSSL.c b/src/plugins/SqueakSSL/SqueakSSL.c index 4182971d6b..e35b8f305b 100644 --- a/src/plugins/SqueakSSL/SqueakSSL.c +++ b/src/plugins/SqueakSSL/SqueakSSL.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - SqueakSSLPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SqueakSSLPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "SqueakSSLPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "SqueakSSLPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -88,7 +88,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "SqueakSSL VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "SqueakSSL VMMaker.oscog-eem.3024 " INT_EXT; @@ -554,30 +554,32 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "SqueakSSL"; void* SqueakSSL_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveAccept\000\001", (void*)primitiveAccept}, - {(void*)_m, "primitiveConnect\000\001", (void*)primitiveConnect}, - {(void*)_m, "primitiveCreate\000\377", (void*)primitiveCreate}, - {(void*)_m, "primitiveDecrypt\000\001", (void*)primitiveDecrypt}, - {(void*)_m, "primitiveDestroy\000\000", (void*)primitiveDestroy}, - {(void*)_m, "primitiveEncrypt\000\001", (void*)primitiveEncrypt}, - {(void*)_m, "primitiveGetIntProperty\000\000", (void*)primitiveGetIntProperty}, - {(void*)_m, "primitiveGetStringProperty\000\000", (void*)primitiveGetStringProperty}, - {(void*)_m, "primitiveSetIntProperty\000\000", (void*)primitiveSetIntProperty}, - {(void*)_m, "primitiveSetStringProperty\000\001", (void*)primitiveSetStringProperty}, + {(void*)_m, "primitiveAccept\000\001\000", (void*)primitiveAccept}, + {(void*)_m, "primitiveConnect\000\001\000", (void*)primitiveConnect}, + {(void*)_m, "primitiveCreate\000\377\000", (void*)primitiveCreate}, + {(void*)_m, "primitiveDecrypt\000\001\000", (void*)primitiveDecrypt}, + {(void*)_m, "primitiveDestroy\000\000\000", (void*)primitiveDestroy}, + {(void*)_m, "primitiveEncrypt\000\001\000", (void*)primitiveEncrypt}, + {(void*)_m, "primitiveGetIntProperty\000\000\000", (void*)primitiveGetIntProperty}, + {(void*)_m, "primitiveGetStringProperty\000\000\000", (void*)primitiveGetStringProperty}, + {(void*)_m, "primitiveSetIntProperty\000\000\000", (void*)primitiveSetIntProperty}, + {(void*)_m, "primitiveSetStringProperty\000\001\000", (void*)primitiveSetStringProperty}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveAcceptAccessorDepth = 1; -EXPORT(signed char) primitiveConnectAccessorDepth = 1; -EXPORT(signed char) primitiveDecryptAccessorDepth = 1; -EXPORT(signed char) primitiveDestroyAccessorDepth = 0; -EXPORT(signed char) primitiveEncryptAccessorDepth = 1; -EXPORT(signed char) primitiveGetIntPropertyAccessorDepth = 0; -EXPORT(signed char) primitiveGetStringPropertyAccessorDepth = 0; -EXPORT(signed char) primitiveSetIntPropertyAccessorDepth = 0; -EXPORT(signed char) primitiveSetStringPropertyAccessorDepth = 1; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveAcceptMetadata = 0x100; +EXPORT(signed short) primitiveConnectMetadata = 0x100; +EXPORT(signed short) primitiveDecryptMetadata = 0x100; +EXPORT(signed short) primitiveDestroyMetadata = 0; +EXPORT(signed short) primitiveEncryptMetadata = 0x100; +EXPORT(signed short) primitiveGetIntPropertyMetadata = 0; +EXPORT(signed short) primitiveGetStringPropertyMetadata = 0; +EXPORT(signed short) primitiveSetIntPropertyMetadata = 0; +EXPORT(signed short) primitiveSetStringPropertyMetadata = 0x100; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/StarSqueakPlugin/StarSqueakPlugin.c b/src/plugins/StarSqueakPlugin/StarSqueakPlugin.c index e78bd22399..49120fcd85 100644 --- a/src/plugins/StarSqueakPlugin/StarSqueakPlugin.c +++ b/src/plugins/StarSqueakPlugin/StarSqueakPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - StarSqueakPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + StarSqueakPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "StarSqueakPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "StarSqueakPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -65,7 +65,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "StarSqueakPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "StarSqueakPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -347,17 +347,19 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "StarSqueakPlugin"; void* StarSqueakPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDiffuseFromToWidthHeightDelta\000\000", (void*)primitiveDiffuseFromToWidthHeightDelta}, - {(void*)_m, "primitiveEvaporateRate\000\000", (void*)primitiveEvaporateRate}, - {(void*)_m, "primitiveMapFromToWidthHeightPatchSizeRgbFlagsShift\000\000", (void*)primitiveMapFromToWidthHeightPatchSizeRgbFlagsShift}, + {(void*)_m, "primitiveDiffuseFromToWidthHeightDelta\000\001\000", (void*)primitiveDiffuseFromToWidthHeightDelta}, + {(void*)_m, "primitiveEvaporateRate\000\001\000", (void*)primitiveEvaporateRate}, + {(void*)_m, "primitiveMapFromToWidthHeightPatchSizeRgbFlagsShift\000\001\000", (void*)primitiveMapFromToWidthHeightPatchSizeRgbFlagsShift}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDiffuseFromToWidthHeightDeltaAccessorDepth = 0; -EXPORT(signed char) primitiveEvaporateRateAccessorDepth = 0; -EXPORT(signed char) primitiveMapFromToWidthHeightPatchSizeRgbFlagsShiftAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveDiffuseFromToWidthHeightDeltaMetadata = 0x100; +EXPORT(signed short) primitiveEvaporateRateMetadata = 0x100; +EXPORT(signed short) primitiveMapFromToWidthHeightPatchSizeRgbFlagsShiftMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/UUIDPlugin/UUIDPlugin.c b/src/plugins/UUIDPlugin/UUIDPlugin.c index e6540e5169..c4fab33671 100644 --- a/src/plugins/UUIDPlugin/UUIDPlugin.c +++ b/src/plugins/UUIDPlugin/UUIDPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - UUIDPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + UUIDPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "UUIDPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "UUIDPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -61,7 +61,7 @@ extern sqInt stackValue(sqInt offset); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "UUIDPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "UUIDPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -145,14 +145,16 @@ static char _m[] = "UUIDPlugin"; void* UUIDPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveMakeUUID\000\001", (void*)primitiveMakeUUID}, + {(void*)_m, "primitiveMakeUUID\000\001\000", (void*)primitiveMakeUUID}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveMakeUUIDAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveMakeUUIDMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/UnicodePlugin/UnicodePlugin.c b/src/plugins/UnicodePlugin/UnicodePlugin.c index 9c95425897..f669ad887c 100644 --- a/src/plugins/UnicodePlugin/UnicodePlugin.c +++ b/src/plugins/UnicodePlugin/UnicodePlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - UnicodePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + UnicodePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "UnicodePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "UnicodePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -84,7 +84,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "UnicodePlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "UnicodePlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -433,28 +433,30 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "UnicodePlugin"; void* UnicodePlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveClipboardGet\000\000", (void*)primitiveClipboardGet}, - {(void*)_m, "primitiveClipboardPut\000\000", (void*)primitiveClipboardPut}, - {(void*)_m, "primitiveClipboardSize\000\377", (void*)primitiveClipboardSize}, - {(void*)_m, "primitiveDrawString\000\000", (void*)primitiveDrawString}, - {(void*)_m, "primitiveGetFontList\000\000", (void*)primitiveGetFontList}, - {(void*)_m, "primitiveGetXRanges\000\000", (void*)primitiveGetXRanges}, - {(void*)_m, "primitiveMeasureString\000\000", (void*)primitiveMeasureString}, - {(void*)_m, "primitiveSetColors\000\000", (void*)primitiveSetColors}, - {(void*)_m, "primitiveSetFont\000\000", (void*)primitiveSetFont}, + {(void*)_m, "primitiveClipboardGet\000\000\000", (void*)primitiveClipboardGet}, + {(void*)_m, "primitiveClipboardPut\000\000\000", (void*)primitiveClipboardPut}, + {(void*)_m, "primitiveClipboardSize\000\377\000", (void*)primitiveClipboardSize}, + {(void*)_m, "primitiveDrawString\000\001\000", (void*)primitiveDrawString}, + {(void*)_m, "primitiveGetFontList\000\001\000", (void*)primitiveGetFontList}, + {(void*)_m, "primitiveGetXRanges\000\001\000", (void*)primitiveGetXRanges}, + {(void*)_m, "primitiveMeasureString\000\001\000", (void*)primitiveMeasureString}, + {(void*)_m, "primitiveSetColors\000\000\000", (void*)primitiveSetColors}, + {(void*)_m, "primitiveSetFont\000\000\000", (void*)primitiveSetFont}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveClipboardGetAccessorDepth = 0; -EXPORT(signed char) primitiveClipboardPutAccessorDepth = 0; -EXPORT(signed char) primitiveDrawStringAccessorDepth = 0; -EXPORT(signed char) primitiveGetFontListAccessorDepth = 0; -EXPORT(signed char) primitiveGetXRangesAccessorDepth = 0; -EXPORT(signed char) primitiveMeasureStringAccessorDepth = 0; -EXPORT(signed char) primitiveSetColorsAccessorDepth = 0; -EXPORT(signed char) primitiveSetFontAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveClipboardGetMetadata = 0; +EXPORT(signed short) primitiveClipboardPutMetadata = 0; +EXPORT(signed short) primitiveDrawStringMetadata = 0x100; +EXPORT(signed short) primitiveGetFontListMetadata = 0x100; +EXPORT(signed short) primitiveGetXRangesMetadata = 0x100; +EXPORT(signed short) primitiveMeasureStringMetadata = 0x100; +EXPORT(signed short) primitiveSetColorsMetadata = 0; +EXPORT(signed short) primitiveSetFontMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c b/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c index b0f6473fd4..fd88b65f96 100644 --- a/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c +++ b/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c @@ -1,5 +1,5 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from UnixOSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.73 uuid: 78f4b0c0-0615-44be-81ad-5804b1f8a80c */ @@ -5258,174 +5258,169 @@ void* UnixOSProcessPlugin_exports[][3] = { {(void*)_m, "getCurrentWorkingDirectoryAsType", (void*)getCurrentWorkingDirectoryAsType}, {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveArgumentAt\000\000", (void*)primitiveArgumentAt}, - {(void*)_m, "primitiveArgumentAtAsBytes\000\000", (void*)primitiveArgumentAtAsBytes}, - {(void*)_m, "primitiveCanReceiveSignals\000\000", (void*)primitiveCanReceiveSignals}, - {(void*)_m, "primitiveChdir\000\000", (void*)primitiveChdir}, - {(void*)_m, "primitiveConfstr\000\000", (void*)primitiveConfstr}, - {(void*)_m, "primitiveCreatePipe\000\377", (void*)primitiveCreatePipe}, - {(void*)_m, "primitiveCreatePipeWithSessionIdentifier\000\001", (void*)primitiveCreatePipeWithSessionIdentifier}, - {(void*)_m, "primitiveDup", (void*)primitiveDup}, - {(void*)_m, "primitiveDupTo", (void*)primitiveDupTo}, - {(void*)_m, "primitiveEnvironmentAt\000\000", (void*)primitiveEnvironmentAt}, - {(void*)_m, "primitiveEnvironmentAtAsBytes\000\000", (void*)primitiveEnvironmentAtAsBytes}, - {(void*)_m, "primitiveEnvironmentAtSymbol\000\000", (void*)primitiveEnvironmentAtSymbol}, - {(void*)_m, "primitiveEnvironmentAtSymbolAsBytes\000\000", (void*)primitiveEnvironmentAtSymbolAsBytes}, - {(void*)_m, "primitiveErrorMessageAt\000\000", (void*)primitiveErrorMessageAt}, - {(void*)_m, "primitiveFileProtectionMask\000\000", (void*)primitiveFileProtectionMask}, - {(void*)_m, "primitiveFileStat\000\000", (void*)primitiveFileStat}, - {(void*)_m, "primitiveFixPointersInArrayOfStrings\000\001", (void*)primitiveFixPointersInArrayOfStrings}, - {(void*)_m, "primitiveForkAndExecInDirectory\000\001", (void*)primitiveForkAndExecInDirectory}, - {(void*)_m, "primitiveForkExec\000\001", (void*)primitiveForkExec}, - {(void*)_m, "primitiveForkSqueak\000\377", (void*)primitiveForkSqueak}, - {(void*)_m, "primitiveForkSqueakWithoutSigHandler\000\377", (void*)primitiveForkSqueakWithoutSigHandler}, - {(void*)_m, "primitiveForwardSignalToSemaphore\000\002", (void*)primitiveForwardSignalToSemaphore}, - {(void*)_m, "primitiveFpathconf\000\001", (void*)primitiveFpathconf}, - {(void*)_m, "primitiveGetCurrentWorkingDirectory\000\377", (void*)primitiveGetCurrentWorkingDirectory}, - {(void*)_m, "primitiveGetCurrentWorkingDirectoryAsBytes\000\377", (void*)primitiveGetCurrentWorkingDirectoryAsBytes}, - {(void*)_m, "primitiveGetEGid\000\377", (void*)primitiveGetEGid}, - {(void*)_m, "primitiveGetEUid\000\377", (void*)primitiveGetEUid}, - {(void*)_m, "primitiveGetGid\000\377", (void*)primitiveGetGid}, - {(void*)_m, "primitiveGetPGid\000\000", (void*)primitiveGetPGid}, - {(void*)_m, "primitiveGetPGrp\000\377", (void*)primitiveGetPGrp}, - {(void*)_m, "primitiveGetPid\000\377", (void*)primitiveGetPid}, - {(void*)_m, "primitiveGetPPid\000\377", (void*)primitiveGetPPid}, - {(void*)_m, "primitiveGetSession\000\377", (void*)primitiveGetSession}, - {(void*)_m, "primitiveGetStdErrHandle\000\377", (void*)primitiveGetStdErrHandle}, - {(void*)_m, "primitiveGetStdErrHandleWithSessionIdentifier\000\001", (void*)primitiveGetStdErrHandleWithSessionIdentifier}, - {(void*)_m, "primitiveGetStdInHandle\000\377", (void*)primitiveGetStdInHandle}, - {(void*)_m, "primitiveGetStdInHandleWithSessionIdentifier\000\001", (void*)primitiveGetStdInHandleWithSessionIdentifier}, - {(void*)_m, "primitiveGetStdOutHandle\000\377", (void*)primitiveGetStdOutHandle}, - {(void*)_m, "primitiveGetStdOutHandleWithSessionIdentifier\000\001", (void*)primitiveGetStdOutHandleWithSessionIdentifier}, - {(void*)_m, "primitiveGetThreadID\000\377", (void*)primitiveGetThreadID}, - {(void*)_m, "primitiveGetUid\000\377", (void*)primitiveGetUid}, - {(void*)_m, "primitiveIsAtEndOfFile\000\001", (void*)primitiveIsAtEndOfFile}, - {(void*)_m, "primitiveKillOnExit\000\001", (void*)primitiveKillOnExit}, - {(void*)_m, "primitiveLockFileRegion\000\001", (void*)primitiveLockFileRegion}, - {(void*)_m, "primitiveMakePipe\000\377", (void*)primitiveMakePipe}, - {(void*)_m, "primitiveMakePipeWithSessionIdentifier\000\001", (void*)primitiveMakePipeWithSessionIdentifier}, - {(void*)_m, "primitiveModuleName\000\377", (void*)primitiveModuleName}, - {(void*)_m, "primitiveNice\000\000", (void*)primitiveNice}, - {(void*)_m, "primitivePathconf\000\001", (void*)primitivePathconf}, - {(void*)_m, "primitivePutEnv\000\002", (void*)primitivePutEnv}, - {(void*)_m, "primitiveRealpath\000\000", (void*)primitiveRealpath}, - {(void*)_m, "primitiveRealpathAsBytes\000\000", (void*)primitiveRealpathAsBytes}, - {(void*)_m, "primitiveReapChildProcess\000\000", (void*)primitiveReapChildProcess}, - {(void*)_m, "primitiveSemaIndexFor\000\001", (void*)primitiveSemaIndexFor}, - {(void*)_m, "primitiveSendSigabrtTo\000\000", (void*)primitiveSendSigabrtTo}, - {(void*)_m, "primitiveSendSigalrmTo\000\000", (void*)primitiveSendSigalrmTo}, - {(void*)_m, "primitiveSendSigchldTo\000\000", (void*)primitiveSendSigchldTo}, - {(void*)_m, "primitiveSendSigcontTo\000\000", (void*)primitiveSendSigcontTo}, - {(void*)_m, "primitiveSendSighupTo\000\000", (void*)primitiveSendSighupTo}, - {(void*)_m, "primitiveSendSigintTo\000\000", (void*)primitiveSendSigintTo}, - {(void*)_m, "primitiveSendSigkillTo\000\000", (void*)primitiveSendSigkillTo}, - {(void*)_m, "primitiveSendSigpipeTo\000\000", (void*)primitiveSendSigpipeTo}, - {(void*)_m, "primitiveSendSigquitTo\000\000", (void*)primitiveSendSigquitTo}, - {(void*)_m, "primitiveSendSigstopTo\000\000", (void*)primitiveSendSigstopTo}, - {(void*)_m, "primitiveSendSigtermTo\000\000", (void*)primitiveSendSigtermTo}, - {(void*)_m, "primitiveSendSigusr1To\000\000", (void*)primitiveSendSigusr1To}, - {(void*)_m, "primitiveSendSigusr2To\000\000", (void*)primitiveSendSigusr2To}, - {(void*)_m, "primitiveSetPGid\000\000", (void*)primitiveSetPGid}, - {(void*)_m, "primitiveSetPGrp\000\377", (void*)primitiveSetPGrp}, - {(void*)_m, "primitiveSetSemaIndex\000\000", (void*)primitiveSetSemaIndex}, - {(void*)_m, "primitiveSetSid\000\377", (void*)primitiveSetSid}, - {(void*)_m, "primitiveSigChldNumber\000\377", (void*)primitiveSigChldNumber}, - {(void*)_m, "primitiveSigHupNumber\000\377", (void*)primitiveSigHupNumber}, - {(void*)_m, "primitiveSigIntNumber\000\377", (void*)primitiveSigIntNumber}, - {(void*)_m, "primitiveSigKillNumber\000\377", (void*)primitiveSigKillNumber}, - {(void*)_m, "primitiveSigPipeNumber\000\377", (void*)primitiveSigPipeNumber}, - {(void*)_m, "primitiveSigQuitNumber\000\377", (void*)primitiveSigQuitNumber}, - {(void*)_m, "primitiveSigTermNumber\000\377", (void*)primitiveSigTermNumber}, - {(void*)_m, "primitiveSigUsr1Number\000\377", (void*)primitiveSigUsr1Number}, - {(void*)_m, "primitiveSigUsr2Number\000\377", (void*)primitiveSigUsr2Number}, - {(void*)_m, "primitiveSizeOfInt\000\377", (void*)primitiveSizeOfInt}, - {(void*)_m, "primitiveSizeOfPointer\000\377", (void*)primitiveSizeOfPointer}, - {(void*)_m, "primitiveSpaceForByteSizeInDirectoryPath\000\002", (void*)primitiveSpaceForByteSizeInDirectoryPath}, - {(void*)_m, "primitiveSQFileFlush\000\001", (void*)primitiveSQFileFlush}, - {(void*)_m, "primitiveSQFileFlushWithSessionIdentifier\000\001", (void*)primitiveSQFileFlushWithSessionIdentifier}, - {(void*)_m, "primitiveSQFileSetBlocking\000\001", (void*)primitiveSQFileSetBlocking}, - {(void*)_m, "primitiveSQFileSetBlockingWithSessionIdentifier\000\001", (void*)primitiveSQFileSetBlockingWithSessionIdentifier}, - {(void*)_m, "primitiveSQFileSetNonBlocking\000\001", (void*)primitiveSQFileSetNonBlocking}, - {(void*)_m, "primitiveSQFileSetNonBlockingWithSessionIdentifier\000\001", (void*)primitiveSQFileSetNonBlockingWithSessionIdentifier}, - {(void*)_m, "primitiveSQFileSetUnbuffered\000\001", (void*)primitiveSQFileSetUnbuffered}, - {(void*)_m, "primitiveSQFileSetUnbufferedWithSessionIdentifier\000\001", (void*)primitiveSQFileSetUnbufferedWithSessionIdentifier}, - {(void*)_m, "primitiveSysconf\000\000", (void*)primitiveSysconf}, - {(void*)_m, "primitiveTestEndOfFileFlag\000\001", (void*)primitiveTestEndOfFileFlag}, - {(void*)_m, "primitiveTestLockableFileRegion\000\001", (void*)primitiveTestLockableFileRegion}, - {(void*)_m, "primitiveUnixFileClose", (void*)primitiveUnixFileClose}, - {(void*)_m, "primitiveUnixFileNumber\000\001", (void*)primitiveUnixFileNumber}, - {(void*)_m, "primitiveUnlockFileRegion\000\001", (void*)primitiveUnlockFileRegion}, - {(void*)_m, "primitiveUnsetEnv\000\000", (void*)primitiveUnsetEnv}, - {(void*)_m, "primitiveVersionString\000\377", (void*)primitiveVersionString}, + {(void*)_m, "primitiveArgumentAt\000\377\000", (void*)primitiveArgumentAt}, + {(void*)_m, "primitiveArgumentAtAsBytes\000\377\000", (void*)primitiveArgumentAtAsBytes}, + {(void*)_m, "primitiveCanReceiveSignals\000\000\000", (void*)primitiveCanReceiveSignals}, + {(void*)_m, "primitiveChdir\000\000\000", (void*)primitiveChdir}, + {(void*)_m, "primitiveConfstr\000\000\000", (void*)primitiveConfstr}, + {(void*)_m, "primitiveCreatePipe\000\377\000", (void*)primitiveCreatePipe}, + {(void*)_m, "primitiveCreatePipeWithSessionIdentifier\000\001\000", (void*)primitiveCreatePipeWithSessionIdentifier}, + {(void*)_m, "primitiveDup\000\000\000", (void*)primitiveDup}, + {(void*)_m, "primitiveDupTo\000\000\000", (void*)primitiveDupTo}, + {(void*)_m, "primitiveEnvironmentAt\000\377\000", (void*)primitiveEnvironmentAt}, + {(void*)_m, "primitiveEnvironmentAtAsBytes\000\377\000", (void*)primitiveEnvironmentAtAsBytes}, + {(void*)_m, "primitiveEnvironmentAtSymbol\000\377\000", (void*)primitiveEnvironmentAtSymbol}, + {(void*)_m, "primitiveEnvironmentAtSymbolAsBytes\000\377\000", (void*)primitiveEnvironmentAtSymbolAsBytes}, + {(void*)_m, "primitiveErrorMessageAt\000\000\000", (void*)primitiveErrorMessageAt}, + {(void*)_m, "primitiveFileProtectionMask\000\000\000", (void*)primitiveFileProtectionMask}, + {(void*)_m, "primitiveFileStat\000\000\000", (void*)primitiveFileStat}, + {(void*)_m, "primitiveFixPointersInArrayOfStrings\000\001\000", (void*)primitiveFixPointersInArrayOfStrings}, + {(void*)_m, "primitiveForkAndExecInDirectory\000\377\000", (void*)primitiveForkAndExecInDirectory}, + {(void*)_m, "primitiveForkExec\000\377\000", (void*)primitiveForkExec}, + {(void*)_m, "primitiveForkSqueak\000\377\000", (void*)primitiveForkSqueak}, + {(void*)_m, "primitiveForkSqueakWithoutSigHandler\000\377\000", (void*)primitiveForkSqueakWithoutSigHandler}, + {(void*)_m, "primitiveForwardSignalToSemaphore\000\002\000", (void*)primitiveForwardSignalToSemaphore}, + {(void*)_m, "primitiveFpathconf\000\001\000", (void*)primitiveFpathconf}, + {(void*)_m, "primitiveGetCurrentWorkingDirectory\000\377\000", (void*)primitiveGetCurrentWorkingDirectory}, + {(void*)_m, "primitiveGetCurrentWorkingDirectoryAsBytes\000\377\000", (void*)primitiveGetCurrentWorkingDirectoryAsBytes}, + {(void*)_m, "primitiveGetEGid\000\377\000", (void*)primitiveGetEGid}, + {(void*)_m, "primitiveGetEUid\000\377\000", (void*)primitiveGetEUid}, + {(void*)_m, "primitiveGetGid\000\377\000", (void*)primitiveGetGid}, + {(void*)_m, "primitiveGetPGid\000\000\000", (void*)primitiveGetPGid}, + {(void*)_m, "primitiveGetPGrp\000\377\000", (void*)primitiveGetPGrp}, + {(void*)_m, "primitiveGetPid\000\377\000", (void*)primitiveGetPid}, + {(void*)_m, "primitiveGetPPid\000\377\000", (void*)primitiveGetPPid}, + {(void*)_m, "primitiveGetSession\000\377\000", (void*)primitiveGetSession}, + {(void*)_m, "primitiveGetStdErrHandle\000\377\000", (void*)primitiveGetStdErrHandle}, + {(void*)_m, "primitiveGetStdErrHandleWithSessionIdentifier\000\001\000", (void*)primitiveGetStdErrHandleWithSessionIdentifier}, + {(void*)_m, "primitiveGetStdInHandle\000\377\000", (void*)primitiveGetStdInHandle}, + {(void*)_m, "primitiveGetStdInHandleWithSessionIdentifier\000\001\000", (void*)primitiveGetStdInHandleWithSessionIdentifier}, + {(void*)_m, "primitiveGetStdOutHandle\000\377\000", (void*)primitiveGetStdOutHandle}, + {(void*)_m, "primitiveGetStdOutHandleWithSessionIdentifier\000\001\000", (void*)primitiveGetStdOutHandleWithSessionIdentifier}, + {(void*)_m, "primitiveGetThreadID\000\377\000", (void*)primitiveGetThreadID}, + {(void*)_m, "primitiveGetUid\000\377\000", (void*)primitiveGetUid}, + {(void*)_m, "primitiveIsAtEndOfFile\000\001\000", (void*)primitiveIsAtEndOfFile}, + {(void*)_m, "primitiveKillOnExit\000\001\000", (void*)primitiveKillOnExit}, + {(void*)_m, "primitiveLockFileRegion\000\001\000", (void*)primitiveLockFileRegion}, + {(void*)_m, "primitiveMakePipe\000\377\000", (void*)primitiveMakePipe}, + {(void*)_m, "primitiveMakePipeWithSessionIdentifier\000\001\000", (void*)primitiveMakePipeWithSessionIdentifier}, + {(void*)_m, "primitiveModuleName\000\377\000", (void*)primitiveModuleName}, + {(void*)_m, "primitiveNice\000\000\000", (void*)primitiveNice}, + {(void*)_m, "primitivePathconf\000\001\000", (void*)primitivePathconf}, + {(void*)_m, "primitivePutEnv\000\002\000", (void*)primitivePutEnv}, + {(void*)_m, "primitiveRealpath\000\377\000", (void*)primitiveRealpath}, + {(void*)_m, "primitiveRealpathAsBytes\000\377\000", (void*)primitiveRealpathAsBytes}, + {(void*)_m, "primitiveReapChildProcess\000\000\000", (void*)primitiveReapChildProcess}, + {(void*)_m, "primitiveSemaIndexFor\000\001\000", (void*)primitiveSemaIndexFor}, + {(void*)_m, "primitiveSendSigabrtTo\000\001\000", (void*)primitiveSendSigabrtTo}, + {(void*)_m, "primitiveSendSigalrmTo\000\001\000", (void*)primitiveSendSigalrmTo}, + {(void*)_m, "primitiveSendSigchldTo\000\001\000", (void*)primitiveSendSigchldTo}, + {(void*)_m, "primitiveSendSigcontTo\000\001\000", (void*)primitiveSendSigcontTo}, + {(void*)_m, "primitiveSendSighupTo\000\001\000", (void*)primitiveSendSighupTo}, + {(void*)_m, "primitiveSendSigintTo\000\001\000", (void*)primitiveSendSigintTo}, + {(void*)_m, "primitiveSendSigkillTo\000\001\000", (void*)primitiveSendSigkillTo}, + {(void*)_m, "primitiveSendSigpipeTo\000\001\000", (void*)primitiveSendSigpipeTo}, + {(void*)_m, "primitiveSendSigquitTo\000\001\000", (void*)primitiveSendSigquitTo}, + {(void*)_m, "primitiveSendSigstopTo\000\001\000", (void*)primitiveSendSigstopTo}, + {(void*)_m, "primitiveSendSigtermTo\000\001\000", (void*)primitiveSendSigtermTo}, + {(void*)_m, "primitiveSendSigusr1To\000\001\000", (void*)primitiveSendSigusr1To}, + {(void*)_m, "primitiveSendSigusr2To\000\001\000", (void*)primitiveSendSigusr2To}, + {(void*)_m, "primitiveSetPGid\000\000\000", (void*)primitiveSetPGid}, + {(void*)_m, "primitiveSetPGrp\000\377\000", (void*)primitiveSetPGrp}, + {(void*)_m, "primitiveSetSemaIndex\000\000\000", (void*)primitiveSetSemaIndex}, + {(void*)_m, "primitiveSetSid\000\377\000", (void*)primitiveSetSid}, + {(void*)_m, "primitiveSigChldNumber\000\377\000", (void*)primitiveSigChldNumber}, + {(void*)_m, "primitiveSigHupNumber\000\377\000", (void*)primitiveSigHupNumber}, + {(void*)_m, "primitiveSigIntNumber\000\377\000", (void*)primitiveSigIntNumber}, + {(void*)_m, "primitiveSigKillNumber\000\377\000", (void*)primitiveSigKillNumber}, + {(void*)_m, "primitiveSigPipeNumber\000\377\000", (void*)primitiveSigPipeNumber}, + {(void*)_m, "primitiveSigQuitNumber\000\377\000", (void*)primitiveSigQuitNumber}, + {(void*)_m, "primitiveSigTermNumber\000\377\000", (void*)primitiveSigTermNumber}, + {(void*)_m, "primitiveSigUsr1Number\000\377\000", (void*)primitiveSigUsr1Number}, + {(void*)_m, "primitiveSigUsr2Number\000\377\000", (void*)primitiveSigUsr2Number}, + {(void*)_m, "primitiveSizeOfInt\000\377\000", (void*)primitiveSizeOfInt}, + {(void*)_m, "primitiveSizeOfPointer\000\377\000", (void*)primitiveSizeOfPointer}, + {(void*)_m, "primitiveSpaceForByteSizeInDirectoryPath\000\002\000", (void*)primitiveSpaceForByteSizeInDirectoryPath}, + {(void*)_m, "primitiveSQFileFlush\000\001\000", (void*)primitiveSQFileFlush}, + {(void*)_m, "primitiveSQFileFlushWithSessionIdentifier\000\001\000", (void*)primitiveSQFileFlushWithSessionIdentifier}, + {(void*)_m, "primitiveSQFileSetBlocking\000\001\000", (void*)primitiveSQFileSetBlocking}, + {(void*)_m, "primitiveSQFileSetBlockingWithSessionIdentifier\000\001\000", (void*)primitiveSQFileSetBlockingWithSessionIdentifier}, + {(void*)_m, "primitiveSQFileSetNonBlocking\000\001\000", (void*)primitiveSQFileSetNonBlocking}, + {(void*)_m, "primitiveSQFileSetNonBlockingWithSessionIdentifier\000\001\000", (void*)primitiveSQFileSetNonBlockingWithSessionIdentifier}, + {(void*)_m, "primitiveSQFileSetUnbuffered\000\001\000", (void*)primitiveSQFileSetUnbuffered}, + {(void*)_m, "primitiveSQFileSetUnbufferedWithSessionIdentifier\000\001\000", (void*)primitiveSQFileSetUnbufferedWithSessionIdentifier}, + {(void*)_m, "primitiveSysconf\000\000\000", (void*)primitiveSysconf}, + {(void*)_m, "primitiveTestEndOfFileFlag\000\001\000", (void*)primitiveTestEndOfFileFlag}, + {(void*)_m, "primitiveTestLockableFileRegion\000\001\000", (void*)primitiveTestLockableFileRegion}, + {(void*)_m, "primitiveUnixFileClose\000\000\000", (void*)primitiveUnixFileClose}, + {(void*)_m, "primitiveUnixFileNumber\000\001\000", (void*)primitiveUnixFileNumber}, + {(void*)_m, "primitiveUnlockFileRegion\000\001\000", (void*)primitiveUnlockFileRegion}, + {(void*)_m, "primitiveUnsetEnv\000\000\000", (void*)primitiveUnsetEnv}, + {(void*)_m, "primitiveVersionString\000\377\000", (void*)primitiveVersionString}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, - {(void*)_m, "shutdownModule\000\377", (void*)shutdownModule}, + {(void*)_m, "shutdownModule", (void*)shutdownModule}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveArgumentAtAccessorDepth = 0; -EXPORT(signed char) primitiveArgumentAtAsBytesAccessorDepth = 0; -EXPORT(signed char) primitiveCanReceiveSignalsAccessorDepth = 0; -EXPORT(signed char) primitiveChdirAccessorDepth = 0; -EXPORT(signed char) primitiveConfstrAccessorDepth = 0; -EXPORT(signed char) primitiveCreatePipeWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveEnvironmentAtAccessorDepth = 0; -EXPORT(signed char) primitiveEnvironmentAtAsBytesAccessorDepth = 0; -EXPORT(signed char) primitiveEnvironmentAtSymbolAccessorDepth = 0; -EXPORT(signed char) primitiveEnvironmentAtSymbolAsBytesAccessorDepth = 0; -EXPORT(signed char) primitiveErrorMessageAtAccessorDepth = 0; -EXPORT(signed char) primitiveFileProtectionMaskAccessorDepth = 0; -EXPORT(signed char) primitiveFileStatAccessorDepth = 0; -EXPORT(signed char) primitiveFixPointersInArrayOfStringsAccessorDepth = 1; -EXPORT(signed char) primitiveForkAndExecInDirectoryAccessorDepth = 1; -EXPORT(signed char) primitiveForkExecAccessorDepth = 1; -EXPORT(signed char) primitiveForwardSignalToSemaphoreAccessorDepth = 2; -EXPORT(signed char) primitiveFpathconfAccessorDepth = 1; -EXPORT(signed char) primitiveGetPGidAccessorDepth = 0; -EXPORT(signed char) primitiveGetStdErrHandleWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveGetStdInHandleWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveGetStdOutHandleWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveIsAtEndOfFileAccessorDepth = 1; -EXPORT(signed char) primitiveKillOnExitAccessorDepth = 1; -EXPORT(signed char) primitiveLockFileRegionAccessorDepth = 1; -EXPORT(signed char) primitiveMakePipeWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveNiceAccessorDepth = 0; -EXPORT(signed char) primitivePathconfAccessorDepth = 1; -EXPORT(signed char) primitivePutEnvAccessorDepth = 2; -EXPORT(signed char) primitiveRealpathAccessorDepth = 0; -EXPORT(signed char) primitiveRealpathAsBytesAccessorDepth = 0; -EXPORT(signed char) primitiveReapChildProcessAccessorDepth = 0; -EXPORT(signed char) primitiveSemaIndexForAccessorDepth = 1; -EXPORT(signed char) primitiveSendSigabrtToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigalrmToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigchldToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigcontToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSighupToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigintToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigkillToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigpipeToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigquitToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigstopToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigtermToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigusr1ToAccessorDepth = 0; -EXPORT(signed char) primitiveSendSigusr2ToAccessorDepth = 0; -EXPORT(signed char) primitiveSetPGidAccessorDepth = 0; -EXPORT(signed char) primitiveSetSemaIndexAccessorDepth = 0; -EXPORT(signed char) primitiveSpaceForByteSizeInDirectoryPathAccessorDepth = 2; -EXPORT(signed char) primitiveSQFileFlushAccessorDepth = 1; -EXPORT(signed char) primitiveSQFileFlushWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveSQFileSetBlockingAccessorDepth = 1; -EXPORT(signed char) primitiveSQFileSetBlockingWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveSQFileSetNonBlockingAccessorDepth = 1; -EXPORT(signed char) primitiveSQFileSetNonBlockingWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveSQFileSetUnbufferedAccessorDepth = 1; -EXPORT(signed char) primitiveSQFileSetUnbufferedWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveSysconfAccessorDepth = 0; -EXPORT(signed char) primitiveTestEndOfFileFlagAccessorDepth = 1; -EXPORT(signed char) primitiveTestLockableFileRegionAccessorDepth = 1; -EXPORT(signed char) primitiveUnixFileNumberAccessorDepth = 1; -EXPORT(signed char) primitiveUnlockFileRegionAccessorDepth = 1; -EXPORT(signed char) primitiveUnsetEnvAccessorDepth = 0; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveCanReceiveSignalsMetadata = 0; +EXPORT(signed short) primitiveChdirMetadata = 0; +EXPORT(signed short) primitiveConfstrMetadata = 0; +EXPORT(signed short) primitiveCreatePipeWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveDupMetadata = 0; +EXPORT(signed short) primitiveDupToMetadata = 0; +EXPORT(signed short) primitiveErrorMessageAtMetadata = 0; +EXPORT(signed short) primitiveFileProtectionMaskMetadata = 0; +EXPORT(signed short) primitiveFileStatMetadata = 0; +EXPORT(signed short) primitiveFixPointersInArrayOfStringsMetadata = 0x100; +EXPORT(signed short) primitiveForwardSignalToSemaphoreMetadata = 0x200; +EXPORT(signed short) primitiveFpathconfMetadata = 0x100; +EXPORT(signed short) primitiveGetPGidMetadata = 0; +EXPORT(signed short) primitiveGetStdErrHandleWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveGetStdInHandleWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveGetStdOutHandleWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveIsAtEndOfFileMetadata = 0x100; +EXPORT(signed short) primitiveKillOnExitMetadata = 0x100; +EXPORT(signed short) primitiveLockFileRegionMetadata = 0x100; +EXPORT(signed short) primitiveMakePipeWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveNiceMetadata = 0; +EXPORT(signed short) primitivePathconfMetadata = 0x100; +EXPORT(signed short) primitivePutEnvMetadata = 0x200; +EXPORT(signed short) primitiveReapChildProcessMetadata = 0; +EXPORT(signed short) primitiveSemaIndexForMetadata = 0x100; +EXPORT(signed short) primitiveSendSigabrtToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigalrmToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigchldToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigcontToMetadata = 0x100; +EXPORT(signed short) primitiveSendSighupToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigintToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigkillToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigpipeToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigquitToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigstopToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigtermToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigusr1ToMetadata = 0x100; +EXPORT(signed short) primitiveSendSigusr2ToMetadata = 0x100; +EXPORT(signed short) primitiveSetPGidMetadata = 0; +EXPORT(signed short) primitiveSetSemaIndexMetadata = 0; +EXPORT(signed short) primitiveSpaceForByteSizeInDirectoryPathMetadata = 0x200; +EXPORT(signed short) primitiveSQFileFlushMetadata = 0x100; +EXPORT(signed short) primitiveSQFileFlushWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveSQFileSetBlockingMetadata = 0x100; +EXPORT(signed short) primitiveSQFileSetBlockingWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveSQFileSetNonBlockingMetadata = 0x100; +EXPORT(signed short) primitiveSQFileSetNonBlockingWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveSQFileSetUnbufferedMetadata = 0x100; +EXPORT(signed short) primitiveSQFileSetUnbufferedWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveSysconfMetadata = 0; +EXPORT(signed short) primitiveTestEndOfFileFlagMetadata = 0x100; +EXPORT(signed short) primitiveTestLockableFileRegionMetadata = 0x100; +EXPORT(signed short) primitiveUnixFileCloseMetadata = 0; +EXPORT(signed short) primitiveUnixFileNumberMetadata = 0x100; +EXPORT(signed short) primitiveUnlockFileRegionMetadata = 0x100; +EXPORT(signed short) primitiveUnsetEnvMetadata = 0; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c b/src/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c index e04e7caa07..ab50918868 100644 --- a/src/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c +++ b/src/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - VMProfileLinuxSupportPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMProfileLinuxSupportPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "VMProfileLinuxSupportPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "VMProfileLinuxSupportPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -100,7 +100,7 @@ extern sqInt topRemappableOop(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "VMProfileLinuxSupportPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "VMProfileLinuxSupportPlugin VMMaker.oscog-eem.3024 " INT_EXT; static sqInt numModules; static sqInt primErr; @@ -337,15 +337,17 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "VMProfileLinuxSupportPlugin"; void* VMProfileLinuxSupportPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDLSymInLibrary\000\000", (void*)primitiveDLSymInLibrary}, - {(void*)_m, "primitiveExecutableModules\000\377", (void*)primitiveExecutableModules}, - {(void*)_m, "primitiveInterpretAddress\000\377", (void*)primitiveInterpretAddress}, + {(void*)_m, "primitiveDLSymInLibrary\000\000\000", (void*)primitiveDLSymInLibrary}, + {(void*)_m, "primitiveExecutableModules\000\377\000", (void*)primitiveExecutableModules}, + {(void*)_m, "primitiveInterpretAddress\000\377\000", (void*)primitiveInterpretAddress}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDLSymInLibraryAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primitiveDLSymInLibraryMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/VMProfileMacSupportPlugin/VMProfileMacSupportPlugin.c b/src/plugins/VMProfileMacSupportPlugin/VMProfileMacSupportPlugin.c index ea0095076a..ab62a22c5e 100644 --- a/src/plugins/VMProfileMacSupportPlugin/VMProfileMacSupportPlugin.c +++ b/src/plugins/VMProfileMacSupportPlugin/VMProfileMacSupportPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - VMProfileMacSupportPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 + VMProfileMacSupportPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "VMProfileMacSupportPlugin VMMaker.oscog-eem.2985 uuid: f1d118fb-fac8-4f42-82d9-68635c83d686 " __DATE__ ; +static char __buildInfo[] = "VMProfileMacSupportPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -98,7 +98,7 @@ extern sqInt topRemappableOop(void); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "VMProfileMacSupportPlugin VMMaker.oscog-eem.2985 " INT_EXT; +static const char *moduleName = "VMProfileMacSupportPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -301,14 +301,16 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "VMProfileMacSupportPlugin"; void* VMProfileMacSupportPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDLSym\000\001", (void*)primitiveDLSym}, - {(void*)_m, "primitiveExecutableModulesAndOffsets\000\377", (void*)primitiveExecutableModulesAndOffsets}, + {(void*)_m, "primitiveDLSym\000\001\000", (void*)primitiveDLSym}, + {(void*)_m, "primitiveExecutableModulesAndOffsets\000\377\000", (void*)primitiveExecutableModulesAndOffsets}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDLSymAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveDLSymMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/VectorEnginePlugin/VectorEnginePlugin.c b/src/plugins/VectorEnginePlugin/VectorEnginePlugin.c new file mode 100644 index 0000000000..d49d8e0271 --- /dev/null +++ b/src/plugins/VectorEnginePlugin/VectorEnginePlugin.c @@ -0,0 +1,5155 @@ +/* Automatically generated by + SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3006 uuid: 52ac109b-6c67-49ce-a59a-c0e0dbb20e59 + from + VectorEnginePlugin VectorEnginePlugin-dtl.10 uuid: 22240387-b64b-4850-88c7-dc1510e70abe + */ +static char __buildInfo[] = "VectorEnginePlugin VectorEnginePlugin-dtl.10 uuid: 22240387-b64b-4850-88c7-dc1510e70abe " __DATE__ ; + + +#include "config.h" +#include +#include "sqMathShim.h" +#include +#include +#include +#include +#include + +/* Do not include the entire sq.h file but just those parts needed. */ +#include "sqConfig.h" /* Configuration options */ +#include "sqVirtualMachine.h" /* The virtual machine proxy definition */ +#include "sqPlatformSpecific.h" /* Platform specific definitions */ + +#include "sqMemoryAccess.h" + +#define true 1 +#define false 0 +#define null 0 /* using 'null' because nil is predefined in Think C */ +#ifdef SQUEAK_BUILTIN_PLUGIN +# undef EXPORT +# define EXPORT(returnType) static returnType +# define INT_EXT "(i)" +#else +# define INT_EXT "(e)" +#endif + + +/*** Constants ***/ +#define PrimErrBadArgument 3 + + +/*** Function Prototypes ***/ +static sqInt blendFillOnlyAtredIsInsidegreenIsInsideblueIsInsideantiAliasAlphasWord(sqInt pixelIndex, sqInt isRedInside, sqInt isGreenInside, sqInt isBlueInside, uint32_t antiAliasAlphasWord); +static sqInt blendFillOnlyWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits); +static sqInt blendStrokeAndFillAtredIsInsidegreenIsInsideblueIsInsideantiAliasAlphasWord(sqInt pixelIndex, sqInt isRedInside, sqInt isGreenInside, sqInt isBlueInside, uint32_t antiAliasAlphasWord); +static sqInt blendStrokeAndFillInsideWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits); +static sqInt blendStrokeAndFillOutsideWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits); +static sqInt blendStrokeOnlyAtantiAliasAlphasWord(sqInt pixelIndex, uint32_t antiAliasAlphasWord); +static sqInt blendStrokeOnlyWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits); +EXPORT(const char*) getModuleName(void); +static sqInt initializeTrajectoryFragment(void); +EXPORT(sqInt) pluginApiVersion(void); +EXPORT(sqInt) primAntiAliasingWidthsubPixelDeltaHopLength(void); +EXPORT(sqInt) primArc(void); +EXPORT(sqInt) primArcWP(void); +EXPORT(sqInt) primBlendFillOnly(void); +EXPORT(sqInt) primBlendFillOnlyWPOT(void); +EXPORT(sqInt) primBlendStrokeAndFill(void); +EXPORT(sqInt) primBlendStrokeAndFillWPOT(void); +EXPORT(sqInt) primBlendStrokeOnly(void); +EXPORT(sqInt) primBlendStrokeOnlyWPOT(void); +EXPORT(sqInt) primClipCurrentMorph(void); +EXPORT(sqInt) primClipLeftclipTopclipRightclipBottom(void); +EXPORT(sqInt) primCubicBezier(void); +EXPORT(sqInt) primCubicBezierWP(void); +EXPORT(sqInt) primCurrentMorphIdcurrentClipsSubmorphs(void); +EXPORT(sqInt) primDisplayString(void); +EXPORT(sqInt) primDisplayStringWP(void); +EXPORT(sqInt) primDisplayUtf32(void); +EXPORT(sqInt) primDisplayUtf32WP(void); +EXPORT(sqInt) primDisplayUtf8(void); +EXPORT(sqInt) primDisplayUtf8WP(void); +EXPORT(sqInt) primFillRGBA(void); +EXPORT(sqInt) primGeometryTxSet(void); +EXPORT(sqInt) primInitializePath(void); +EXPORT(sqInt) primLine(void); +EXPORT(sqInt) primLineWP(void); +EXPORT(sqInt) primNewTrajectoryFragment(void); +EXPORT(sqInt) primPathSequence(void); +EXPORT(sqInt) primPathSequenceWP(void); +EXPORT(sqInt) primQuadraticBezier(void); +EXPORT(sqInt) primQuadraticBezierWP(void); +EXPORT(sqInt) primResetContour(void); +EXPORT(sqInt) primSetTarget(void); +EXPORT(sqInt) primSetTargetWP(void); +EXPORT(sqInt) primSpanBottom(void); +EXPORT(sqInt) primSpanLeft(void); +EXPORT(sqInt) primSpanRight(void); +EXPORT(sqInt) primSpanTop(void); +EXPORT(sqInt) primStrokeRGBA(void); +EXPORT(sqInt) primStrokeWidth(void); +EXPORT(sqInt) primUpdateContourLastLine(void); +static sqInt pvt_cubicBezierFromXytoXycontrol1Xycontrol2Xy(float xFrom, float yFrom, float xTo, float yTo, float xControl1, float yControl1, float xControl2, float yControl2); +static sqInt pvt_cubicBezierWPFromXytoXycontrol1Xycontrol2Xy(float xFrom, float yFrom, float xTo, float yTo, float xControl1, float yControl1, float xControl2, float yControl2); +static sqInt pvt_lineFromXytoXy(float xFrom, float yFrom, float xTo, float yTo); +static sqInt pvt_lineWPFromXytoXy(float xFrom, float yFrom, float xTo, float yTo); +static sqInt pvt_quadraticBezierFromXytoXycontrolXy(float xFrom, float yFrom, float xTo, float yTo, float xControl, float yControl); +static sqInt pvt_quadraticBezierWPFromXytoXycontrolXy(float xFrom, float yFrom, float xTo, float yTo, float xControl, float yControl); +EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter); +static sqInt updateAlphasForXy(float x, float y); +static sqInt updateAlphasWPForXy(float x, float y); +static sqInt updateAlphasWPZeroStrokeForXy(float x, float y); +static sqInt updateContourForXy(float x, float y); +static sqInt updateEdgeCountAtXy(float x, float y); +static sqInt updateEdgeCountWPAtXy(float x, float y); + + +/*** Variables ***/ +static uint32_t * alphaMask; +static uint8_t * alphaMaskWP; +static sqInt clipBottom; +static sqInt clipCurrentMorph; +static sqInt clipLeft; +static sqInt clipRight; +static sqInt clipTop; +static float * contour; +static sqInt currentClipsSubmorphs; +static uint32_t * edgeCounts; +static uint8_t * edgeCountsWP; + +#if !defined(SQUEAK_BUILTIN_PLUGIN) +static sqInt (*booleanValueOf)(sqInt obj); +static sqInt (*failed)(void); +static void * (*firstIndexableField)(sqInt oop); +static sqInt (*floatObjectOf)(double aFloat); +#if !defined(integerObjectOf) +static sqInt (*integerObjectOf)(sqInt value); +#endif +#if !defined(integerValueOf) +static sqInt (*integerValueOf)(sqInt oop); +#endif +static sqInt (*isBooleanObject)(sqInt oop); +static sqInt (*isBytes)(sqInt oop); +static sqInt (*isFloatObject)(sqInt oop); +#if !defined(isIntegerObject) +static sqInt (*isIntegerObject)(sqInt objectPointer); +#endif +static sqInt (*isWords)(sqInt oop); +static sqInt (*isWordsOrBytes)(sqInt oop); +static sqInt (*methodReturnValue)(sqInt oop); +static sqInt (*pop)(sqInt nItems); +static sqInt (*primitiveFailFor)(sqInt reasonCode); +static double (*stackFloatValue)(sqInt offset); +static sqInt (*stackValue)(sqInt offset); +#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */ +extern sqInt booleanValueOf(sqInt obj); +extern sqInt failed(void); +extern void * firstIndexableField(sqInt oop); +extern sqInt floatObjectOf(double aFloat); +#if !defined(integerObjectOf) +extern sqInt integerObjectOf(sqInt value); +#endif +#if !defined(integerValueOf) +extern sqInt integerValueOf(sqInt oop); +#endif +#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 15) +extern sqInt isBooleanObject(sqInt oop); +#else +# define isBooleanObject(oop) 0 +#endif +extern sqInt isBytes(sqInt oop); +extern sqInt isFloatObject(sqInt oop); +#if !defined(isIntegerObject) +extern sqInt isIntegerObject(sqInt objectPointer); +#endif +extern sqInt isWords(sqInt oop); +extern sqInt isWordsOrBytes(sqInt oop); +extern sqInt methodReturnValue(sqInt oop); +extern sqInt pop(sqInt nItems); +extern sqInt primitiveFailFor(sqInt reasonCode); +extern double stackFloatValue(sqInt offset); +extern sqInt stackValue(sqInt offset); +extern +#endif +struct VirtualMachine* interpreterProxy; +static const char *moduleName = "VectorEnginePlugin VectorEnginePlugin-dtl.10 " INT_EXT; +static uint32_t * morphIds; +static sqInt prevYRounded; +static sqInt prevYTruncated; +static uint32_t * targetBits; +static sqInt targetHeight; +static sqInt targetWidth; +static uint32_t currentMorphId; +static float antiAliasingWidth; +static float auxAntiAliasingWidthScaledInverse; +static float auxStrokeWidthDilatedHalf; +static float auxStrokeWidthDilatedHalfSquared; +static float auxStrokeWidthErodedHalfSquared; +static float fillA; +static float fillB; +static float fillG; +static float fillR; +static float hop; +static float leftAtThisY; +static float rightAtThisY; +static float spanBottom; +static float spanLeft; +static float spanRight; +static float spanTop; +static float strokeA; +static float strokeB; +static float strokeG; +static float strokeR; +static float strokeWidth; +static float subPixelDelta; +static float txA11; +static float txA12; +static float txA13; +static float txA21; +static float txA22; +static float txA23; + + + +/* Blends fill color over background. Target translucency computed + correctly. + For blending, alphas are in [0 .. 1.0] and R, G, B color + components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendFillOnlyAt:redIsInside:greenIsInside:blueIsInside:antiAliasAlphasWord: */ +static sqInt +blendFillOnlyAtredIsInsidegreenIsInsideblueIsInsideantiAliasAlphasWord(sqInt pixelIndex, sqInt isRedInside, sqInt isGreenInside, sqInt isBlueInside, uint32_t antiAliasAlphasWord) +{ + float alphaB; + float alphaG; + float alphaR; + float antiAliasBlueAlpha; + uint32_t antiAliasBlueAlphaBits; + float antiAliasGreenAlpha; + uint32_t antiAliasGreenAlphaBits; + uint32_t antiAliasGreenAlphaBitsShifted; + float antiAliasRedAlpha; + uint32_t antiAliasRedAlphaBits; + float clippingAntiAlias; + uint32_t clippingAntiAliasBits; + uint32_t morphIdWord; + float resultAlphaB; + uint32_t resultAlphaBits; + float resultAlphaG; + float resultAlphaR; + float resultB; + uint32_t resultBBits; + float resultG; + uint32_t resultGBits; + float resultR; + uint32_t resultRBits; + float targetAlpha; + uint32_t targetWord; + float unAlphaB; + float unAlphaG; + float unAlphaR; + + antiAliasRedAlphaBits = antiAliasAlphasWord & 0x7F0000; + antiAliasGreenAlphaBits = antiAliasAlphasWord & 0x7F00; + antiAliasBlueAlphaBits = antiAliasAlphasWord & 0x7F; + if (isRedInside) { + antiAliasRedAlphaBits = 0x7F0000 - antiAliasRedAlphaBits; + } + if (isGreenInside) { + antiAliasGreenAlphaBits = 0x7F00 - antiAliasGreenAlphaBits; + } + if (isBlueInside) { + antiAliasBlueAlphaBits = 0x7F - antiAliasBlueAlphaBits; + } + antiAliasRedAlpha = antiAliasRedAlphaBits * (1.0 / (8.323072e6)); + antiAliasGreenAlpha = antiAliasGreenAlphaBits * (1.0 / (32512.0)); + antiAliasBlueAlpha = antiAliasBlueAlphaBits * (1.0 / 127.0); + alphaR = antiAliasRedAlpha * fillA; + alphaG = antiAliasGreenAlpha * fillA; + alphaB = antiAliasBlueAlpha * fillA; + if (currentClipsSubmorphs) { + + /* Don't clip us, but do clip submorphs */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + + antiAliasGreenAlphaBitsShifted = antiAliasGreenAlphaBits >> 8; + if (antiAliasGreenAlphaBitsShifted > clippingAntiAliasBits) { + clippingAntiAliasBits = antiAliasGreenAlphaBitsShifted; + } + } + else { + if (clipCurrentMorph) { + + /* Clip ourselves to the border anti aliasing of the morph we are clipping at. Keep it for further use. */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + clippingAntiAlias = clippingAntiAliasBits * (1.0 / 127.0); + alphaR = alphaR * clippingAntiAlias; + alphaG = alphaG * clippingAntiAlias; + alphaB = alphaB * clippingAntiAlias; + } + else { + + /* Don't do any additional clipping or preparation for further clipping */ + clippingAntiAliasBits = 0; + } + } + if (!(((alphaR + alphaG) + alphaB) == 0.0)) { + targetWord = targetBits[pixelIndex]; + resultAlphaBits = targetWord & 0xFF000000U; + resultRBits = targetWord & 0xFF0000; + resultGBits = targetWord & 0xFF00; + resultBBits = targetWord & 0xFF; + + /* These if are not really needed. just ignore them if we use simd instructions. */ + targetAlpha = resultAlphaBits * (1.0 / (4.27819008e9)); + if (!(alphaR == 0.0)) { + unAlphaR = 1.0 - alphaR; + resultAlphaR = alphaR + (unAlphaR * targetAlpha); + + resultR = (alphaR * fillR) + ((unAlphaR * (resultRBits >> 16)) * targetAlpha); + resultRBits = (uint32_t)(resultR / resultAlphaR + 0.5) << 16; + } + if (!(alphaG == 0.0)) { + unAlphaG = 1.0 - alphaG; + resultAlphaG = alphaG + (unAlphaG * targetAlpha); + + resultG = (alphaG * fillG) + ((unAlphaG * (resultGBits >> 8)) * targetAlpha); + resultGBits = (uint32_t)(resultG / resultAlphaG + 0.5) << 8; + resultAlphaBits = (uint32_t)(resultAlphaG * 255.0 + 0.5) << 24; + } + if (!(alphaB == 0.0)) { + unAlphaB = 1.0 - alphaB; + resultAlphaB = alphaB + (unAlphaB * targetAlpha); + + resultB = (alphaB * fillB) + ((unAlphaB * resultBBits) * targetAlpha); + resultBBits = (uint32_t)(resultB / resultAlphaB + 0.5); + } + targetWord = ((resultAlphaBits | resultRBits) | resultGBits) | resultBBits; + targetBits[pixelIndex] = targetWord; + if (!(currentMorphId == 0)) { + morphIdWord = (((usqInt)(currentMorphId) << 8)) + clippingAntiAliasBits; + morphIds[pixelIndex] = morphIdWord; + } + } + return 0; +} + + +/* Blends fill color over background. + WP: Whole pixel anti aliasing. + OT: + Target ignored on input and set to opaque on output. + For blending, alphas + are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendFillOnlyWPOTAt:antiAliasAlphaByte: */ +static sqInt +blendFillOnlyWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) +{ + float alpha; + float antiAliasAlpha; + float clippingAntiAlias; + uint32_t clippingAntiAliasBits; + uint32_t morphIdWord; + float resultB; + uint32_t resultBBits; + float resultG; + uint32_t resultGBits; + float resultR; + uint32_t resultRBits; + uint32_t targetWord; + float unAlpha; + + + /* 1.0/127.0 */ + antiAliasAlpha = antiAliasAlphaBits * 0.007874; + alpha = antiAliasAlpha * fillA; + if (currentClipsSubmorphs) { + + /* Don't clip us, but do clip submorphs */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + if (antiAliasAlphaBits > clippingAntiAliasBits) { + clippingAntiAliasBits = antiAliasAlphaBits; + } + } + else { + if (clipCurrentMorph) { + + /* Clip ourselves to the border anti aliasing of the morph we are clipping at. Keep it for further use. */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + + /* 1.0/127.0 */ + clippingAntiAlias = clippingAntiAliasBits * 0.007874; + alpha = alpha * clippingAntiAlias; + } + else { + + /* Don't do any additional clipping or preparation for further clipping */ + clippingAntiAliasBits = 0; + } + } + if (!(alpha == 0.0)) { + targetWord = targetBits[pixelIndex]; + resultRBits = targetWord & 0xFF0000; + resultGBits = targetWord & 0xFF00; + resultBBits = targetWord & 0xFF; + unAlpha = 1.0 - alpha; + + resultR = (alpha * fillR) + (unAlpha * (resultRBits >> 16)); + resultRBits = (uint32_t)(resultR + 0.5) << 16; + resultG = (alpha * fillG) + (unAlpha * (resultGBits >> 8)); + resultGBits = (uint32_t)(resultG + 0.5) << 8; + resultB = (alpha * fillB) + (unAlpha * resultBBits); + resultBBits = (uint32_t)(resultB + 0.5); + targetWord = ((0xFF000000U | resultRBits) | resultGBits) | resultBBits; + targetBits[pixelIndex] = targetWord; + if (!(currentMorphId == 0)) { + morphIdWord = (((usqInt)(currentMorphId) << 8)) + clippingAntiAliasBits; + morphIds[pixelIndex] = morphIdWord; + } + } + return 0; +} + + +/* Blends stroke color and fill color over background. + Do an appropriate + (anti aliased) gradient between stoke color and fill color (or pick just + stroke or just fill). Blend this over background. + Target translucency + computed correctly. + For blending, alphas are in [0 .. 1.0] and R, G, B + color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeAndFillAt:redIsInside:greenIsInside:blueIsInside:antiAliasAlphasWord: */ +static sqInt +blendStrokeAndFillAtredIsInsidegreenIsInsideblueIsInsideantiAliasAlphasWord(sqInt pixelIndex, sqInt isRedInside, sqInt isGreenInside, sqInt isBlueInside, uint32_t antiAliasAlphasWord) +{ + float alphaB; + float alphaG; + float alphaR; + float antiAliasBlueAlpha; + uint32_t antiAliasBlueAlphaBits; + float antiAliasGreenAlpha; + uint32_t antiAliasGreenAlphaBits; + uint32_t antiAliasGreenAlphaBitsShifted; + float antiAliasRedAlpha; + uint32_t antiAliasRedAlphaBits; + float clippingAntiAlias; + uint32_t clippingAntiAliasBits; + float foreB; + float foreG; + float foreR; + uint32_t morphIdWord; + float resultAlphaB; + uint32_t resultAlphaBits; + float resultAlphaG; + float resultAlphaR; + float resultB; + uint32_t resultBBits; + float resultG; + uint32_t resultGBits; + float resultR; + uint32_t resultRBits; + float targetAlpha; + uint32_t targetWord; + float unAlphaB; + float unAlphaG; + float unAlphaR; + + antiAliasRedAlphaBits = antiAliasAlphasWord & 0x7F0000; + antiAliasGreenAlphaBits = antiAliasAlphasWord & 0x7F00; + antiAliasBlueAlphaBits = antiAliasAlphasWord & 0x7F; + antiAliasRedAlpha = antiAliasRedAlphaBits * (1.0 / (8.323072e6)); + antiAliasGreenAlpha = antiAliasGreenAlphaBits * (1.0 / (32512.0)); + antiAliasBlueAlpha = antiAliasBlueAlphaBits * (1.0 / 127.0); + if (isRedInside) { + + /* Do gradient between stroke and fill. Blend the result over background */ + alphaR = (antiAliasRedAlpha * strokeA) + ((1.0 - antiAliasRedAlpha) * fillA); + foreR = (antiAliasRedAlpha * strokeR) + ((1.0 - antiAliasRedAlpha) * fillR); + } + else { + + /* Blend stroke over background */ + alphaR = antiAliasRedAlpha * strokeA; + foreR = strokeR; + } + if (isGreenInside) { + + /* Do gradient between stroke and fill. Blend the result over background */ + alphaG = (antiAliasGreenAlpha * strokeA) + ((1.0 - antiAliasGreenAlpha) * fillA); + foreG = (antiAliasGreenAlpha * strokeG) + ((1.0 - antiAliasGreenAlpha) * fillG); + } + else { + + /* Blend stroke over background */ + alphaG = antiAliasGreenAlpha * strokeA; + foreG = strokeG; + } + if (isBlueInside) { + + /* Do gradient between stroke and fill. Blend the result over background */ + alphaB = (antiAliasBlueAlpha * strokeA) + ((1.0 - antiAliasBlueAlpha) * fillA); + foreB = (antiAliasBlueAlpha * strokeB) + ((1.0 - antiAliasBlueAlpha) * fillB); + } + else { + + /* Blend stroke over background */ + alphaB = antiAliasBlueAlpha * strokeA; + foreB = strokeB; + } + if (currentClipsSubmorphs) { + + /* Don't clip us, but do clip submorphs */ + if (isGreenInside) { + clippingAntiAliasBits = 0x7F; + } + else { + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + + antiAliasGreenAlphaBitsShifted = antiAliasGreenAlphaBits >> 8; + if (antiAliasGreenAlphaBitsShifted > clippingAntiAliasBits) { + clippingAntiAliasBits = antiAliasGreenAlphaBitsShifted; + } + } + } + else { + if (clipCurrentMorph) { + + /* Clip ourselves to the border anti aliasing of the morph we are clipping at. Keep it for further use. */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + clippingAntiAlias = clippingAntiAliasBits * (1.0 / 127.0); + alphaR = alphaR * clippingAntiAlias; + alphaG = alphaG * clippingAntiAlias; + alphaB = alphaB * clippingAntiAlias; + } + else { + + /* Don't do any additional clipping or preparation for further clipping */ + clippingAntiAliasBits = 0; + } + } + if (!(((alphaR + alphaG) + alphaB) == 0.0)) { + targetWord = targetBits[pixelIndex]; + resultAlphaBits = targetWord & 0xFF000000U; + resultRBits = targetWord & 0xFF0000; + resultGBits = targetWord & 0xFF00; + resultBBits = targetWord & 0xFF; + + /* These if are not really needed. just ignore them if we use simd instructions. */ + targetAlpha = resultAlphaBits * (1.0 / (4.27819008e9)); + if (!(alphaR == 0.0)) { + unAlphaR = 1.0 - alphaR; + resultAlphaR = alphaR + (unAlphaR * targetAlpha); + + resultR = (alphaR * foreR) + ((unAlphaR * (resultRBits >> 16)) * targetAlpha); + resultRBits = (uint32_t)(resultR / resultAlphaR + 0.5) << 16; + } + if (!(alphaG == 0.0)) { + unAlphaG = 1.0 - alphaG; + resultAlphaG = alphaG + (unAlphaG * targetAlpha); + + resultG = (alphaG * foreG) + ((unAlphaG * (resultGBits >> 8)) * targetAlpha); + resultGBits = (uint32_t)(resultG / resultAlphaG + 0.5) << 8; + resultAlphaBits = (uint32_t)(resultAlphaG * 255.0 + 0.5) << 24; + } + if (!(alphaB == 0.0)) { + unAlphaB = 1.0 - alphaB; + resultAlphaB = alphaB + (unAlphaB * targetAlpha); + + resultB = (alphaB * foreB) + ((unAlphaB * resultBBits) * targetAlpha); + resultBBits = (uint32_t)(resultB / resultAlphaB + 0.5); + } + targetWord = ((resultAlphaBits | resultRBits) | resultGBits) | resultBBits; + targetBits[pixelIndex] = targetWord; + if (!(currentMorphId == 0)) { + morphIdWord = (((usqInt)(currentMorphId) << 8)) + clippingAntiAliasBits; + morphIds[pixelIndex] = morphIdWord; + } + } + return 0; +} + + +/* Inside the shape: Do an appropriate (anti aliased) gradient between stoke + color and fill color (or pick just stroke or just fill). + Blend this over + background. + WP: Whole pixel anti aliasing. + OT: Target ignored on input + and set to opaque on output. + For blending, alphas are in [0 .. 1.0] and + R, G, B color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeAndFillInsideWPOTAt:antiAliasAlphaByte: */ +static sqInt +blendStrokeAndFillInsideWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) +{ + float alpha; + float antiAliasAlpha; + float antiAliasUnAlpha; + float clippingAntiAlias; + uint32_t clippingAntiAliasBits; + float foreB; + float foreG; + float foreR; + uint32_t morphIdWord; + float resultB; + uint32_t resultBBits; + float resultG; + uint32_t resultGBits; + float resultR; + uint32_t resultRBits; + uint32_t targetWord; + float unAlpha; + + + /* 1.0/127.0 */ + antiAliasAlpha = antiAliasAlphaBits * 0.007874; + + /* We are inside the shape */ + antiAliasUnAlpha = 1.0 - antiAliasAlpha; + alpha = (antiAliasAlpha * strokeA) + (antiAliasUnAlpha * fillA); + foreR = (antiAliasAlpha * strokeR) + (antiAliasUnAlpha * fillR); + foreG = (antiAliasAlpha * strokeG) + (antiAliasUnAlpha * fillG); + foreB = (antiAliasAlpha * strokeB) + (antiAliasUnAlpha * fillB); + if (currentClipsSubmorphs) { + + /* Don't clip us, but do clip submorphs */ + /* We are inside the shape */ + clippingAntiAliasBits = 0x7F; + } + else { + if (clipCurrentMorph) { + + /* Clip ourselves to the border anti aliasing of the morph we are clipping at. Keep it for further use. */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + + /* 1.0/127.0 */ + clippingAntiAlias = clippingAntiAliasBits * 0.007874; + alpha = alpha * clippingAntiAlias; + } + else { + + /* Don't do any additional clipping or preparation for further clipping */ + clippingAntiAliasBits = 0; + } + } + if (!(alpha == 0.0)) { + targetWord = targetBits[pixelIndex]; + resultRBits = targetWord & 0xFF0000; + resultGBits = targetWord & 0xFF00; + resultBBits = targetWord & 0xFF; + unAlpha = 1.0 - alpha; + + resultR = (alpha * foreR) + (unAlpha * (resultRBits >> 16)); + resultRBits = (uint32_t)(resultR + 0.5) << 16; + resultG = (alpha * foreG) + (unAlpha * (resultGBits >> 8)); + resultGBits = (uint32_t)(resultG + 0.5) << 8; + resultB = (alpha * foreB) + (unAlpha * resultBBits); + resultBBits = (uint32_t)(resultB + 0.5); + targetWord = ((0xFF000000U | resultRBits) | resultGBits) | resultBBits; + targetBits[pixelIndex] = targetWord; + if (!(currentMorphId == 0)) { + morphIdWord = (((usqInt)(currentMorphId) << 8)) + clippingAntiAliasBits; + morphIds[pixelIndex] = morphIdWord; + } + } + return 0; +} + + +/* Outside the shape, but still in the stroke: Blend stroke color over + background. + WP: Whole pixel anti aliasing. + OT: Target ignored on input + and set to opaque on output. + For blending, alphas are in [0 .. 1.0] and + R, G, B color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeAndFillOutsideWPOTAt:antiAliasAlphaByte: */ +static sqInt +blendStrokeAndFillOutsideWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) +{ + float alpha; + float antiAliasAlpha; + float clippingAntiAlias; + uint32_t clippingAntiAliasBits; + float foreB; + float foreG; + float foreR; + uint32_t morphIdWord; + float resultB; + uint32_t resultBBits; + float resultG; + uint32_t resultGBits; + float resultR; + uint32_t resultRBits; + uint32_t targetWord; + float unAlpha; + + + /* 1.0/127.0 */ + /* In the stroke, outside the shape */ + antiAliasAlpha = antiAliasAlphaBits * 0.007874; + alpha = antiAliasAlpha * strokeA; + foreR = strokeR; + foreG = strokeG; + foreB = strokeB; + if (currentClipsSubmorphs) { + + /* Don't clip us, but do clip submorphs */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + if (antiAliasAlphaBits > clippingAntiAliasBits) { + clippingAntiAliasBits = antiAliasAlphaBits; + } + } + else { + if (clipCurrentMorph) { + + /* Clip ourselves to the border anti aliasing of the morph we are clipping at. Keep it for further use. */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + + /* 1.0/127.0 */ + clippingAntiAlias = clippingAntiAliasBits * 0.007874; + alpha = alpha * clippingAntiAlias; + } + else { + + /* Don't do any additional clipping or preparation for further clipping */ + clippingAntiAliasBits = 0; + } + } + if (!(alpha == 0.0)) { + targetWord = targetBits[pixelIndex]; + resultRBits = targetWord & 0xFF0000; + resultGBits = targetWord & 0xFF00; + resultBBits = targetWord & 0xFF; + unAlpha = 1.0 - alpha; + + resultR = (alpha * foreR) + (unAlpha * (resultRBits >> 16)); + resultRBits = (uint32_t)(resultR + 0.5) << 16; + resultG = (alpha * foreG) + (unAlpha * (resultGBits >> 8)); + resultGBits = (uint32_t)(resultG + 0.5) << 8; + resultB = (alpha * foreB) + (unAlpha * resultBBits); + resultBBits = (uint32_t)(resultB + 0.5); + targetWord = ((0xFF000000U | resultRBits) | resultGBits) | resultBBits; + targetBits[pixelIndex] = targetWord; + if (!(currentMorphId == 0)) { + morphIdWord = (((usqInt)(currentMorphId) << 8)) + clippingAntiAliasBits; + morphIds[pixelIndex] = morphIdWord; + } + } + return 0; +} + + +/* Blends stroke color over background. Target translucency computed + correctly. + For blending, alphas are in [0 .. 1.0] and R, G, B color + components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeOnlyAt:antiAliasAlphasWord: */ +static sqInt +blendStrokeOnlyAtantiAliasAlphasWord(sqInt pixelIndex, uint32_t antiAliasAlphasWord) +{ + float alphaB; + float alphaG; + float alphaR; + float antiAliasBlueAlpha; + uint32_t antiAliasBlueAlphaBits; + float antiAliasGreenAlpha; + uint32_t antiAliasGreenAlphaBits; + uint32_t antiAliasGreenAlphaBitsShifted; + float antiAliasRedAlpha; + uint32_t antiAliasRedAlphaBits; + float clippingAntiAlias; + uint32_t clippingAntiAliasBits; + uint32_t morphIdWord; + float resultAlphaB; + uint32_t resultAlphaBits; + float resultAlphaG; + float resultAlphaR; + float resultB; + uint32_t resultBBits; + float resultG; + uint32_t resultGBits; + float resultR; + uint32_t resultRBits; + float targetAlpha; + uint32_t targetWord; + float unAlphaB; + float unAlphaG; + float unAlphaR; + + antiAliasRedAlphaBits = antiAliasAlphasWord & 0x7F0000; + antiAliasGreenAlphaBits = antiAliasAlphasWord & 0x7F00; + antiAliasBlueAlphaBits = antiAliasAlphasWord & 0x7F; + antiAliasRedAlpha = antiAliasRedAlphaBits * (1.0 / (8.323072e6)); + antiAliasGreenAlpha = antiAliasGreenAlphaBits * (1.0 / (32512.0)); + antiAliasBlueAlpha = antiAliasBlueAlphaBits * (1.0 / 127.0); + alphaR = antiAliasRedAlpha * strokeA; + alphaG = antiAliasGreenAlpha * strokeA; + alphaB = antiAliasBlueAlpha * strokeA; + if (currentClipsSubmorphs) { + + /* Don't clip us, but do clip submorphs */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + + antiAliasGreenAlphaBitsShifted = antiAliasGreenAlphaBits >> 8; + if (antiAliasGreenAlphaBitsShifted > clippingAntiAliasBits) { + clippingAntiAliasBits = antiAliasGreenAlphaBitsShifted; + } + } + else { + if (clipCurrentMorph) { + + /* Clip ourselves to the border anti aliasing of the morph we are clipping at. Keep it for further use. */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + clippingAntiAlias = clippingAntiAliasBits * (1.0 / 127.0); + alphaR = alphaR * clippingAntiAlias; + alphaG = alphaG * clippingAntiAlias; + alphaB = alphaB * clippingAntiAlias; + } + else { + + /* Don't do any additional clipping or preparation for further clipping */ + clippingAntiAliasBits = 0; + } + } + if (!(((alphaR + alphaG) + alphaB) == 0.0)) { + targetWord = targetBits[pixelIndex]; + resultAlphaBits = targetWord & 0xFF000000U; + resultRBits = targetWord & 0xFF0000; + resultGBits = targetWord & 0xFF00; + resultBBits = targetWord & 0xFF; + + /* These if are not really needed. just ignore them if we use simd instructions. */ + targetAlpha = resultAlphaBits * (1.0 / (4.27819008e9)); + if (!(alphaR == 0.0)) { + unAlphaR = 1.0 - alphaR; + resultAlphaR = alphaR + (unAlphaR * targetAlpha); + + resultR = (alphaR * strokeR) + ((unAlphaR * (resultRBits >> 16)) * targetAlpha); + resultRBits = (uint32_t)(resultR / resultAlphaR + 0.5) << 16; + } + if (!(alphaG == 0.0)) { + unAlphaG = 1.0 - alphaG; + resultAlphaG = alphaG + (unAlphaG * targetAlpha); + + resultG = (alphaG * strokeG) + ((unAlphaG * (resultGBits >> 8)) * targetAlpha); + resultGBits = (uint32_t)(resultG / resultAlphaG + 0.5) << 8; + resultAlphaBits = (uint32_t)(resultAlphaG * 255.0 + 0.5) << 24; + } + if (!(alphaB == 0.0)) { + unAlphaB = 1.0 - alphaB; + resultAlphaB = alphaB + (unAlphaB * targetAlpha); + + resultB = (alphaB * strokeB) + ((unAlphaB * resultBBits) * targetAlpha); + resultBBits = (uint32_t)(resultB / resultAlphaB + 0.5); + } + targetWord = ((resultAlphaBits | resultRBits) | resultGBits) | resultBBits; + targetBits[pixelIndex] = targetWord; + if (!(currentMorphId == 0)) { + morphIdWord = (((usqInt)(currentMorphId) << 8)) + clippingAntiAliasBits; + morphIds[pixelIndex] = morphIdWord; + } + } + return 0; +} + + +/* Blends stroke color over background. + WP: Whole pixel anti aliasing. + OT: + Target ignored on input and set to opaque on output. + For blending, alphas + are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeOnlyWPOTAt:antiAliasAlphaByte: */ +static sqInt +blendStrokeOnlyWPOTAtantiAliasAlphaByte(sqInt pixelIndex, uint8_t antiAliasAlphaBits) +{ + float alpha; + float antiAliasAlpha; + float clippingAntiAlias; + uint32_t clippingAntiAliasBits; + uint32_t morphIdWord; + float resultB; + uint32_t resultBBits; + float resultG; + uint32_t resultGBits; + float resultR; + uint32_t resultRBits; + uint32_t targetWord; + float unAlpha; + + + /* 1.0/127.0 */ + antiAliasAlpha = antiAliasAlphaBits * 0.007874; + alpha = antiAliasAlpha * strokeA; + if (currentClipsSubmorphs) { + + /* Don't clip us, but do clip submorphs */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + if (antiAliasAlphaBits > clippingAntiAliasBits) { + clippingAntiAliasBits = antiAliasAlphaBits; + } + } + else { + if (clipCurrentMorph) { + + /* Clip ourselves to the border anti aliasing of the morph we are clipping at. Keep it for further use. */ + morphIdWord = morphIds[pixelIndex]; + clippingAntiAliasBits = morphIdWord & 0x7F; + + /* 1.0/127.0 */ + clippingAntiAlias = clippingAntiAliasBits * 0.007874; + alpha = alpha * clippingAntiAlias; + } + else { + + /* Don't do any additional clipping or preparation for further clipping */ + clippingAntiAliasBits = 0; + } + } + if (!(alpha == 0.0)) { + targetWord = targetBits[pixelIndex]; + resultRBits = targetWord & 0xFF0000; + resultGBits = targetWord & 0xFF00; + resultBBits = targetWord & 0xFF; + unAlpha = 1.0 - alpha; + + resultR = (alpha * strokeR) + (unAlpha * (resultRBits >> 16)); + resultRBits = (uint32_t)(resultR + 0.5) << 16; + resultG = (alpha * strokeG) + (unAlpha * (resultGBits >> 8)); + resultGBits = (uint32_t)(resultG + 0.5) << 8; + resultB = (alpha * strokeB) + (unAlpha * resultBBits); + resultBBits = (uint32_t)(resultB + 0.5); + targetWord = ((0xFF000000U | resultRBits) | resultGBits) | resultBBits; + targetBits[pixelIndex] = targetWord; + if (!(currentMorphId == 0)) { + morphIdWord = (((usqInt)(currentMorphId) << 8)) + clippingAntiAliasBits; + morphIds[pixelIndex] = morphIdWord; + } + } + return 0; +} + + +/* Note: This is hardcoded so it can be run from Squeak. + The module name is used for validating a module *after* + it is loaded to check if it does really contain the module + we're thinking it contains. This is important! */ + + /* InterpreterPlugin>>#getModuleName */ +EXPORT(const char*) +getModuleName(void) +{ + return moduleName; +} + + /* VectorEnginePlugin>>#initializeTrajectoryFragment */ +static sqInt +initializeTrajectoryFragment(void) +{ + prevYTruncated = 0x7FFFFFFF; + return 0; +} + + +/* + VectorEngineWithPlugin isPluginAvailable + Semantic version numbering in + a single SmallInteger: + Version numbers 1 to 99 are backwards compatible. + When incompatibility is needed. jump straight to 101. + Version numbers 101 + to 199 are backwards compatible. When incompatibility is needed. jump + straight to 201. + And so. + Note: this is Api version, not package version. + If no Api change, Api version doesn't change, regardless of changes in the + Plugin or Smalltalk code. + See senders and implementors. + + */ + + /* VectorEnginePlugin>>#pluginApiVersion */ +EXPORT(sqInt) +pluginApiVersion(void) +{ + sqInt _return_value; + + _return_value = integerObjectOf(5); + if (!(failed())) { + methodReturnValue(_return_value); + } + return null; +} + + /* VectorEnginePlugin>>#antiAliasingWidth:subPixelDelta:hopLength: */ +EXPORT(sqInt) +primAntiAliasingWidthsubPixelDeltaHopLength(void) +{ + double aFloat; + double anotherFloat; + double otherFloat; + + if (!((isFloatObject(stackValue(2))) + && ((isFloatObject(stackValue(1))) + && (isFloatObject(stackValue(0)))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aFloat = stackFloatValue(2); + otherFloat = stackFloatValue(1); + anotherFloat = stackFloatValue(0); + antiAliasingWidth = aFloat; + auxAntiAliasingWidthScaledInverse = 127.0 / aFloat; + subPixelDelta = otherFloat; + hop = anotherFloat; + if (!(failed())) { + pop(3); + } + return null; +} + + /* VectorEnginePlugin>>#arcCenterX:centerY:radiusX:radiusY:start:sweep:rotationCos:rotationSin:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primArc(void) +{ + float *aFloat32Array; + float angle; + unsigned *anotherWordArray; + double centerX; + double centerY; + float d; + sqInt h; + int hops; + unsigned *otherWordArray; + double radiusPointX; + double radiusPointY; + float scale; + double startAngle; + double sweepAngle; + float tcx; + float tcy; + float trx; + float try; + double tthetaCos; + double tthetaSin; + float x; + float xp; + float y; + float yp; + + if (!((isFloatObject(stackValue(10))) + && ((isFloatObject(stackValue(9))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + centerX = stackFloatValue(10); + centerY = stackFloatValue(9); + radiusPointX = stackFloatValue(8); + radiusPointY = stackFloatValue(7); + startAngle = stackFloatValue(6); + sweepAngle = stackFloatValue(5); + tthetaCos = stackFloatValue(4); + tthetaSin = stackFloatValue(3); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + tcx = ((centerX * txA11) + (centerY * txA12)) + txA13; + tcy = ((centerX * txA21) + (centerY * txA22)) + txA23; + scale = sqrt(txA11*txA11 + txA21*txA21); + trx = radiusPointX * scale; + try = radiusPointY * scale; + hops = (((sqInt)(((((trx < try) ? try : trx)) * (fabs(sweepAngle))) / hop))) + 2; + d = sweepAngle / hops; + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + contour = aFloat32Array; + angle = startAngle; + hops += 1; + for (h = 1; h <= hops; h += 1) { + xp = (cos(angle)) * trx; + yp = (sin(angle)) * try; + x = ((tthetaCos * xp) - (tthetaSin * yp)) + tcx; + y = ((tthetaSin * xp) + (tthetaCos * yp)) + tcy; + spanLeft = ((spanLeft < x) ? spanLeft : x); + spanTop = ((spanTop < y) ? spanTop : y); + spanRight = ((spanRight < x) ? x : spanRight); + spanBottom = ((spanBottom < y) ? y : spanBottom); + updateAlphasForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(x, y); + } + updateContourForXy(x, y); + angle += d; + } + if (!(failed())) { + pop(11); + } + return null; +} + + /* VectorEnginePlugin>>#arcWPCenterX:centerY:radiusX:radiusY:start:sweep:rotationCos:rotationSin:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primArcWP(void) +{ + float *aFloat32Array; + float angle; + char *anotherByteArray; + double centerX; + double centerY; + float d; + sqInt h; + int hops; + char *otherByteArray; + double radiusPointX; + double radiusPointY; + float scale; + double startAngle; + double sweepAngle; + float tcx; + float tcy; + float trx; + float try; + double tthetaCos; + double tthetaSin; + float x; + float xp; + float y; + float yp; + + if (!((isFloatObject(stackValue(10))) + && ((isFloatObject(stackValue(9))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isBytes(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + centerX = stackFloatValue(10); + centerY = stackFloatValue(9); + radiusPointX = stackFloatValue(8); + radiusPointY = stackFloatValue(7); + startAngle = stackFloatValue(6); + sweepAngle = stackFloatValue(5); + tthetaCos = stackFloatValue(4); + tthetaSin = stackFloatValue(3); + otherByteArray = ((char *) (firstIndexableField(stackValue(2)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + tcx = ((centerX * txA11) + (centerY * txA12)) + txA13; + tcy = ((centerX * txA21) + (centerY * txA22)) + txA23; + scale = sqrt(txA11*txA11 + txA21*txA21); + trx = radiusPointX * scale; + try = radiusPointY * scale; + hops = (((sqInt)(((((trx < try) ? try : trx)) * (fabs(sweepAngle))) / hop))) + 2; + d = sweepAngle / hops; + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + contour = aFloat32Array; + angle = startAngle; + hops += 1; + for (h = 1; h <= hops; h += 1) { + xp = (cos(angle)) * trx; + yp = (sin(angle)) * try; + x = ((tthetaCos * xp) - (tthetaSin * yp)) + tcx; + y = ((tthetaSin * xp) + (tthetaCos * yp)) + tcy; + spanLeft = ((spanLeft < x) ? spanLeft : x); + spanTop = ((spanTop < y) ? spanTop : y); + spanRight = ((spanRight < x) ? x : spanRight); + spanBottom = ((spanBottom < y) ? y : spanBottom); + updateAlphasWPForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(x, y); + } + updateContourForXy(x, y); + angle += d; + } + if (!(failed())) { + pop(11); + } + return null; +} + + +/* Blends fill color over background. Target translucency computed + correctly. + For blending, alphas are in [0 .. 1.0] and R, G, B color + components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendFillOnlyLeft:top:right:bottom:targetBits:morphIds:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primBlendFillOnly(void) +{ + unsigned *aBitmap; + unsigned *anotherWordArray; + uint32_t antiAliasAlphasWord; + unsigned *aWordArray; + sqInt b; + sqInt displayX; + sqInt displayY; + uint8_t edgesThisPixelB; + uint8_t edgesThisPixelG; + uint8_t edgesThisPixelR; + uint32_t edgesThisPixelWord; + uint8_t edgesUpToThisPixelB; + uint8_t edgesUpToThisPixelG; + uint8_t edgesUpToThisPixelR; + int isBlueInside; + int isGreenInside; + int isRedInside; + sqInt l; + unsigned *otherWordArray; + sqInt pixelIndex; + sqInt r; + sqInt t; + + if (!((isIntegerObject((l = stackValue(7)))) + && ((isIntegerObject((t = stackValue(6)))) + && ((isIntegerObject((r = stackValue(5)))) + && ((isIntegerObject((b = stackValue(4)))) + && ((isWords(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWords(stackValue(0))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + l = integerValueOf(l); + t = integerValueOf(t); + r = integerValueOf(r); + b = integerValueOf(b); + aBitmap = ((unsigned *) (firstIndexableField(stackValue(3)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(0)))); + targetBits = aBitmap; + morphIds = aWordArray; + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + for (displayY = t; displayY <= b; displayY += 1) { + edgesUpToThisPixelR = 0; + edgesUpToThisPixelG = 0; + edgesUpToThisPixelB = 0; + pixelIndex = ((displayY * targetWidth) + l) - 1; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + edgesThisPixelWord = edgeCounts[pixelIndex]; + if (!(edgesThisPixelWord == 0)) { + edgeCounts[pixelIndex] = 0; + } + + edgesThisPixelR = (uint32_t) (edgesThisPixelWord & 0xFF0000) >> 16; + edgesThisPixelG = (uint32_t) (edgesThisPixelWord & 0xFF00) >> 8; + edgesThisPixelB = (uint32_t) (edgesThisPixelWord & 0xFF); + edgesUpToThisPixelR += edgesThisPixelR; + edgesUpToThisPixelG += edgesThisPixelG; + + /* In C, integers already behave like booleans */ + edgesUpToThisPixelB += edgesThisPixelB; + + isRedInside = edgesUpToThisPixelR; + isGreenInside = edgesUpToThisPixelG; + isBlueInside = edgesUpToThisPixelB; + antiAliasAlphasWord = alphaMask[pixelIndex]; + if (antiAliasAlphasWord != 0) { + alphaMask[pixelIndex] = 0; + } + if ((antiAliasAlphasWord != 0) + || (isRedInside + || (isGreenInside + || (isBlueInside)))) { + blendFillOnlyAtredIsInsidegreenIsInsideblueIsInsideantiAliasAlphasWord(pixelIndex, isRedInside, isGreenInside, isBlueInside, antiAliasAlphasWord); + } + } + } + if (!(failed())) { + pop(8); + } + return null; +} + + +/* Blends fill color over background. + WP: Whole pixel anti aliasing. + OT: + Target ignored on input and set to opaque on output. + For blending, alphas + are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendFillOnlyWPOTLeft:top:right:bottom:targetBits:morphIds:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primBlendFillOnlyWPOT(void) +{ + unsigned *aBitmap; + char *anotherByteArray; + uint8_t antiAliasAlphaBits; + unsigned *aWordArray; + sqInt b; + sqInt displayX; + sqInt displayY; + uint8_t edgesThisPixel; + uint8_t edgesUpToThisPixel; + sqInt l; + char *otherByteArray; + sqInt pixelIndex; + sqInt r; + sqInt t; + + if (!((isIntegerObject((l = stackValue(7)))) + && ((isIntegerObject((t = stackValue(6)))) + && ((isIntegerObject((r = stackValue(5)))) + && ((isIntegerObject((b = stackValue(4)))) + && ((isWords(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isBytes(stackValue(0))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + l = integerValueOf(l); + t = integerValueOf(t); + r = integerValueOf(r); + b = integerValueOf(b); + aBitmap = ((unsigned *) (firstIndexableField(stackValue(3)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + otherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(0)))); + targetBits = aBitmap; + morphIds = aWordArray; + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + for (displayY = t; displayY <= b; displayY += 1) { + edgesUpToThisPixel = 0; + pixelIndex = ((displayY * targetWidth) + l) - 1; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + edgesThisPixel = edgeCountsWP[pixelIndex]; + if (!(edgesThisPixel == 0)) { + edgeCountsWP[pixelIndex] = 0; + edgesUpToThisPixel += edgesThisPixel; + } + antiAliasAlphaBits = alphaMaskWP[pixelIndex]; + if (edgesUpToThisPixel == 0) { + + /* Still in the anti aliasing area, but outside the shape, strictly speaking. */ + if (!(antiAliasAlphaBits == 0)) { + alphaMaskWP[pixelIndex] = 0; + blendFillOnlyWPOTAtantiAliasAlphaByte(pixelIndex, antiAliasAlphaBits); + } + } + else { + + /* Inside the shape */ + if (!(antiAliasAlphaBits == 0)) { + alphaMaskWP[pixelIndex] = 0; + } + antiAliasAlphaBits = 0x7F - antiAliasAlphaBits; + blendFillOnlyWPOTAtantiAliasAlphaByte(pixelIndex, antiAliasAlphaBits); + } + } + } + if (!(failed())) { + pop(8); + } + return null; +} + + +/* Blends stroke color and fill color over background. + Do an appropriate + (anti aliased) gradient between stoke color and fill color (or pick just + stroke or just fill). Blend this over background. + Target translucency + computed correctly. + For blending, alphas are in [0 .. 1.0] and R, G, B + color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeAndFillLeft:top:right:bottom:targetBits:morphIds:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primBlendStrokeAndFill(void) +{ + unsigned *aBitmap; + unsigned *anotherWordArray; + uint32_t antiAliasAlphasWord; + unsigned *aWordArray; + sqInt b; + sqInt displayX; + sqInt displayY; + uint8_t edgesThisPixelB; + uint8_t edgesThisPixelG; + uint8_t edgesThisPixelR; + uint32_t edgesThisPixelWord; + uint8_t edgesUpToThisPixelB; + uint8_t edgesUpToThisPixelG; + uint8_t edgesUpToThisPixelR; + int isBlueInside; + int isGreenInside; + int isRedInside; + sqInt l; + unsigned *otherWordArray; + sqInt pixelIndex; + sqInt r; + sqInt t; + + if (!((isIntegerObject((l = stackValue(7)))) + && ((isIntegerObject((t = stackValue(6)))) + && ((isIntegerObject((r = stackValue(5)))) + && ((isIntegerObject((b = stackValue(4)))) + && ((isWords(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWords(stackValue(0))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + l = integerValueOf(l); + t = integerValueOf(t); + r = integerValueOf(r); + b = integerValueOf(b); + aBitmap = ((unsigned *) (firstIndexableField(stackValue(3)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(0)))); + targetBits = aBitmap; + morphIds = aWordArray; + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + for (displayY = t; displayY <= b; displayY += 1) { + edgesUpToThisPixelR = 0; + edgesUpToThisPixelG = 0; + edgesUpToThisPixelB = 0; + pixelIndex = ((displayY * targetWidth) + l) - 1; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + edgesThisPixelWord = edgeCounts[pixelIndex]; + if (!(edgesThisPixelWord == 0)) { + edgeCounts[pixelIndex] = 0; + } + + edgesThisPixelR = (uint32_t) (edgesThisPixelWord & 0xFF0000) >> 16; + edgesThisPixelG = (uint32_t) (edgesThisPixelWord & 0xFF00) >> 8; + edgesThisPixelB = (uint32_t) (edgesThisPixelWord & 0xFF); + edgesUpToThisPixelR += edgesThisPixelR; + edgesUpToThisPixelG += edgesThisPixelG; + + /* In C, integers already behave like booleans */ + edgesUpToThisPixelB += edgesThisPixelB; + + isRedInside = edgesUpToThisPixelR; + isGreenInside = edgesUpToThisPixelG; + isBlueInside = edgesUpToThisPixelB; + antiAliasAlphasWord = alphaMask[pixelIndex]; + if (antiAliasAlphasWord != 0) { + alphaMask[pixelIndex] = 0; + } + if ((antiAliasAlphasWord != 0) + || (isRedInside + || (isGreenInside + || (isBlueInside)))) { + blendStrokeAndFillAtredIsInsidegreenIsInsideblueIsInsideantiAliasAlphasWord(pixelIndex, isRedInside, isGreenInside, isBlueInside, antiAliasAlphasWord); + } + } + } + if (!(failed())) { + pop(8); + } + return null; +} + + +/* Blends stroke color and fill color over background. + Do an appropriate + (anti aliased) gradient between stoke color and fill color (or pick just + stroke or just fill). Blend this over background. + WP: Whole pixel anti + aliasing. + OT: Target ignored on input and set to opaque on output. + For + blending, alphas are in [0 .. 1.0] and R, G, B color components are in [0 + .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeAndFillWPOTLeft:top:right:bottom:targetBits:morphIds:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primBlendStrokeAndFillWPOT(void) +{ + unsigned *aBitmap; + char *anotherByteArray; + uint8_t antiAliasAlphaBits; + unsigned *aWordArray; + sqInt b; + sqInt displayX; + sqInt displayY; + uint8_t edgesThisPixel; + uint8_t edgesUpToThisPixel; + sqInt l; + char *otherByteArray; + sqInt pixelIndex; + sqInt r; + sqInt t; + + if (!((isIntegerObject((l = stackValue(7)))) + && ((isIntegerObject((t = stackValue(6)))) + && ((isIntegerObject((r = stackValue(5)))) + && ((isIntegerObject((b = stackValue(4)))) + && ((isWords(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isBytes(stackValue(0))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + l = integerValueOf(l); + t = integerValueOf(t); + r = integerValueOf(r); + b = integerValueOf(b); + aBitmap = ((unsigned *) (firstIndexableField(stackValue(3)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + otherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(0)))); + targetBits = aBitmap; + morphIds = aWordArray; + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + for (displayY = t; displayY <= b; displayY += 1) { + edgesUpToThisPixel = 0; + pixelIndex = ((displayY * targetWidth) + l) - 1; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + edgesThisPixel = edgeCountsWP[pixelIndex]; + if (!(edgesThisPixel == 0)) { + edgeCountsWP[pixelIndex] = 0; + edgesUpToThisPixel += edgesThisPixel; + } + antiAliasAlphaBits = alphaMaskWP[pixelIndex]; + if (edgesUpToThisPixel == 0) { + + /* Still in the stroke, but outside the shape, strictly speaking. */ + if (!(antiAliasAlphaBits == 0)) { + alphaMaskWP[pixelIndex] = 0; + if (!(antiAliasAlphaBits == 0)) { + blendStrokeAndFillOutsideWPOTAtantiAliasAlphaByte(pixelIndex, antiAliasAlphaBits); + } + } + } + else { + + /* Inside the shape */ + if (!(antiAliasAlphaBits == 0)) { + alphaMaskWP[pixelIndex] = 0; + } + blendStrokeAndFillInsideWPOTAtantiAliasAlphaByte(pixelIndex, antiAliasAlphaBits); + } + } + } + if (!(failed())) { + pop(8); + } + return null; +} + + +/* Blends stroke color over background. Target translucency computed + correctly. + For blending, alphas are in [0 .. 1.0] and R, G, B color + components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeOnlyLeft:top:right:bottom:targetBits:morphIds:alphaMask: */ +EXPORT(sqInt) +primBlendStrokeOnly(void) +{ + unsigned *aBitmap; + unsigned *anotherWordArray; + uint32_t antiAliasAlphasWord; + unsigned *aWordArray; + sqInt b; + sqInt displayX; + sqInt displayY; + sqInt l; + sqInt pixelIndex; + sqInt r; + sqInt t; + + if (!((isIntegerObject((l = stackValue(6)))) + && ((isIntegerObject((t = stackValue(5)))) + && ((isIntegerObject((r = stackValue(4)))) + && ((isIntegerObject((b = stackValue(3)))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWords(stackValue(0)))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + l = integerValueOf(l); + t = integerValueOf(t); + r = integerValueOf(r); + b = integerValueOf(b); + aBitmap = ((unsigned *) (firstIndexableField(stackValue(2)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(0)))); + targetBits = aBitmap; + morphIds = aWordArray; + alphaMask = anotherWordArray; + for (displayY = t; displayY <= b; displayY += 1) { + pixelIndex = ((displayY * targetWidth) + l) - 1; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + antiAliasAlphasWord = alphaMask[pixelIndex]; + if (!(antiAliasAlphasWord == 0)) { + alphaMask[pixelIndex] = 0; + blendStrokeOnlyAtantiAliasAlphasWord(pixelIndex, antiAliasAlphasWord); + } + } + } + if (!(failed())) { + pop(7); + } + return null; +} + + +/* Blends stroke color over background. + WP: Whole pixel anti aliasing. + OT: + Target ignored on input and set to opaque on output. + For blending, alphas + are in [0 .. 1.0] and R, G, B color components are in [0 .. 255] + */ + + /* VectorEnginePlugin>>#blendStrokeOnlyWPOTLeft:top:right:bottom:targetBits:morphIds:alphaMask: */ +EXPORT(sqInt) +primBlendStrokeOnlyWPOT(void) +{ + unsigned *aBitmap; + char *anotherByteArray; + uint8_t antiAliasAlphaBits; + unsigned *aWordArray; + sqInt b; + sqInt displayX; + sqInt displayY; + sqInt l; + sqInt pixelIndex; + sqInt r; + sqInt t; + + if (!((isIntegerObject((l = stackValue(6)))) + && ((isIntegerObject((t = stackValue(5)))) + && ((isIntegerObject((r = stackValue(4)))) + && ((isIntegerObject((b = stackValue(3)))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isBytes(stackValue(0)))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + l = integerValueOf(l); + t = integerValueOf(t); + r = integerValueOf(r); + b = integerValueOf(b); + aBitmap = ((unsigned *) (firstIndexableField(stackValue(2)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(0)))); + targetBits = aBitmap; + morphIds = aWordArray; + alphaMaskWP = anotherByteArray; + for (displayY = t; displayY <= b; displayY += 1) { + pixelIndex = ((displayY * targetWidth) + l) - 1; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + antiAliasAlphaBits = alphaMaskWP[pixelIndex]; + if (!(antiAliasAlphaBits == 0)) { + + /* In the stroke */ + alphaMaskWP[pixelIndex] = 0; + blendStrokeOnlyWPOTAtantiAliasAlphaByte(pixelIndex, antiAliasAlphaBits); + } + } + } + if (!(failed())) { + pop(7); + } + return null; +} + + /* VectorEnginePlugin>>#clipCurrentMorph:morphIds: */ +EXPORT(sqInt) +primClipCurrentMorph(void) +{ + sqInt aBoolean; + unsigned *aWordArray; + sqInt displayX; + sqInt displayY; + sqInt pixelIndex; + + if (!((isBooleanObject(stackValue(1))) + && (isWords(stackValue(0))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aBoolean = booleanValueOf(stackValue(1)); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(0)))); + morphIds = aWordArray; + if (clipCurrentMorph + && (!aBoolean)) { + for (displayY = clipTop; displayY <= clipBottom; displayY += 1) { + pixelIndex = (displayY * targetWidth) + clipLeft; + for (displayX = clipLeft; displayX <= clipRight; displayX += 1) { + pixelIndex += 1; + morphIds[pixelIndex] = ((morphIds[pixelIndex]) & 0xFFFFFF00U); + } + } + } + clipCurrentMorph = aBoolean; + if (!(failed())) { + pop(2); + } + return null; +} + + /* VectorEnginePlugin>>#clipLeft:clipTop:clipRight:clipBottom: */ +EXPORT(sqInt) +primClipLeftclipTopclipRightclipBottom(void) +{ + sqInt b; + sqInt l; + sqInt r; + sqInt t; + + if (!((isIntegerObject((l = stackValue(3)))) + && ((isIntegerObject((t = stackValue(2)))) + && ((isIntegerObject((r = stackValue(1)))) + && (isIntegerObject((b = stackValue(0)))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + l = integerValueOf(l); + t = integerValueOf(t); + r = integerValueOf(r); + b = integerValueOf(b); + clipLeft = l; + clipTop = t; + clipRight = r; + clipBottom = b; + if (!(failed())) { + pop(4); + } + return null; +} + + /* VectorEnginePlugin>>#cubicBezierFromX:y:toX:y:control1X:y:control2X:y:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primCubicBezier(void) +{ + float *aFloat32Array; + unsigned *anotherWordArray; + unsigned *otherWordArray; + double xControl1; + double xControl2; + double xFrom; + double xTo; + double yControl1; + double yControl2; + double yFrom; + double yTo; + + if (!((isFloatObject(stackValue(10))) + && ((isFloatObject(stackValue(9))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + xFrom = stackFloatValue(10); + yFrom = stackFloatValue(9); + xTo = stackFloatValue(8); + yTo = stackFloatValue(7); + xControl1 = stackFloatValue(6); + yControl1 = stackFloatValue(5); + xControl2 = stackFloatValue(4); + yControl2 = stackFloatValue(3); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + contour = aFloat32Array; + pvt_cubicBezierFromXytoXycontrol1Xycontrol2Xy(xFrom, yFrom, xTo, yTo, xControl1, yControl1, xControl2, yControl2); + if (!(failed())) { + pop(11); + } + return null; +} + + /* VectorEnginePlugin>>#cubicBezierWPFromX:y:toX:y:control1X:y:control2X:y:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primCubicBezierWP(void) +{ + float *aFloat32Array; + char *anotherByteArray; + char *otherByteArray; + double xControl1; + double xControl2; + double xFrom; + double xTo; + double yControl1; + double yControl2; + double yFrom; + double yTo; + + if (!((isFloatObject(stackValue(10))) + && ((isFloatObject(stackValue(9))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isBytes(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + xFrom = stackFloatValue(10); + yFrom = stackFloatValue(9); + xTo = stackFloatValue(8); + yTo = stackFloatValue(7); + xControl1 = stackFloatValue(6); + yControl1 = stackFloatValue(5); + xControl2 = stackFloatValue(4); + yControl2 = stackFloatValue(3); + otherByteArray = ((char *) (firstIndexableField(stackValue(2)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + contour = aFloat32Array; + pvt_cubicBezierWPFromXytoXycontrol1Xycontrol2Xy(xFrom, yFrom, xTo, yTo, xControl1, yControl1, xControl2, yControl2); + if (!(failed())) { + pop(11); + } + return null; +} + + +/* Bound it someway to 31 or 32 bits (SmallInteger in 32 bits, or uint in 32 + bits, etc...) + */ + + /* VectorEnginePlugin>>#currentMorphId:currentClipsSubmorphs: */ +EXPORT(sqInt) +primCurrentMorphIdcurrentClipsSubmorphs(void) +{ + sqInt aBoolean; + sqInt aNumber; + + if (!((isIntegerObject((aNumber = stackValue(1)))) + && (isBooleanObject(stackValue(0))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aNumber = integerValueOf(aNumber); + aBoolean = booleanValueOf(stackValue(0)); + currentMorphId = aNumber; + if (currentMorphId == 0) { + clipCurrentMorph = 0; + } + currentClipsSubmorphs = aBoolean; + if (!(failed())) { + pop(2); + } + return null; +} + + /* VectorEnginePlugin>>#displayString:from:to:atx:y:scalex:y:contourData:contourDataIndexes:useST80Glyphs:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primDisplayString(void) +{ + sqInt aBoolean; + float advanceWidth; + unsigned *anotherWordArray; + double answer; + char *aString; + sqInt charIndex; + float *contourData; + int *contourDataIndexes; + float contourStartX; + float contourStartY; + float controlX; + float controlY; + float correction; + double destX; + double destY; + float dx; + float dy; + float endX; + float endY; + float f1; + float f2; + float f3; + int i; + sqInt idx; + sqInt idx2; + float increment; + uint8_t iso8859s15; + float length; + float nextGlyphX; + float nextGlyphY; + sqInt numBeziers; + sqInt numContours; + float oneLessT; + unsigned *otherWordArray; + sqInt startIndex; + float startX; + float startY; + sqInt stopIndex; + double sx; + double sy; + float t; + float t0; + float ttControlX; + float ttControlY; + float ttEndX; + float ttEndY; + float ttMoveToX; + float ttMoveToY; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + sqInt _return_value; + + if (!((isBytes(stackValue(11))) + && ((isIntegerObject((startIndex = stackValue(10)))) + && ((isIntegerObject((stopIndex = stackValue(9)))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isWordsOrBytes(stackValue(4))) + && ((isWords(stackValue(3))) + && ((isBooleanObject(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWords(stackValue(0))))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aString = ((char *) (firstIndexableField(stackValue(11)))); + startIndex = integerValueOf(startIndex); + stopIndex = integerValueOf(stopIndex); + destX = stackFloatValue(8); + destY = stackFloatValue(7); + sx = stackFloatValue(6); + sy = stackFloatValue(5); + contourData = ((float *) (firstIndexableField(stackValue(4)))); + contourDataIndexes = ((int *) (firstIndexableField(stackValue(3)))); + aBoolean = booleanValueOf(stackValue(2)); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(0)))); + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + txA11 = txA11 * sx; + txA12 = txA12 * sy; + txA21 = txA21 * sx; + txA22 = txA22 * sy; + nextGlyphX = destX / sx; + nextGlyphY = destY / sy; + for (charIndex = (startIndex - 1); charIndex < stopIndex; charIndex += 1) { + iso8859s15 = aString[charIndex]; + if (aBoolean) { + if (iso8859s15 == 95) { + iso8859s15 = 28; + } + if (iso8859s15 == 94) { + iso8859s15 = 30; + } + } + i = contourDataIndexes[iso8859s15]; + i -= 1; + advanceWidth = contourData[i]; + i += 5; + numContours = ((sqInt)(contourData[i])); + i += 1; + for (idx = 1; idx <= numContours; idx += 1) { + numBeziers = ((sqInt)(contourData[i])); + i += 1; + ttMoveToX = (contourData[i]) + nextGlyphX; + i += 1; + ttMoveToY = (contourData[i]) + nextGlyphY; + i += 1; + startX = ((ttMoveToX * txA11) + (ttMoveToY * txA12)) + txA13; + startY = ((ttMoveToX * txA21) + (ttMoveToY * txA22)) + txA23; + contourStartX = startX; + contourStartY = startY; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + for (idx2 = 1; idx2 <= numBeziers; idx2 += 1) { + ttEndX = contourData[i]; + i += 1; + ttEndY = contourData[i]; + i += 1; + ttControlX = contourData[i]; + i += 1; + ttControlY = contourData[i]; + i += 1; + endX = ((ttEndX * txA11) + (ttEndY * txA12)) + startX; + endY = ((ttEndX * txA21) + (ttEndY * txA22)) + startY; + controlX = ((ttControlX * txA11) + (ttControlY * txA12)) + startX; + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + controlY = ((ttControlX * txA21) + (ttControlY * txA22)) + startY; + xMinEnd = ((startX < endX) ? startX : endX); + xMaxEnd = ((startX < endX) ? endX : startX); + yMinEnd = ((startY < endY) ? startY : endY); + yMaxEnd = ((startY < endY) ? endY : startY); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))); + + /* Compute Quadratic Bezier Curve, */ + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd)) : spanBottom); + x = startX; + y = startY; + updateAlphasForXy(x, y); + updateEdgeCountAtXy(x, y); + dx = fabs(endX-startX); dy = fabs(endY-startY); + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point */ + y0 = y; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasForXy(x, y); + updateEdgeCountAtXy(x, y); + } + startX = endX; + startY = endY; + } + updateAlphasForXy(endX, endY); + updateEdgeCountAtXy(endX, endY); + updateEdgeCountAtXy(contourStartX, contourStartY); + } + nextGlyphX += advanceWidth; + } + txA11 = txA11 / sx; + txA12 = txA12 / sy; + txA21 = txA21 / sx; + txA22 = txA22 / sy; + answer = nextGlyphX * sx; + if (!(failed())) { + _return_value = floatObjectOf(answer); + if (!(failed())) { + methodReturnValue(_return_value); + } + } + return null; +} + + /* VectorEnginePlugin>>#displayStringWP:from:to:atx:y:scalex:y:contourData:contourDataIndexes:useST80Glyphs:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primDisplayStringWP(void) +{ + sqInt aBoolean; + float advanceWidth; + char *anotherByteArray; + double answer; + char *aString; + sqInt charIndex; + float *contourData; + int *contourDataIndexes; + float contourStartX; + float contourStartY; + float controlX; + float controlY; + float correction; + double destX; + double destY; + float dx; + float dy; + float endX; + float endY; + float f1; + float f2; + float f3; + int i; + sqInt idx; + sqInt idx2; + float increment; + uint8_t iso8859s15; + float length; + float nextGlyphX; + float nextGlyphY; + sqInt numBeziers; + sqInt numContours; + float oneLessT; + char *otherByteArray; + sqInt startIndex; + float startX; + float startY; + sqInt stopIndex; + double sx; + double sy; + float t; + float t0; + float ttControlX; + float ttControlY; + float ttEndX; + float ttEndY; + float ttMoveToX; + float ttMoveToY; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + sqInt _return_value; + + if (!((isBytes(stackValue(11))) + && ((isIntegerObject((startIndex = stackValue(10)))) + && ((isIntegerObject((stopIndex = stackValue(9)))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isWordsOrBytes(stackValue(4))) + && ((isWords(stackValue(3))) + && ((isBooleanObject(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isBytes(stackValue(0))))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aString = ((char *) (firstIndexableField(stackValue(11)))); + startIndex = integerValueOf(startIndex); + stopIndex = integerValueOf(stopIndex); + destX = stackFloatValue(8); + destY = stackFloatValue(7); + sx = stackFloatValue(6); + sy = stackFloatValue(5); + contourData = ((float *) (firstIndexableField(stackValue(4)))); + contourDataIndexes = ((int *) (firstIndexableField(stackValue(3)))); + aBoolean = booleanValueOf(stackValue(2)); + otherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(0)))); + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + txA11 = txA11 * sx; + txA12 = txA12 * sy; + txA21 = txA21 * sx; + txA22 = txA22 * sy; + nextGlyphX = destX / sx; + nextGlyphY = destY / sy; + for (charIndex = (startIndex - 1); charIndex < stopIndex; charIndex += 1) { + iso8859s15 = aString[charIndex]; + if (aBoolean) { + if (iso8859s15 == 95) { + iso8859s15 = 28; + } + if (iso8859s15 == 94) { + iso8859s15 = 30; + } + } + i = contourDataIndexes[iso8859s15]; + i -= 1; + advanceWidth = contourData[i]; + i += 5; + numContours = ((sqInt)(contourData[i])); + i += 1; + for (idx = 1; idx <= numContours; idx += 1) { + numBeziers = ((sqInt)(contourData[i])); + i += 1; + ttMoveToX = (contourData[i]) + nextGlyphX; + i += 1; + ttMoveToY = (contourData[i]) + nextGlyphY; + i += 1; + startX = ((ttMoveToX * txA11) + (ttMoveToY * txA12)) + txA13; + startY = ((ttMoveToX * txA21) + (ttMoveToY * txA22)) + txA23; + contourStartX = startX; + contourStartY = startY; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + for (idx2 = 1; idx2 <= numBeziers; idx2 += 1) { + ttEndX = contourData[i]; + i += 1; + ttEndY = contourData[i]; + i += 1; + ttControlX = contourData[i]; + i += 1; + ttControlY = contourData[i]; + i += 1; + endX = ((ttEndX * txA11) + (ttEndY * txA12)) + startX; + endY = ((ttEndX * txA21) + (ttEndY * txA22)) + startY; + controlX = ((ttControlX * txA11) + (ttControlY * txA12)) + startX; + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + controlY = ((ttControlX * txA21) + (ttControlY * txA22)) + startY; + xMinEnd = ((startX < endX) ? startX : endX); + xMaxEnd = ((startX < endX) ? endX : startX); + yMinEnd = ((startY < endY) ? startY : endY); + yMaxEnd = ((startY < endY) ? endY : startY); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))); + + /* Compute Quadratic Bezier Curve, */ + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd)) : spanBottom); + x = startX; + y = startY; + updateAlphasWPZeroStrokeForXy(x, y); + updateEdgeCountWPAtXy(x, y); + dx = fabs(endX-startX); dy = fabs(endY-startY); + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point */ + y0 = y; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasWPZeroStrokeForXy(x, y); + updateEdgeCountWPAtXy(x, y); + } + startX = endX; + startY = endY; + } + updateAlphasWPZeroStrokeForXy(endX, endY); + updateEdgeCountWPAtXy(endX, endY); + updateEdgeCountWPAtXy(contourStartX, contourStartY); + } + nextGlyphX += advanceWidth; + } + txA11 = txA11 / sx; + txA12 = txA12 / sy; + txA21 = txA21 / sx; + txA22 = txA22 / sy; + answer = nextGlyphX * sx; + if (!(failed())) { + _return_value = floatObjectOf(answer); + if (!(failed())) { + methodReturnValue(_return_value); + } + } + return null; +} + + /* VectorEnginePlugin>>#displayUtf32:from:to:atx:y:scalex:y:contourData:contourDataIndexes:useST80Glyphs:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primDisplayUtf32(void) +{ + sqInt aBoolean; + float advanceWidth; + unsigned *anotherWordArray; + double answer; + unsigned *aWordArray; + float *contourData; + int *contourDataIndexes; + float contourStartX; + float contourStartY; + float controlX; + float controlY; + float correction; + double destX; + double destY; + float dx; + float dy; + float endX; + float endY; + float f1; + float f2; + float f3; + int i; + sqInt idx; + sqInt idx2; + float increment; + float length; + float nextGlyphX; + float nextGlyphY; + sqInt numBeziers; + sqInt numContours; + float oneLessT; + unsigned *otherWordArray; + sqInt startIndex; + float startX; + float startY; + sqInt stopIndex; + double sx; + double sy; + float t; + float t0; + float ttControlX; + float ttControlY; + float ttEndX; + float ttEndY; + float ttMoveToX; + float ttMoveToY; + unsigned utf32; + sqInt utf32Index; + unsigned utf8Byte; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + sqInt _return_value; + + if (!((isWords(stackValue(11))) + && ((isIntegerObject((startIndex = stackValue(10)))) + && ((isIntegerObject((stopIndex = stackValue(9)))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isWordsOrBytes(stackValue(4))) + && ((isWords(stackValue(3))) + && ((isBooleanObject(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWords(stackValue(0))))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aWordArray = ((unsigned *) (firstIndexableField(stackValue(11)))); + startIndex = integerValueOf(startIndex); + stopIndex = integerValueOf(stopIndex); + destX = stackFloatValue(8); + destY = stackFloatValue(7); + sx = stackFloatValue(6); + sy = stackFloatValue(5); + contourData = ((float *) (firstIndexableField(stackValue(4)))); + contourDataIndexes = ((int *) (firstIndexableField(stackValue(3)))); + aBoolean = booleanValueOf(stackValue(2)); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(0)))); + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + txA11 = txA11 * sx; + txA12 = txA12 * sy; + txA21 = txA21 * sx; + txA22 = txA22 * sy; + nextGlyphX = destX / sx; + nextGlyphY = destY / sy; + for (utf32Index = (startIndex - 1); utf32Index < stopIndex; utf32Index += 1) { + utf32 = aWordArray[utf32Index]; + if (aBoolean) { + if (utf32 == 95) { + utf32 = 8592; + } + if (utf32 == 94) { + utf32 = 8593; + } + } + if (utf32 <= 0x7F) { + utf8Byte = utf32; + i = contourDataIndexes[utf8Byte]; + } + else { + if (utf32 <= 0x7FF) { + utf8Byte = ((((usqInt)(utf32)) >> 6)) | 192; + i = contourDataIndexes[utf8Byte]; + utf8Byte = (utf32 & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + } + else { + if (utf32 <= 0xFFFF) { + utf8Byte = ((((usqInt)(utf32)) >> 12)) | 224; + i = contourDataIndexes[utf8Byte]; + utf8Byte = (((((usqInt)(utf32)) >> 6)) & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + utf8Byte = (utf32 & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + } + else { + utf8Byte = ((((usqInt)(utf32)) >> 18)) | 240; + i = contourDataIndexes[utf8Byte]; + utf8Byte = (((((usqInt)(utf32)) >> 12)) & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + utf8Byte = (((((usqInt)(utf32)) >> 6)) & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + utf8Byte = (utf32 & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + } + } + } + i -= 1; + advanceWidth = contourData[i]; + i += 5; + numContours = ((sqInt)(contourData[i])); + i += 1; + for (idx = 1; idx <= numContours; idx += 1) { + numBeziers = ((sqInt)(contourData[i])); + i += 1; + ttMoveToX = (contourData[i]) + nextGlyphX; + i += 1; + ttMoveToY = (contourData[i]) + nextGlyphY; + i += 1; + startX = ((ttMoveToX * txA11) + (ttMoveToY * txA12)) + txA13; + startY = ((ttMoveToX * txA21) + (ttMoveToY * txA22)) + txA23; + contourStartX = startX; + contourStartY = startY; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + for (idx2 = 1; idx2 <= numBeziers; idx2 += 1) { + ttEndX = contourData[i]; + i += 1; + ttEndY = contourData[i]; + i += 1; + ttControlX = contourData[i]; + i += 1; + ttControlY = contourData[i]; + i += 1; + endX = ((ttEndX * txA11) + (ttEndY * txA12)) + startX; + endY = ((ttEndX * txA21) + (ttEndY * txA22)) + startY; + controlX = ((ttControlX * txA11) + (ttControlY * txA12)) + startX; + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + controlY = ((ttControlX * txA21) + (ttControlY * txA22)) + startY; + xMinEnd = ((startX < endX) ? startX : endX); + xMaxEnd = ((startX < endX) ? endX : startX); + yMinEnd = ((startY < endY) ? startY : endY); + yMaxEnd = ((startY < endY) ? endY : startY); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))); + + /* Compute Quadratic Bezier Curve, */ + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd)) : spanBottom); + x = startX; + y = startY; + updateAlphasForXy(x, y); + updateEdgeCountAtXy(x, y); + dx = fabs(endX-startX); dy = fabs(endY-startY); + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point. Only C version to avoid hitting a limit in Smalltalk compiler. */ + y0 = y; + + t = t0 + increment; oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; f2 = 2.0 * oneLessT * t; f3 = t * t; + x = (f1 * startX) + (f2 * controlX) + (f3 * endX); + y = (f1 * startY) + (f2 * controlY) + (f3 * endY); + dx = x-x0; dy = y-y0; + length = sqrt(dx*dx + dy*dy); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasForXy(x, y); + updateEdgeCountAtXy(x, y); + } + startX = endX; + startY = endY; + } + updateAlphasForXy(endX, endY); + updateEdgeCountAtXy(endX, endY); + updateEdgeCountAtXy(contourStartX, contourStartY); + } + nextGlyphX += advanceWidth; + } + txA11 = txA11 / sx; + txA12 = txA12 / sy; + txA21 = txA21 / sx; + txA22 = txA22 / sy; + answer = nextGlyphX * sx; + if (!(failed())) { + _return_value = floatObjectOf(answer); + if (!(failed())) { + methodReturnValue(_return_value); + } + } + return null; +} + + /* VectorEnginePlugin>>#displayUtf32WP:from:to:atx:y:scalex:y:contourData:contourDataIndexes:useST80Glyphs:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primDisplayUtf32WP(void) +{ + sqInt aBoolean; + float advanceWidth; + char *anotherByteArray; + double answer; + unsigned *aWordArray; + float *contourData; + int *contourDataIndexes; + float contourStartX; + float contourStartY; + float controlX; + float controlY; + float correction; + double destX; + double destY; + float dx; + float dy; + float endX; + float endY; + float f1; + float f2; + float f3; + int i; + sqInt idx; + sqInt idx2; + float increment; + float length; + float nextGlyphX; + float nextGlyphY; + sqInt numBeziers; + sqInt numContours; + float oneLessT; + char *otherByteArray; + sqInt startIndex; + float startX; + float startY; + sqInt stopIndex; + double sx; + double sy; + float t; + float t0; + float ttControlX; + float ttControlY; + float ttEndX; + float ttEndY; + float ttMoveToX; + float ttMoveToY; + unsigned utf32; + sqInt utf32Index; + unsigned utf8Byte; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + sqInt _return_value; + + if (!((isWords(stackValue(11))) + && ((isIntegerObject((startIndex = stackValue(10)))) + && ((isIntegerObject((stopIndex = stackValue(9)))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isWordsOrBytes(stackValue(4))) + && ((isWords(stackValue(3))) + && ((isBooleanObject(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isBytes(stackValue(0))))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aWordArray = ((unsigned *) (firstIndexableField(stackValue(11)))); + startIndex = integerValueOf(startIndex); + stopIndex = integerValueOf(stopIndex); + destX = stackFloatValue(8); + destY = stackFloatValue(7); + sx = stackFloatValue(6); + sy = stackFloatValue(5); + contourData = ((float *) (firstIndexableField(stackValue(4)))); + contourDataIndexes = ((int *) (firstIndexableField(stackValue(3)))); + aBoolean = booleanValueOf(stackValue(2)); + otherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(0)))); + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + txA11 = txA11 * sx; + txA12 = txA12 * sy; + txA21 = txA21 * sx; + txA22 = txA22 * sy; + nextGlyphX = destX / sx; + nextGlyphY = destY / sy; + for (utf32Index = (startIndex - 1); utf32Index < stopIndex; utf32Index += 1) { + utf32 = aWordArray[utf32Index]; + if (aBoolean) { + if (utf32 == 95) { + utf32 = 8592; + } + if (utf32 == 94) { + utf32 = 8593; + } + } + if (utf32 <= 0x7F) { + utf8Byte = utf32; + i = contourDataIndexes[utf8Byte]; + } + else { + if (utf32 <= 0x7FF) { + utf8Byte = ((((usqInt)(utf32)) >> 6)) | 192; + i = contourDataIndexes[utf8Byte]; + utf8Byte = (utf32 & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + } + else { + if (utf32 <= 0xFFFF) { + utf8Byte = ((((usqInt)(utf32)) >> 12)) | 224; + i = contourDataIndexes[utf8Byte]; + utf8Byte = (((((usqInt)(utf32)) >> 6)) & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + utf8Byte = (utf32 & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + } + else { + utf8Byte = ((((usqInt)(utf32)) >> 18)) | 240; + i = contourDataIndexes[utf8Byte]; + utf8Byte = (((((usqInt)(utf32)) >> 12)) & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + utf8Byte = (((((usqInt)(utf32)) >> 6)) & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + utf8Byte = (utf32 & 0x3F) | 128; + i = contourDataIndexes[utf8Byte - i]; + } + } + } + i -= 1; + advanceWidth = contourData[i]; + i += 5; + numContours = ((sqInt)(contourData[i])); + i += 1; + for (idx = 1; idx <= numContours; idx += 1) { + numBeziers = ((sqInt)(contourData[i])); + i += 1; + ttMoveToX = (contourData[i]) + nextGlyphX; + i += 1; + ttMoveToY = (contourData[i]) + nextGlyphY; + i += 1; + startX = ((ttMoveToX * txA11) + (ttMoveToY * txA12)) + txA13; + startY = ((ttMoveToX * txA21) + (ttMoveToY * txA22)) + txA23; + contourStartX = startX; + contourStartY = startY; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + for (idx2 = 1; idx2 <= numBeziers; idx2 += 1) { + ttEndX = contourData[i]; + i += 1; + ttEndY = contourData[i]; + i += 1; + ttControlX = contourData[i]; + i += 1; + ttControlY = contourData[i]; + i += 1; + endX = ((ttEndX * txA11) + (ttEndY * txA12)) + startX; + endY = ((ttEndX * txA21) + (ttEndY * txA22)) + startY; + controlX = ((ttControlX * txA11) + (ttControlY * txA12)) + startX; + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + controlY = ((ttControlX * txA21) + (ttControlY * txA22)) + startY; + xMinEnd = ((startX < endX) ? startX : endX); + xMaxEnd = ((startX < endX) ? endX : startX); + yMinEnd = ((startY < endY) ? startY : endY); + yMaxEnd = ((startY < endY) ? endY : startY); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))); + + /* Compute Quadratic Bezier Curve, */ + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd)) : spanBottom); + x = startX; + y = startY; + updateAlphasWPZeroStrokeForXy(x, y); + updateEdgeCountWPAtXy(x, y); + dx = fabs(endX-startX); dy = fabs(endY-startY); + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point. Only C version to avoid hitting a limit in Smalltalk compiler. */ + y0 = y; + + t = t0 + increment; oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; f2 = 2.0 * oneLessT * t; f3 = t * t; + x = (f1 * startX) + (f2 * controlX) + (f3 * endX); + y = (f1 * startY) + (f2 * controlY) + (f3 * endY); + dx = x-x0; dy = y-y0; + length = sqrt(dx*dx + dy*dy); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasWPZeroStrokeForXy(x, y); + updateEdgeCountWPAtXy(x, y); + } + startX = endX; + startY = endY; + } + updateAlphasWPZeroStrokeForXy(endX, endY); + updateEdgeCountWPAtXy(endX, endY); + updateEdgeCountWPAtXy(contourStartX, contourStartY); + } + nextGlyphX += advanceWidth; + } + txA11 = txA11 / sx; + txA12 = txA12 / sy; + txA21 = txA21 / sx; + txA22 = txA22 / sy; + answer = nextGlyphX * sx; + if (!(failed())) { + _return_value = floatObjectOf(answer); + if (!(failed())) { + methodReturnValue(_return_value); + } + } + return null; +} + + /* VectorEnginePlugin>>#displayUtf8:fromByte:toByte:atx:y:scalex:y:contourData:contourDataIndexes:useST80Glyphs:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primDisplayUtf8(void) +{ + sqInt aBoolean; + char *aByteArray; + float advanceWidth; + unsigned *anotherWordArray; + double answer; + int baseIndex; + uint8_t byte; + sqInt byteIndex; + sqInt byteStartIndex; + sqInt byteStopIndex; + float *contourData; + int *contourDataIndexes; + float contourStartX; + float contourStartY; + float controlX; + float controlY; + float correction; + double destX; + double destY; + float dx; + float dy; + float endX; + float endY; + float f1; + float f2; + float f3; + int i; + sqInt idx; + sqInt idx2; + float increment; + float length; + float nextGlyphX; + float nextGlyphY; + sqInt numBeziers; + sqInt numContours; + float oneLessT; + unsigned *otherWordArray; + float startX; + float startY; + double sx; + double sy; + float t; + float t0; + float ttControlX; + float ttControlY; + float ttEndX; + float ttEndY; + float ttMoveToX; + float ttMoveToY; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + sqInt _return_value; + + if (!((isBytes(stackValue(11))) + && ((isIntegerObject((byteStartIndex = stackValue(10)))) + && ((isIntegerObject((byteStopIndex = stackValue(9)))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isWordsOrBytes(stackValue(4))) + && ((isWords(stackValue(3))) + && ((isBooleanObject(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWords(stackValue(0))))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aByteArray = ((char *) (firstIndexableField(stackValue(11)))); + byteStartIndex = integerValueOf(byteStartIndex); + byteStopIndex = integerValueOf(byteStopIndex); + destX = stackFloatValue(8); + destY = stackFloatValue(7); + sx = stackFloatValue(6); + sy = stackFloatValue(5); + contourData = ((float *) (firstIndexableField(stackValue(4)))); + contourDataIndexes = ((int *) (firstIndexableField(stackValue(3)))); + aBoolean = booleanValueOf(stackValue(2)); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(0)))); + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + txA11 = txA11 * sx; + txA12 = txA12 * sy; + txA21 = txA21 * sx; + txA22 = txA22 * sy; + nextGlyphX = destX / sx; + nextGlyphY = destY / sy; + baseIndex = 0; + for (byteIndex = (byteStartIndex - 1); byteIndex < byteStopIndex; byteIndex += 1) { + byte = aByteArray[byteIndex]; + i = contourDataIndexes[baseIndex + byte]; + if (aBoolean) { + if (byte == 95) { + i = contourDataIndexes[226]; + i = contourDataIndexes[134 - i]; + i = contourDataIndexes[144 - i]; + } + if (byte == 94) { + i = contourDataIndexes[226]; + i = contourDataIndexes[134 - i]; + i = contourDataIndexes[145 - i]; + } + } + if (i < 0) { + baseIndex = 0 - i; + } + else { + i -= 1; + advanceWidth = contourData[i]; + i += 5; + numContours = ((sqInt)(contourData[i])); + i += 1; + for (idx = 1; idx <= numContours; idx += 1) { + numBeziers = ((sqInt)(contourData[i])); + i += 1; + ttMoveToX = (contourData[i]) + nextGlyphX; + i += 1; + ttMoveToY = (contourData[i]) + nextGlyphY; + i += 1; + startX = ((ttMoveToX * txA11) + (ttMoveToY * txA12)) + txA13; + startY = ((ttMoveToX * txA21) + (ttMoveToY * txA22)) + txA23; + contourStartX = startX; + contourStartY = startY; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + for (idx2 = 1; idx2 <= numBeziers; idx2 += 1) { + ttEndX = contourData[i]; + i += 1; + ttEndY = contourData[i]; + i += 1; + ttControlX = contourData[i]; + i += 1; + ttControlY = contourData[i]; + i += 1; + endX = ((ttEndX * txA11) + (ttEndY * txA12)) + startX; + endY = ((ttEndX * txA21) + (ttEndY * txA22)) + startY; + controlX = ((ttControlX * txA11) + (ttControlY * txA12)) + startX; + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + controlY = ((ttControlX * txA21) + (ttControlY * txA22)) + startY; + xMinEnd = ((startX < endX) ? startX : endX); + xMaxEnd = ((startX < endX) ? endX : startX); + yMinEnd = ((startY < endY) ? startY : endY); + yMaxEnd = ((startY < endY) ? endY : startY); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))); + + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd)) : spanBottom); + x = startX; + y = startY; + updateAlphasForXy(x, y); + updateEdgeCountAtXy(x, y); + dx = fabs(endX-startX); dy = fabs(endY-startY); + + /* Compute Quadratic Bezier Curve, */ + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point */ + y0 = y; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasForXy(x, y); + updateEdgeCountAtXy(x, y); + } + startX = endX; + startY = endY; + } + updateAlphasForXy(endX, endY); + updateEdgeCountAtXy(endX, endY); + updateEdgeCountAtXy(contourStartX, contourStartY); + } + nextGlyphX += advanceWidth; + baseIndex = 0; + } + } + txA11 = txA11 / sx; + txA12 = txA12 / sy; + txA21 = txA21 / sx; + txA22 = txA22 / sy; + answer = nextGlyphX * sx; + if (!(failed())) { + _return_value = floatObjectOf(answer); + if (!(failed())) { + methodReturnValue(_return_value); + } + } + return null; +} + + /* VectorEnginePlugin>>#displayUtf8WP:fromByte:toByte:atx:y:scalex:y:contourData:contourDataIndexes:useST80Glyphs:edgeCounts:alphaMask: */ +EXPORT(sqInt) +primDisplayUtf8WP(void) +{ + sqInt aBoolean; + char *aByteArray; + float advanceWidth; + char *anotherByteArray; + double answer; + int baseIndex; + uint8_t byte; + sqInt byteIndex; + sqInt byteStartIndex; + sqInt byteStopIndex; + float *contourData; + int *contourDataIndexes; + float contourStartX; + float contourStartY; + float controlX; + float controlY; + float correction; + double destX; + double destY; + float dx; + float dy; + float endX; + float endY; + float f1; + float f2; + float f3; + int i; + sqInt idx; + sqInt idx2; + float increment; + float length; + float nextGlyphX; + float nextGlyphY; + sqInt numBeziers; + sqInt numContours; + float oneLessT; + char *otherByteArray; + float startX; + float startY; + double sx; + double sy; + float t; + float t0; + float ttControlX; + float ttControlY; + float ttEndX; + float ttEndY; + float ttMoveToX; + float ttMoveToY; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + sqInt _return_value; + + if (!((isBytes(stackValue(11))) + && ((isIntegerObject((byteStartIndex = stackValue(10)))) + && ((isIntegerObject((byteStopIndex = stackValue(9)))) + && ((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isWordsOrBytes(stackValue(4))) + && ((isWords(stackValue(3))) + && ((isBooleanObject(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isBytes(stackValue(0))))))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aByteArray = ((char *) (firstIndexableField(stackValue(11)))); + byteStartIndex = integerValueOf(byteStartIndex); + byteStopIndex = integerValueOf(byteStopIndex); + destX = stackFloatValue(8); + destY = stackFloatValue(7); + sx = stackFloatValue(6); + sy = stackFloatValue(5); + contourData = ((float *) (firstIndexableField(stackValue(4)))); + contourDataIndexes = ((int *) (firstIndexableField(stackValue(3)))); + aBoolean = booleanValueOf(stackValue(2)); + otherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(0)))); + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + txA11 = txA11 * sx; + txA12 = txA12 * sy; + txA21 = txA21 * sx; + txA22 = txA22 * sy; + nextGlyphX = destX / sx; + nextGlyphY = destY / sy; + baseIndex = 0; + for (byteIndex = (byteStartIndex - 1); byteIndex < byteStopIndex; byteIndex += 1) { + byte = aByteArray[byteIndex]; + i = contourDataIndexes[baseIndex + byte]; + if (aBoolean) { + if (byte == 95) { + i = contourDataIndexes[226]; + i = contourDataIndexes[134 - i]; + i = contourDataIndexes[144 - i]; + } + if (byte == 94) { + i = contourDataIndexes[226]; + i = contourDataIndexes[134 - i]; + i = contourDataIndexes[145 - i]; + } + } + if (i < 0) { + baseIndex = 0 - i; + } + else { + i -= 1; + advanceWidth = contourData[i]; + i += 5; + numContours = ((sqInt)(contourData[i])); + i += 1; + for (idx = 1; idx <= numContours; idx += 1) { + numBeziers = ((sqInt)(contourData[i])); + i += 1; + ttMoveToX = (contourData[i]) + nextGlyphX; + i += 1; + ttMoveToY = (contourData[i]) + nextGlyphY; + i += 1; + startX = ((ttMoveToX * txA11) + (ttMoveToY * txA12)) + txA13; + startY = ((ttMoveToX * txA21) + (ttMoveToY * txA22)) + txA23; + contourStartX = startX; + contourStartY = startY; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + for (idx2 = 1; idx2 <= numBeziers; idx2 += 1) { + ttEndX = contourData[i]; + i += 1; + ttEndY = contourData[i]; + i += 1; + ttControlX = contourData[i]; + i += 1; + ttControlY = contourData[i]; + i += 1; + endX = ((ttEndX * txA11) + (ttEndY * txA12)) + startX; + endY = ((ttEndX * txA21) + (ttEndY * txA22)) + startY; + controlX = ((ttControlX * txA11) + (ttControlY * txA12)) + startX; + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + controlY = ((ttControlX * txA21) + (ttControlY * txA22)) + startY; + xMinEnd = ((startX < endX) ? startX : endX); + xMaxEnd = ((startX < endX) ? endX : startX); + yMinEnd = ((startY < endY) ? startY : endY); + yMaxEnd = ((startY < endY) ? endY : startY); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + controlX) / 2.0)) ? xMinEnd : ((xMinEnd + controlX) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + controlX) / 2.0)) ? ((xMaxEnd + controlX) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + controlY) / 2.0)) ? yMinEnd : ((yMinEnd + controlY) / 2.0)))); + + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + controlY) / 2.0)) ? ((yMaxEnd + controlY) / 2.0) : yMaxEnd)) : spanBottom); + x = startX; + y = startY; + updateAlphasWPZeroStrokeForXy(x, y); + updateEdgeCountWPAtXy(x, y); + dx = fabs(endX-startX); dy = fabs(endY-startY); + + /* Compute Quadratic Bezier Curve, */ + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point */ + y0 = y; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * startX) + (f2 * controlX)) + (f3 * endX); + y = ((f1 * startY) + (f2 * controlY)) + (f3 * endY); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasWPZeroStrokeForXy(x, y); + updateEdgeCountWPAtXy(x, y); + } + startX = endX; + startY = endY; + } + updateAlphasWPZeroStrokeForXy(endX, endY); + updateEdgeCountWPAtXy(endX, endY); + updateEdgeCountWPAtXy(contourStartX, contourStartY); + } + nextGlyphX += advanceWidth; + baseIndex = 0; + } + } + txA11 = txA11 / sx; + txA12 = txA12 / sy; + txA21 = txA21 / sx; + txA22 = txA22 / sy; + answer = nextGlyphX * sx; + if (!(failed())) { + _return_value = floatObjectOf(answer); + if (!(failed())) { + methodReturnValue(_return_value); + } + } + return null; +} + + /* VectorEnginePlugin>>#fillR:g:b:a: */ +EXPORT(sqInt) +primFillRGBA(void) +{ + double a; + double b; + double g; + double r; + + if (!((isFloatObject(stackValue(3))) + && ((isFloatObject(stackValue(2))) + && ((isFloatObject(stackValue(1))) + && (isFloatObject(stackValue(0))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + r = stackFloatValue(3); + g = stackFloatValue(2); + b = stackFloatValue(1); + a = stackFloatValue(0); + fillR = r * 255.0; + fillG = g * 255.0; + fillB = b * 255.0; + fillA = a; + if (!(failed())) { + pop(4); + } + return null; +} + + /* VectorEnginePlugin>>#geometryTxA11:a12:a13:a21:a22:a23: */ +EXPORT(sqInt) +primGeometryTxSet(void) +{ + double a11; + double a12; + double a13; + double a21; + double a22; + double a23; + + if (!((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isFloatObject(stackValue(2))) + && ((isFloatObject(stackValue(1))) + && (isFloatObject(stackValue(0))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + a11 = stackFloatValue(5); + a12 = stackFloatValue(4); + a13 = stackFloatValue(3); + a21 = stackFloatValue(2); + a22 = stackFloatValue(1); + a23 = stackFloatValue(0); + txA11 = a11; + txA12 = a12; + txA13 = a13; + txA21 = a21; + txA22 = a22; + txA23 = a23; + if (!(failed())) { + pop(6); + } + return null; +} + + /* VectorEnginePlugin>>#initializePath */ +EXPORT(sqInt) +primInitializePath(void) +{ + + /* drawable right. Will later be refined. */ + spanLeft = targetWidth; + + /* drawable bottom. Will later be refined. */ + spanTop = targetHeight; + + /* drawable left. Will later be refined. */ + spanRight = 0; + + /* drawable top. Will later be refined. */ + spanBottom = 0; + prevYRounded = 0x7FFFFFFF; + return null; +} + + /* VectorEnginePlugin>>#lineFromX:y:toX:y:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primLine(void) +{ + float *aFloat32Array; + unsigned *anotherWordArray; + unsigned *otherWordArray; + double xFrom; + double xTo; + double yFrom; + double yTo; + + if (!((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + xFrom = stackFloatValue(6); + yFrom = stackFloatValue(5); + xTo = stackFloatValue(4); + yTo = stackFloatValue(3); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + contour = aFloat32Array; + pvt_lineFromXytoXy(xFrom, yFrom, xTo, yTo); + if (!(failed())) { + pop(7); + } + return null; +} + + /* VectorEnginePlugin>>#lineWPFromX:y:toX:y:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primLineWP(void) +{ + float *aFloat32Array; + char *anotherByteArray; + char *otherByteArray; + double xFrom; + double xTo; + double yFrom; + double yTo; + + if (!((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isBytes(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + xFrom = stackFloatValue(6); + yFrom = stackFloatValue(5); + xTo = stackFloatValue(4); + yTo = stackFloatValue(3); + otherByteArray = ((char *) (firstIndexableField(stackValue(2)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + contour = aFloat32Array; + pvt_lineWPFromXytoXy(xFrom, yFrom, xTo, yTo); + if (!(failed())) { + pop(7); + } + return null; +} + + /* VectorEnginePlugin>>#newTrajectoryFragment */ +EXPORT(sqInt) +primNewTrajectoryFragment(void) +{ + sqInt _return_value; + + _return_value = 0; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + if (!(failed())) { + methodReturnValue(_return_value); + } + return null; +} + + /* VectorEnginePlugin>>#pathSequence:size:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primPathSequence(void) +{ + float *aFloat32Array; + unsigned *anotherWordArray; + sqInt commandType; + float control1X; + float control1Y; + float control2X; + float control2Y; + float endX; + float endY; + sqInt i; + float *otherFloat32Array; + unsigned *otherWordArray; + sqInt size; + float startX; + float startY; + + if (!((isWordsOrBytes(stackValue(4))) + && ((isIntegerObject((size = stackValue(3)))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aFloat32Array = ((float *) (firstIndexableField(stackValue(4)))); + size = integerValueOf(size); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + otherFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + contour = otherFloat32Array; + i = 0; + while (i < size) { + commandType = ((sqInt)(aFloat32Array[i])); + i += 1; + switch (commandType) { + case 0: + if (!((i + 1) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + startX = aFloat32Array[i]; + i += 1; + startY = aFloat32Array[i]; + i += 1; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + break; + case 1: + if (!((i + 1) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + endX = aFloat32Array[i]; + i += 1; + endY = aFloat32Array[i]; + i += 1; + pvt_lineFromXytoXy(startX, startY, endX, endY); + startX = endX; + startY = endY; + break; + case 2: + if (!((i + 3) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + endX = aFloat32Array[i]; + i += 1; + endY = aFloat32Array[i]; + i += 1; + control1X = aFloat32Array[i]; + i += 1; + control1Y = aFloat32Array[i]; + i += 1; + pvt_quadraticBezierFromXytoXycontrolXy(startX, startY, endX, endY, control1X, control1Y); + startX = endX; + startY = endY; + break; + case 3: + if (!((i + 5) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + endX = aFloat32Array[i]; + i += 1; + endY = aFloat32Array[i]; + i += 1; + control1X = aFloat32Array[i]; + i += 1; + control1Y = aFloat32Array[i]; + i += 1; + control2X = aFloat32Array[i]; + i += 1; + control2Y = aFloat32Array[i]; + i += 1; + pvt_cubicBezierFromXytoXycontrol1Xycontrol2Xy(startX, startY, endX, endY, control1X, control1Y, control2X, control2Y); + startX = endX; + startY = endY; + break; + default: + if (!(failed())) { + pop(5); + } + return null; + + } + } + if (!(failed())) { + pop(5); + } + return null; +} + + /* VectorEnginePlugin>>#pathSequenceWP:size:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primPathSequenceWP(void) +{ + float *aFloat32Array; + char *anotherByteArray; + sqInt commandType; + float control1X; + float control1Y; + float control2X; + float control2Y; + float endX; + float endY; + sqInt i; + char *otherByteArray; + float *otherFloat32Array; + sqInt size; + float startX; + float startY; + + if (!((isWordsOrBytes(stackValue(4))) + && ((isIntegerObject((size = stackValue(3)))) + && ((isBytes(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aFloat32Array = ((float *) (firstIndexableField(stackValue(4)))); + size = integerValueOf(size); + otherByteArray = ((char *) (firstIndexableField(stackValue(2)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + otherFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + contour = otherFloat32Array; + i = 0; + while (i < size) { + commandType = ((sqInt)(aFloat32Array[i])); + i += 1; + switch (commandType) { + case 0: + if (!((i + 1) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + startX = aFloat32Array[i]; + i += 1; + startY = aFloat32Array[i]; + i += 1; + /* begin initializeTrajectoryFragment */ + prevYTruncated = 0x7FFFFFFF; + break; + case 1: + if (!((i + 1) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + endX = aFloat32Array[i]; + i += 1; + endY = aFloat32Array[i]; + i += 1; + pvt_lineWPFromXytoXy(startX, startY, endX, endY); + startX = endX; + startY = endY; + break; + case 2: + if (!((i + 3) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + endX = aFloat32Array[i]; + i += 1; + endY = aFloat32Array[i]; + i += 1; + control1X = aFloat32Array[i]; + i += 1; + control1Y = aFloat32Array[i]; + i += 1; + pvt_quadraticBezierWPFromXytoXycontrolXy(startX, startY, endX, endY, control1X, control1Y); + startX = endX; + startY = endY; + break; + case 3: + if (!((i + 5) < size)) { + if (!(failed())) { + pop(5); + } + return null; + } + endX = aFloat32Array[i]; + i += 1; + endY = aFloat32Array[i]; + i += 1; + control1X = aFloat32Array[i]; + i += 1; + control1Y = aFloat32Array[i]; + i += 1; + control2X = aFloat32Array[i]; + i += 1; + control2Y = aFloat32Array[i]; + i += 1; + pvt_cubicBezierWPFromXytoXycontrol1Xycontrol2Xy(startX, startY, endX, endY, control1X, control1Y, control2X, control2Y); + startX = endX; + startY = endY; + break; + default: + if (!(failed())) { + pop(5); + } + return null; + + } + } + if (!(failed())) { + pop(5); + } + return null; +} + + /* VectorEnginePlugin>>#quadraticBezierFromX:y:toX:y:controlX:y:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primQuadraticBezier(void) +{ + float *aFloat32Array; + unsigned *anotherWordArray; + unsigned *otherWordArray; + double xControl; + double xFrom; + double xTo; + double yControl; + double yFrom; + double yTo; + + if (!((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isWords(stackValue(2))) + && ((isWords(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + xFrom = stackFloatValue(8); + yFrom = stackFloatValue(7); + xTo = stackFloatValue(6); + yTo = stackFloatValue(5); + xControl = stackFloatValue(4); + yControl = stackFloatValue(3); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(2)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + contour = aFloat32Array; + pvt_quadraticBezierFromXytoXycontrolXy(xFrom, yFrom, xTo, yTo, xControl, yControl); + if (!(failed())) { + pop(9); + } + return null; +} + + /* VectorEnginePlugin>>#quadraticBezierWPFromX:y:toX:y:controlX:y:edgeCounts:alphaMask:contour: */ +EXPORT(sqInt) +primQuadraticBezierWP(void) +{ + float *aFloat32Array; + char *anotherByteArray; + char *otherByteArray; + double xControl; + double xFrom; + double xTo; + double yControl; + double yFrom; + double yTo; + + if (!((isFloatObject(stackValue(8))) + && ((isFloatObject(stackValue(7))) + && ((isFloatObject(stackValue(6))) + && ((isFloatObject(stackValue(5))) + && ((isFloatObject(stackValue(4))) + && ((isFloatObject(stackValue(3))) + && ((isBytes(stackValue(2))) + && ((isBytes(stackValue(1))) + && (isWordsOrBytes(stackValue(0)))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + xFrom = stackFloatValue(8); + yFrom = stackFloatValue(7); + xTo = stackFloatValue(6); + yTo = stackFloatValue(5); + xControl = stackFloatValue(4); + yControl = stackFloatValue(3); + otherByteArray = ((char *) (firstIndexableField(stackValue(2)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(1)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(0)))); + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + contour = aFloat32Array; + pvt_quadraticBezierWPFromXytoXycontrolXy(xFrom, yFrom, xTo, yTo, xControl, yControl); + if (!(failed())) { + pop(9); + } + return null; +} + + /* VectorEnginePlugin>>#resetContourTop:bottom: */ +EXPORT(sqInt) +primResetContour(void) +{ + sqInt b; + sqInt t; + sqInt y; + + if (!((isIntegerObject((t = stackValue(1)))) + && (isIntegerObject((b = stackValue(0)))))) { + return primitiveFailFor(PrimErrBadArgument); + } + t = integerValueOf(t); + b = integerValueOf(b); + leftAtThisY = targetWidth; + rightAtThisY = 0; + for (y = t; y <= b; y += 1) { + contour[y * 2] = targetWidth; + contour[(y * 2) + 1] = 0; + } + if (!(failed())) { + pop(2); + } + return null; +} + + +/* All arrays could be pinned instead of passing them every time! */ + + /* VectorEnginePlugin>>#targetBits:morphIds:edgeCounts:alphaMask:contour:targetWidth:targetHeight: */ +EXPORT(sqInt) +primSetTarget(void) +{ + unsigned *aBitmap; + float *aFloat32Array; + sqInt aNumber; + unsigned *anotherWordArray; + unsigned *aWordArray; + sqInt otherNumber; + unsigned *otherWordArray; + + if (!((isWords(stackValue(6))) + && ((isWords(stackValue(5))) + && ((isWords(stackValue(4))) + && ((isWords(stackValue(3))) + && ((isWordsOrBytes(stackValue(2))) + && ((isIntegerObject((aNumber = stackValue(1)))) + && (isIntegerObject((otherNumber = stackValue(0))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aBitmap = ((unsigned *) (firstIndexableField(stackValue(6)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(5)))); + otherWordArray = ((unsigned *) (firstIndexableField(stackValue(4)))); + anotherWordArray = ((unsigned *) (firstIndexableField(stackValue(3)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(2)))); + aNumber = integerValueOf(aNumber); + otherNumber = integerValueOf(otherNumber); + targetBits = aBitmap; + morphIds = aWordArray; + edgeCounts = otherWordArray; + alphaMask = anotherWordArray; + contour = aFloat32Array; + targetWidth = aNumber; + targetHeight = otherNumber; + if (!(failed())) { + pop(7); + } + return null; +} + + +/* All arrays could be pinned instead of passing them every time! */ + + /* VectorEnginePlugin>>#targetBits:morphIds:edgeCountsWP:alphaMaskWP:contour:targetWidth:targetHeight: */ +EXPORT(sqInt) +primSetTargetWP(void) +{ + unsigned *aBitmap; + float *aFloat32Array; + sqInt aNumber; + char *anotherByteArray; + unsigned *aWordArray; + char *otherByteArray; + sqInt otherNumber; + + if (!((isWords(stackValue(6))) + && ((isWords(stackValue(5))) + && ((isBytes(stackValue(4))) + && ((isBytes(stackValue(3))) + && ((isWordsOrBytes(stackValue(2))) + && ((isIntegerObject((aNumber = stackValue(1)))) + && (isIntegerObject((otherNumber = stackValue(0))))))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + aBitmap = ((unsigned *) (firstIndexableField(stackValue(6)))); + aWordArray = ((unsigned *) (firstIndexableField(stackValue(5)))); + otherByteArray = ((char *) (firstIndexableField(stackValue(4)))); + anotherByteArray = ((char *) (firstIndexableField(stackValue(3)))); + aFloat32Array = ((float *) (firstIndexableField(stackValue(2)))); + aNumber = integerValueOf(aNumber); + otherNumber = integerValueOf(otherNumber); + targetBits = aBitmap; + morphIds = aWordArray; + edgeCountsWP = otherByteArray; + alphaMaskWP = anotherByteArray; + contour = aFloat32Array; + targetWidth = aNumber; + targetHeight = otherNumber; + if (!(failed())) { + pop(7); + } + return null; +} + + /* VectorEnginePlugin>>#spanBottom */ +EXPORT(sqInt) +primSpanBottom(void) +{ + sqInt _return_value; + + _return_value = integerObjectOf((((sqInt)(spanBottom + auxStrokeWidthDilatedHalf)))); + if (!(failed())) { + methodReturnValue(_return_value); + } + return null; +} + + /* VectorEnginePlugin>>#spanLeft */ +EXPORT(sqInt) +primSpanLeft(void) +{ + sqInt _return_value; + + _return_value = integerObjectOf((((sqInt)(((spanLeft - auxStrokeWidthDilatedHalf) - subPixelDelta) + 1)))); + if (!(failed())) { + methodReturnValue(_return_value); + } + return null; +} + + /* VectorEnginePlugin>>#spanRight */ +EXPORT(sqInt) +primSpanRight(void) +{ + sqInt _return_value; + + _return_value = integerObjectOf(((((sqInt)((spanRight + auxStrokeWidthDilatedHalf) + subPixelDelta))) + 1)); + if (!(failed())) { + methodReturnValue(_return_value); + } + return null; +} + + /* VectorEnginePlugin>>#spanTop */ +EXPORT(sqInt) +primSpanTop(void) +{ + sqInt _return_value; + + _return_value = integerObjectOf((((sqInt)((spanTop - auxStrokeWidthDilatedHalf) + 1)))); + if (!(failed())) { + methodReturnValue(_return_value); + } + return null; +} + + /* VectorEnginePlugin>>#strokeR:g:b:a: */ +EXPORT(sqInt) +primStrokeRGBA(void) +{ + double a; + double b; + double g; + double r; + + if (!((isFloatObject(stackValue(3))) + && ((isFloatObject(stackValue(2))) + && ((isFloatObject(stackValue(1))) + && (isFloatObject(stackValue(0))))))) { + return primitiveFailFor(PrimErrBadArgument); + } + r = stackFloatValue(3); + g = stackFloatValue(2); + b = stackFloatValue(1); + a = stackFloatValue(0); + strokeR = r * 255.0; + strokeG = g * 255.0; + strokeB = b * 255.0; + strokeA = a; + if (!(failed())) { + pop(4); + } + return null; +} + + /* VectorEnginePlugin>>#strokeWidth: */ +EXPORT(sqInt) +primStrokeWidth(void) +{ + double aNumber; + float swErodedHalf; + + if (!(isFloatObject(stackValue(0)))) { + return primitiveFailFor(PrimErrBadArgument); + } + aNumber = stackFloatValue(0); + strokeWidth = aNumber; + auxStrokeWidthDilatedHalf = (strokeWidth + antiAliasingWidth) * 0.5; + auxStrokeWidthDilatedHalfSquared = auxStrokeWidthDilatedHalf * auxStrokeWidthDilatedHalf; + swErodedHalf = (strokeWidth - antiAliasingWidth) * 0.5; + auxStrokeWidthErodedHalfSquared = swErodedHalf * fabs(swErodedHalf); + if (!(failed())) { + pop(1); + } + return null; +} + + /* VectorEnginePlugin>>#updateContourLastLine */ +EXPORT(sqInt) +primUpdateContourLastLine(void) +{ + if (!(prevYRounded == 0x7FFFFFFF)) { + contour[prevYRounded * 2] = leftAtThisY; + contour[(prevYRounded * 2) + 1] = rightAtThisY; + } + return null; +} + + /* VectorEnginePlugin>>#pvt_cubicBezierFromX:y:toX:y:control1X:y:control2X:y: */ +static sqInt +pvt_cubicBezierFromXytoXycontrol1Xycontrol2Xy(float xFrom, float yFrom, float xTo, float yTo, float xControl1, float yControl1, float xControl2, float yControl2) +{ + float dx; + float dx2; + float dx3; + float dy; + float dy2; + float dy3; + float f1; + float f2; + float f23; + float f3; + float f4; + sqInt h; + int hops; + float increment; + float oneLessT; + float t; + float txControl1; + float txControl2; + float txFrom; + float txTo; + float tyControl1; + float tyControl2; + float tyFrom; + float tyTo; + float x; + float xMaxEnd; + float xMinEnd; + float y; + float yMaxEnd; + float yMinEnd; + + txFrom = ((xFrom * txA11) + (yFrom * txA12)) + txA13; + tyFrom = ((xFrom * txA21) + (yFrom * txA22)) + txA23; + txTo = ((xTo * txA11) + (yTo * txA12)) + txA13; + tyTo = ((xTo * txA21) + (yTo * txA22)) + txA23; + txControl1 = ((xControl1 * txA11) + (yControl1 * txA12)) + txA13; + tyControl1 = ((xControl1 * txA21) + (yControl1 * txA22)) + txA23; + txControl2 = ((xControl2 * txA11) + (yControl2 * txA12)) + txA13; + tyControl2 = ((xControl2 * txA21) + (yControl2 * txA22)) + txA23; + + dx = fabs(txControl1-txFrom); + dx2 = fabs(txTo-txControl2); + dx3 = fabs(txControl2-txControl1); + dy = fabs(tyControl1-tyFrom); + dy2 = fabs(tyTo-tyControl2); + dy3 = fabs(tyControl2-tyControl1); + dx = ((((((dx < dx2) ? dx2 : dx)) * 3) < (dx3 * 1.5)) ? (dx3 * 1.5) : ((((dx < dx2) ? dx2 : dx)) * 3)); + dy = ((((((dy < dy2) ? dy2 : dy)) * 3) < (dy3 * 1.5)) ? (dy3 * 1.5) : ((((dy < dy2) ? dy2 : dy)) * 3)); + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + hops = (((sqInt)((((dx < dy) ? dy : dx)) / hop))) + 1; + xMinEnd = ((txFrom < txTo) ? txFrom : txTo); + xMaxEnd = ((txFrom < txTo) ? txTo : txFrom); + yMinEnd = ((tyFrom < tyTo) ? tyFrom : tyTo); + yMaxEnd = ((tyFrom < tyTo) ? tyTo : tyFrom); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))) ? xMinEnd : ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))))) ? spanLeft : (((xMinEnd < ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))) ? xMinEnd : ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75))) ? ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75)) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75))) ? ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75)) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))) ? yMinEnd : ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))))) ? spanTop : (((yMinEnd < ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))) ? yMinEnd : ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))))); + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75))) ? ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75)) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75))) ? ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75)) : yMaxEnd)) : spanBottom); + t = 0.0; + increment = 1.0 / hops; + for (h = 1; h <= hops; h += 1) { + oneLessT = 1.0 - t; + f1 = (oneLessT * oneLessT) * oneLessT; + f23 = (3.0 * oneLessT) * t; + f2 = f23 * oneLessT; + f3 = f23 * t; + f4 = (t * t) * t; + x = (((f1 * txFrom) + (f2 * txControl1)) + (f3 * txControl2)) + (f4 * txTo); + y = (((f1 * tyFrom) + (f2 * tyControl1)) + (f3 * tyControl2)) + (f4 * tyTo); + updateAlphasForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(x, y); + } + updateContourForXy(x, y); + t += increment; + } + updateAlphasForXy(txTo, tyTo); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(txTo, tyTo); + } + updateContourForXy(txTo, tyTo); + return 0; +} + + /* VectorEnginePlugin>>#pvt_cubicBezierWPFromX:y:toX:y:control1X:y:control2X:y: */ +static sqInt +pvt_cubicBezierWPFromXytoXycontrol1Xycontrol2Xy(float xFrom, float yFrom, float xTo, float yTo, float xControl1, float yControl1, float xControl2, float yControl2) +{ + float dx; + float dx2; + float dx3; + float dy; + float dy2; + float dy3; + float f1; + float f2; + float f23; + float f3; + float f4; + sqInt h; + int hops; + float increment; + float oneLessT; + float t; + float txControl1; + float txControl2; + float txFrom; + float txTo; + float tyControl1; + float tyControl2; + float tyFrom; + float tyTo; + float x; + float xMaxEnd; + float xMinEnd; + float y; + float yMaxEnd; + float yMinEnd; + + txFrom = ((xFrom * txA11) + (yFrom * txA12)) + txA13; + tyFrom = ((xFrom * txA21) + (yFrom * txA22)) + txA23; + txTo = ((xTo * txA11) + (yTo * txA12)) + txA13; + tyTo = ((xTo * txA21) + (yTo * txA22)) + txA23; + txControl1 = ((xControl1 * txA11) + (yControl1 * txA12)) + txA13; + tyControl1 = ((xControl1 * txA21) + (yControl1 * txA22)) + txA23; + txControl2 = ((xControl2 * txA11) + (yControl2 * txA12)) + txA13; + tyControl2 = ((xControl2 * txA21) + (yControl2 * txA22)) + txA23; + + dx = fabs(txControl1-txFrom); + dx2 = fabs(txTo-txControl2); + dx3 = fabs(txControl2-txControl1); + dy = fabs(tyControl1-tyFrom); + dy2 = fabs(tyTo-tyControl2); + dy3 = fabs(tyControl2-tyControl1); + dx = ((((((dx < dx2) ? dx2 : dx)) * 3) < (dx3 * 1.5)) ? (dx3 * 1.5) : ((((dx < dx2) ? dx2 : dx)) * 3)); + dy = ((((((dy < dy2) ? dy2 : dy)) * 3) < (dy3 * 1.5)) ? (dy3 * 1.5) : ((((dy < dy2) ? dy2 : dy)) * 3)); + + /* This computed span of the Bezier curve is a bit pessimistic (larger than strict bounds), but safe. */ + hops = (((sqInt)((((dx < dy) ? dy : dx)) / hop))) + 1; + xMinEnd = ((txFrom < txTo) ? txFrom : txTo); + xMaxEnd = ((txFrom < txTo) ? txTo : txFrom); + yMinEnd = ((tyFrom < tyTo) ? tyFrom : tyTo); + yMaxEnd = ((tyFrom < tyTo) ? tyTo : tyFrom); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))) ? xMinEnd : ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))))) ? spanLeft : (((xMinEnd < ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))) ? xMinEnd : ((xMinEnd * 0.25) + ((((txControl1 < txControl2) ? txControl1 : txControl2)) * 0.75))))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75))) ? ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75)) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75))) ? ((xMaxEnd * 0.25) + ((((txControl1 < txControl2) ? txControl2 : txControl1)) * 0.75)) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))) ? yMinEnd : ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))))) ? spanTop : (((yMinEnd < ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))) ? yMinEnd : ((yMinEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl1 : tyControl2)) * 0.75))))); + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75))) ? ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75)) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75))) ? ((yMaxEnd * 0.25) + ((((tyControl1 < tyControl2) ? tyControl2 : tyControl1)) * 0.75)) : yMaxEnd)) : spanBottom); + t = 0.0; + increment = 1.0 / hops; + for (h = 1; h <= hops; h += 1) { + oneLessT = 1.0 - t; + f1 = (oneLessT * oneLessT) * oneLessT; + f23 = (3.0 * oneLessT) * t; + f2 = f23 * oneLessT; + f3 = f23 * t; + f4 = (t * t) * t; + x = (((f1 * txFrom) + (f2 * txControl1)) + (f3 * txControl2)) + (f4 * txTo); + y = (((f1 * tyFrom) + (f2 * tyControl1)) + (f3 * tyControl2)) + (f4 * tyTo); + updateAlphasWPForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(x, y); + } + updateContourForXy(x, y); + t += increment; + } + updateAlphasWPForXy(txTo, tyTo); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(txTo, tyTo); + } + updateContourForXy(txTo, tyTo); + return 0; +} + + /* VectorEnginePlugin>>#pvt_lineFromX:y:toX:y: */ +static sqInt +pvt_lineFromXytoXy(float xFrom, float yFrom, float xTo, float yTo) +{ + float dx; + float dy; + sqInt h; + int hops; + float incrementX; + float incrementY; + float txFrom; + float txTo; + float tyFrom; + float tyTo; + float x; + float y; + + txFrom = ((xFrom * txA11) + (yFrom * txA12)) + txA13; + tyFrom = ((xFrom * txA21) + (yFrom * txA22)) + txA23; + txTo = ((xTo * txA11) + (yTo * txA12)) + txA13; + tyTo = ((xTo * txA21) + (yTo * txA22)) + txA23; + dx = txTo - txFrom; + dy = tyTo - tyFrom; + incrementX = dx; + incrementY = dy; + + dx = fabs(dx); + dy = fabs(dy); + hops = (((sqInt)((((dx < dy) ? dy : dx)) / hop))) + 1; + incrementX = incrementX / hops; + incrementY = incrementY / hops; + spanLeft = ((spanLeft < (((txFrom < txTo) ? txFrom : txTo))) ? spanLeft : (((txFrom < txTo) ? txFrom : txTo))); + spanRight = ((spanRight < (((txFrom < txTo) ? txTo : txFrom))) ? (((txFrom < txTo) ? txTo : txFrom)) : spanRight); + spanTop = ((spanTop < (((tyFrom < tyTo) ? tyFrom : tyTo))) ? spanTop : (((tyFrom < tyTo) ? tyFrom : tyTo))); + spanBottom = ((spanBottom < (((tyFrom < tyTo) ? tyTo : tyFrom))) ? (((tyFrom < tyTo) ? tyTo : tyFrom)) : spanBottom); + x = txFrom; + y = tyFrom; + for (h = 1; h <= hops; h += 1) { + updateAlphasForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(x, y); + } + updateContourForXy(x, y); + x += incrementX; + y += incrementY; + } + updateAlphasForXy(txTo, tyTo); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(txTo, tyTo); + } + updateContourForXy(txTo, tyTo); + return 0; +} + + /* VectorEnginePlugin>>#pvt_lineWPFromX:y:toX:y: */ +static sqInt +pvt_lineWPFromXytoXy(float xFrom, float yFrom, float xTo, float yTo) +{ + float dx; + float dy; + sqInt h; + int hops; + float incrementX; + float incrementY; + float txFrom; + float txTo; + float tyFrom; + float tyTo; + float x; + float y; + + txFrom = ((xFrom * txA11) + (yFrom * txA12)) + txA13; + tyFrom = ((xFrom * txA21) + (yFrom * txA22)) + txA23; + txTo = ((xTo * txA11) + (yTo * txA12)) + txA13; + tyTo = ((xTo * txA21) + (yTo * txA22)) + txA23; + dx = txTo - txFrom; + dy = tyTo - tyFrom; + incrementX = dx; + incrementY = dy; + + dx = fabs(dx); + dy = fabs(dy); + hops = (((sqInt)((((dx < dy) ? dy : dx)) / hop))) + 1; + incrementX = incrementX / hops; + incrementY = incrementY / hops; + spanLeft = ((spanLeft < (((txFrom < txTo) ? txFrom : txTo))) ? spanLeft : (((txFrom < txTo) ? txFrom : txTo))); + spanRight = ((spanRight < (((txFrom < txTo) ? txTo : txFrom))) ? (((txFrom < txTo) ? txTo : txFrom)) : spanRight); + spanTop = ((spanTop < (((tyFrom < tyTo) ? tyFrom : tyTo))) ? spanTop : (((tyFrom < tyTo) ? tyFrom : tyTo))); + spanBottom = ((spanBottom < (((tyFrom < tyTo) ? tyTo : tyFrom))) ? (((tyFrom < tyTo) ? tyTo : tyFrom)) : spanBottom); + x = txFrom; + y = tyFrom; + for (h = 1; h <= hops; h += 1) { + updateAlphasWPForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(x, y); + } + updateContourForXy(x, y); + x += incrementX; + y += incrementY; + } + updateAlphasWPForXy(txTo, tyTo); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(txTo, tyTo); + } + updateContourForXy(txTo, tyTo); + return 0; +} + + /* VectorEnginePlugin>>#pvt_quadraticBezierFromX:y:toX:y:controlX:y: */ +static sqInt +pvt_quadraticBezierFromXytoXycontrolXy(float xFrom, float yFrom, float xTo, float yTo, float xControl, float yControl) +{ + float correction; + float dx; + float dx2; + float dy; + float dy2; + float f1; + float f2; + float f3; + float increment; + float length; + float oneLessT; + float t; + float t0; + float txControl; + float txFrom; + float txTo; + float tyControl; + float tyFrom; + float tyTo; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + + if ((xControl == xTo) + && (yControl == yTo)) { + return pvt_lineFromXytoXy(xFrom, yFrom, xTo, yTo); + } + if ((xControl == xFrom) + && (yControl == yFrom)) { + return pvt_lineFromXytoXy(xFrom, yFrom, xTo, yTo); + } + txFrom = ((xFrom * txA11) + (yFrom * txA12)) + txA13; + tyFrom = ((xFrom * txA21) + (yFrom * txA22)) + txA23; + txTo = ((xTo * txA11) + (yTo * txA12)) + txA13; + tyTo = ((xTo * txA21) + (yTo * txA22)) + txA23; + txControl = ((xControl * txA11) + (yControl * txA12)) + txA13; + tyControl = ((xControl * txA21) + (yControl * txA22)) + txA23; + + dx = fabs(txTo-txFrom); + dx2 = fabs(txControl-txFrom); + dy = fabs(tyTo-tyFrom); + dy2 = fabs(tyControl-tyFrom); + if ((dx < 1.0) + && (dx2 < 1.0)) { + return pvt_lineFromXytoXy(xFrom, yFrom, xTo, yTo); + } + if ((dy < 1.0) + && (dy2 < 1.0)) { + return pvt_lineFromXytoXy(xFrom, yFrom, xTo, yTo); + } + xMinEnd = ((txFrom < txTo) ? txFrom : txTo); + xMaxEnd = ((txFrom < txTo) ? txTo : txFrom); + yMinEnd = ((tyFrom < tyTo) ? tyFrom : tyTo); + yMaxEnd = ((tyFrom < tyTo) ? tyTo : tyFrom); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + txControl) / 2.0)) ? xMinEnd : ((xMinEnd + txControl) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + txControl) / 2.0)) ? xMinEnd : ((xMinEnd + txControl) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + txControl) / 2.0)) ? ((xMaxEnd + txControl) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + txControl) / 2.0)) ? ((xMaxEnd + txControl) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + tyControl) / 2.0)) ? yMinEnd : ((yMinEnd + tyControl) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + tyControl) / 2.0)) ? yMinEnd : ((yMinEnd + tyControl) / 2.0)))); + + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + tyControl) / 2.0)) ? ((yMaxEnd + tyControl) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + tyControl) / 2.0)) ? ((yMaxEnd + tyControl) / 2.0) : yMaxEnd)) : spanBottom); + x = txFrom; + y = tyFrom; + updateAlphasForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(x, y); + } + updateContourForXy(x, y); + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point */ + y0 = y; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(x, y); + } + updateContourForXy(x, y); + } + updateAlphasForXy(txTo, tyTo); + if (!(fillA == 0.0)) { + updateEdgeCountAtXy(txTo, tyTo); + } + updateContourForXy(txTo, tyTo); + return 0; +} + + /* VectorEnginePlugin>>#pvt_quadraticBezierWPFromX:y:toX:y:controlX:y: */ +static sqInt +pvt_quadraticBezierWPFromXytoXycontrolXy(float xFrom, float yFrom, float xTo, float yTo, float xControl, float yControl) +{ + float correction; + float dx; + float dx2; + float dy; + float dy2; + float f1; + float f2; + float f3; + float increment; + float length; + float oneLessT; + float t; + float t0; + float txControl; + float txFrom; + float txTo; + float tyControl; + float tyFrom; + float tyTo; + float x; + float x0; + float xMaxEnd; + float xMinEnd; + float y; + float y0; + float yMaxEnd; + float yMinEnd; + + if ((xControl == xTo) + && (yControl == yTo)) { + return pvt_lineWPFromXytoXy(xFrom, yFrom, xTo, yTo); + } + if ((xControl == xFrom) + && (yControl == yFrom)) { + return pvt_lineWPFromXytoXy(xFrom, yFrom, xTo, yTo); + } + txFrom = ((xFrom * txA11) + (yFrom * txA12)) + txA13; + tyFrom = ((xFrom * txA21) + (yFrom * txA22)) + txA23; + txTo = ((xTo * txA11) + (yTo * txA12)) + txA13; + tyTo = ((xTo * txA21) + (yTo * txA22)) + txA23; + txControl = ((xControl * txA11) + (yControl * txA12)) + txA13; + tyControl = ((xControl * txA21) + (yControl * txA22)) + txA23; + + dx = fabs(txTo-txFrom); + dx2 = fabs(txControl-txFrom); + dy = fabs(tyTo-tyFrom); + dy2 = fabs(tyControl-tyFrom); + if ((dx < 1.0) + && (dx2 < 1.0)) { + return pvt_lineWPFromXytoXy(xFrom, yFrom, xTo, yTo); + } + if ((dy < 1.0) + && (dy2 < 1.0)) { + return pvt_lineWPFromXytoXy(xFrom, yFrom, xTo, yTo); + } + xMinEnd = ((txFrom < txTo) ? txFrom : txTo); + xMaxEnd = ((txFrom < txTo) ? txTo : txFrom); + yMinEnd = ((tyFrom < tyTo) ? tyFrom : tyTo); + yMaxEnd = ((tyFrom < tyTo) ? tyTo : tyFrom); + spanLeft = ((spanLeft < (((xMinEnd < ((xMinEnd + txControl) / 2.0)) ? xMinEnd : ((xMinEnd + txControl) / 2.0)))) ? spanLeft : (((xMinEnd < ((xMinEnd + txControl) / 2.0)) ? xMinEnd : ((xMinEnd + txControl) / 2.0)))); + spanRight = ((spanRight < (((xMaxEnd < ((xMaxEnd + txControl) / 2.0)) ? ((xMaxEnd + txControl) / 2.0) : xMaxEnd))) ? (((xMaxEnd < ((xMaxEnd + txControl) / 2.0)) ? ((xMaxEnd + txControl) / 2.0) : xMaxEnd)) : spanRight); + spanTop = ((spanTop < (((yMinEnd < ((yMinEnd + tyControl) / 2.0)) ? yMinEnd : ((yMinEnd + tyControl) / 2.0)))) ? spanTop : (((yMinEnd < ((yMinEnd + tyControl) / 2.0)) ? yMinEnd : ((yMinEnd + tyControl) / 2.0)))); + + /* Case t = 0.0 */ + spanBottom = ((spanBottom < (((yMaxEnd < ((yMaxEnd + tyControl) / 2.0)) ? ((yMaxEnd + tyControl) / 2.0) : yMaxEnd))) ? (((yMaxEnd < ((yMaxEnd + tyControl) / 2.0)) ? ((yMaxEnd + tyControl) / 2.0) : yMaxEnd)) : spanBottom); + x = txFrom; + y = tyFrom; + updateAlphasWPForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(x, y); + } + updateContourForXy(x, y); + increment = (((0.5 / (((dx < dy) ? dy : dx))) < 0.5) ? (0.5 / (((dx < dy) ? dy : dx))) : 0.5); + t = 0.0; + while (1) { + t0 = t; + x0 = x; + + /* Compute next point */ + y0 = y; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); + + /* Now adjust the increment to aim at the required hop length, and recompute next point. */ + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + do { + increment = (increment / length) * hop; + t = t0 + increment; + oneLessT = 1.0 - t; + f1 = oneLessT * oneLessT; + f2 = (2.0 * oneLessT) * t; + f3 = t * t; + x = ((f1 * txFrom) + (f2 * txControl)) + (f3 * txTo); + y = ((f1 * tyFrom) + (f2 * tyControl)) + (f3 * tyTo); + dx = x - x0; + dy = y - y0; + + length = sqrt(dx*dx + dy*dy); + correction = hop / length; + } while(correction < 1.0); + if (!(t < 1.0)) break; + updateAlphasWPForXy(x, y); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(x, y); + } + updateContourForXy(x, y); + } + updateAlphasWPForXy(txTo, tyTo); + if (!(fillA == 0.0)) { + updateEdgeCountWPAtXy(txTo, tyTo); + } + updateContourForXy(txTo, tyTo); + return 0; +} + + +/* Note: This is coded so that it can be run in Squeak. */ + + /* InterpreterPlugin>>#setInterpreter: */ +EXPORT(sqInt) +setInterpreter(struct VirtualMachine *anInterpreter) +{ + sqInt ok; + + + /* This may seem tautological, but in a real plugin it checks that the VM provides + the version the plugin was compiled against which is the version the plugin expects. */ + interpreterProxy = anInterpreter; + ok = ((interpreterProxy->majorVersion()) == (VM_PROXY_MAJOR)) + && ((interpreterProxy->minorVersion()) >= (VM_PROXY_MINOR)); + if (ok) { + +#if !defined(SQUEAK_BUILTIN_PLUGIN) + booleanValueOf = interpreterProxy->booleanValueOf; + failed = interpreterProxy->failed; + firstIndexableField = interpreterProxy->firstIndexableField; + floatObjectOf = interpreterProxy->floatObjectOf; +#if !defined(integerObjectOf) + integerObjectOf = interpreterProxy->integerObjectOf; +#endif +#if !defined(integerValueOf) + integerValueOf = interpreterProxy->integerValueOf; +#endif +#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 15) + isBooleanObject = interpreterProxy->isBooleanObject; +#else +#if !defined(isBooleanObject) + isBooleanObject = 0; +#endif +#endif + isBytes = interpreterProxy->isBytes; + isFloatObject = interpreterProxy->isFloatObject; +#if !defined(isIntegerObject) + isIntegerObject = interpreterProxy->isIntegerObject; +#endif + isWords = interpreterProxy->isWords; + isWordsOrBytes = interpreterProxy->isWordsOrBytes; + methodReturnValue = interpreterProxy->methodReturnValue; + pop = interpreterProxy->pop; + primitiveFailFor = interpreterProxy->primitiveFailFor; + stackFloatValue = interpreterProxy->stackFloatValue; + stackValue = interpreterProxy->stackValue; +#endif /* !defined(SQUEAK_BUILTIN_PLUGIN) */ + } + return ok; +} + + /* VectorEnginePlugin>>#updateAlphasForX:y: */ +static sqInt +updateAlphasForXy(float x, float y) +{ + uint32_t alphaWord; + sqInt b; + uint32_t blueAlpha; + uint32_t candidateAlpha; + sqInt displayX; + sqInt displayY; + float distanceToAxisSquared; + sqInt doUpdate; + float dx; + float dxp; + float dy; + float dySquared; + uint32_t greenAlpha; + sqInt l; + sqInt pixelIndex; + sqInt r; + uint32_t redAlpha; + sqInt t; + + + /* (int(z+1)) works equally well than the more intuitive but slower (int(ceil(z)) */ + t = ((sqInt)((y - auxStrokeWidthDilatedHalf) + 1)); + if (t < clipTop) { + t = clipTop; + } + b = ((sqInt)(y + auxStrokeWidthDilatedHalf)); + if (b > clipBottom) { + b = clipBottom; + } + + /* (int(z+1)) works equally well than the more intuitive but slower (int(ceil(z)) */ + l = ((sqInt)(((x - auxStrokeWidthDilatedHalf) - subPixelDelta) + 1)); + if (l < clipLeft) { + l = clipLeft; + } + r = ((sqInt)((x + auxStrokeWidthDilatedHalf) + subPixelDelta)); + if (r > clipRight) { + r = clipRight; + } + for (displayY = t; displayY <= b; displayY += 1) { + pixelIndex = ((displayY * targetWidth) + l) - 1; + dy = displayY - y; + dySquared = dy * dy; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + alphaWord = alphaMask[pixelIndex]; + if (!(alphaWord == 0x7F7F7F)) { + redAlpha = alphaWord & 0x7F0000; + greenAlpha = alphaWord & 0x7F00; + blueAlpha = alphaWord & 0x7F; + doUpdate = 0; + + /* Red */ + dx = displayX - x; + dxp = dx - subPixelDelta; + distanceToAxisSquared = (dxp * dxp) + dySquared; + if (distanceToAxisSquared < auxStrokeWidthDilatedHalfSquared) { + if (distanceToAxisSquared <= auxStrokeWidthErodedHalfSquared) { + candidateAlpha = 0x7F0000; + } + else { + + candidateAlpha = (uint32_t)((auxStrokeWidthDilatedHalf - (sqrt(distanceToAxisSquared))) * auxAntiAliasingWidthScaledInverse); + candidateAlpha = candidateAlpha << 16; + } + if (candidateAlpha > redAlpha) { + doUpdate = 1; + redAlpha = candidateAlpha; + } + } + distanceToAxisSquared = (dx * dx) + dySquared; + if (distanceToAxisSquared < auxStrokeWidthDilatedHalfSquared) { + if (distanceToAxisSquared <= auxStrokeWidthErodedHalfSquared) { + candidateAlpha = 0x7F00; + } + else { + + candidateAlpha = (uint32_t)((auxStrokeWidthDilatedHalf - (sqrt(distanceToAxisSquared))) * auxAntiAliasingWidthScaledInverse); + candidateAlpha = candidateAlpha << 8; + } + if (candidateAlpha > greenAlpha) { + doUpdate = 1; + greenAlpha = candidateAlpha; + } + } + dxp = dx + subPixelDelta; + distanceToAxisSquared = (dxp * dxp) + dySquared; + if (distanceToAxisSquared < auxStrokeWidthDilatedHalfSquared) { + if (distanceToAxisSquared <= auxStrokeWidthErodedHalfSquared) { + candidateAlpha = 0x7F; + } + else { + + candidateAlpha = (uint32_t)((auxStrokeWidthDilatedHalf - (sqrt(distanceToAxisSquared))) * auxAntiAliasingWidthScaledInverse); + } + if (candidateAlpha > blueAlpha) { + doUpdate = 1; + blueAlpha = candidateAlpha; + } + } + if (doUpdate) { + alphaWord = (redAlpha | greenAlpha) | blueAlpha; + alphaMask[pixelIndex] = alphaWord; + } + } + } + } + return 0; +} + + /* VectorEnginePlugin>>#updateAlphasWPForX:y: */ +static sqInt +updateAlphasWPForXy(float x, float y) +{ + uint8_t alphaByte; + sqInt b; + uint8_t candidateAlpha; + sqInt displayX; + sqInt displayY; + float distanceToAxisSquared; + float dx; + float dxSquared; + float dy; + float dySquared; + sqInt l; + sqInt pixelIndex; + sqInt r; + sqInt t; + + + /* (int(z+1)) works equally well than the more intuitive but slower (int(ceil(z)) */ + t = ((sqInt)((y - auxStrokeWidthDilatedHalf) + 1)); + if (t < clipTop) { + t = clipTop; + } + b = ((sqInt)(y + auxStrokeWidthDilatedHalf)); + if (b > clipBottom) { + b = clipBottom; + } + + /* (int(z+1)) works equally well than the more intuitive but slower (int(ceil(z)) */ + l = ((sqInt)((x - auxStrokeWidthDilatedHalf) + 1)); + if (l < clipLeft) { + l = clipLeft; + } + r = ((sqInt)(x + auxStrokeWidthDilatedHalf)); + if (r > clipRight) { + r = clipRight; + } + for (displayY = t; displayY <= b; displayY += 1) { + pixelIndex = ((displayY * targetWidth) + l) - 1; + dy = displayY - y; + dySquared = dy * dy; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + alphaByte = alphaMaskWP[pixelIndex]; + if (!(alphaByte == 0x7F)) { + dx = displayX - x; + dxSquared = dx * dx; + distanceToAxisSquared = dxSquared + dySquared; + if (distanceToAxisSquared < auxStrokeWidthDilatedHalfSquared) { + if (distanceToAxisSquared <= auxStrokeWidthErodedHalfSquared) { + candidateAlpha = 0x7F; + } + else { + + candidateAlpha = (uint8_t)((auxStrokeWidthDilatedHalf - (sqrt(distanceToAxisSquared))) * auxAntiAliasingWidthScaledInverse); + } + if (candidateAlpha > alphaByte) { + alphaMaskWP[pixelIndex] = candidateAlpha; + } + } + } + } + } + return 0; +} + + +/* slight optimization possible when we know width = 0: + - we know + candidateAlpha is never 127 + - we know distanceToEdge is always > + erodedHalfWidth. + */ + + /* VectorEnginePlugin>>#updateAlphasWPZeroStrokeForX:y: */ +static sqInt +updateAlphasWPZeroStrokeForXy(float x, float y) +{ + uint8_t alphaByte; + sqInt b; + uint8_t candidateAlpha; + sqInt displayX; + sqInt displayY; + float distanceToAxisSquared; + float dx; + float dy; + float dySquared; + sqInt l; + sqInt pixelIndex; + sqInt r; + sqInt t; + + + /* (int(z+1)) works equally well than the more intuitive but slower (int(ceil(z)) */ + t = ((sqInt)((y - auxStrokeWidthDilatedHalf) + 1)); + if (t < clipTop) { + t = clipTop; + } + b = ((sqInt)(y + auxStrokeWidthDilatedHalf)); + if (b > clipBottom) { + b = clipBottom; + } + + /* (int(z+1)) works equally well than the more intuitive but slower (int(ceil(z)) */ + l = ((sqInt)((x - auxStrokeWidthDilatedHalf) + 1)); + if (l < clipLeft) { + l = clipLeft; + } + r = ((sqInt)(x + auxStrokeWidthDilatedHalf)); + if (r > clipRight) { + r = clipRight; + } + for (displayY = t; displayY <= b; displayY += 1) { + pixelIndex = ((displayY * targetWidth) + l) - 1; + dy = displayY - y; + dySquared = dy * dy; + for (displayX = l; displayX <= r; displayX += 1) { + pixelIndex += 1; + alphaByte = alphaMaskWP[pixelIndex]; + if (!(alphaByte == 0x7F)) { + dx = displayX - x; + distanceToAxisSquared = (dx * dx) + dySquared; + if (distanceToAxisSquared < auxStrokeWidthDilatedHalfSquared) { + + candidateAlpha = (uint8_t)((auxStrokeWidthDilatedHalf - (sqrt(distanceToAxisSquared))) * auxAntiAliasingWidthScaledInverse); + if (candidateAlpha > alphaByte) { + alphaMaskWP[pixelIndex] = candidateAlpha; + } + } + } + } + } + return 0; +} + + +/* The Contour of the current morph is the pixel area affected, but without + holes. + For each y line where a pixel is affected, record the leftmost and + rightmost affected pixels. + Note: Only includes pen trajectory, but not + stroke width. + */ + + /* VectorEnginePlugin>>#updateContourForX:y: */ +static sqInt +updateContourForXy(float x, float y) +{ + sqInt thisYRounded; + + thisYRounded = ((sqInt)(y + 0.5)); + if (((thisYRounded >= 0) && (thisYRounded <= (targetHeight - 1)))) { + if (!(thisYRounded == prevYRounded)) { + if (!(prevYRounded == 0x7FFFFFFF)) { + contour[prevYRounded * 2] = leftAtThisY; + contour[(prevYRounded * 2) + 1] = rightAtThisY; + } + leftAtThisY = contour[thisYRounded * 2]; + rightAtThisY = contour[(thisYRounded * 2) + 1]; + prevYRounded = thisYRounded; + } + leftAtThisY = ((leftAtThisY < x) ? leftAtThisY : x); + rightAtThisY = ((rightAtThisY < x) ? x : rightAtThisY); + } + return 0; +} + + +/* Compute edges intersecting with this horizontal line, for fills. */ + + /* VectorEnginePlugin>>#updateEdgeCountAtX:y: */ +static sqInt +updateEdgeCountAtXy(float x, float y) +{ + uint32_t blueCount; + uint32_t blueIncrement; + sqInt blueOffset; + sqInt bluePixelIndex; + uint32_t countWord; + uint32_t greenCount; + uint32_t greenIncrement; + sqInt greenOffset; + sqInt greenPixelIndex; + sqInt pixelIndexBase; + sqInt pixelY; + uint32_t redCount; + uint32_t redIncrement; + sqInt redOffset; + sqInt redPixelIndex; + uint32_t rest; + sqInt thisYTruncated; + + + /* truncated, both in C and Smalltalk */ + thisYTruncated = ((sqInt)y); + if (thisYTruncated == prevYTruncated) { + return 0; + } + if (!(((thisYTruncated >= (clipTop - 1)) && (thisYTruncated <= clipBottom)))) { + return 0; + } + if (prevYTruncated == 0x7FFFFFFF) { + prevYTruncated = thisYTruncated; + return 0; + } + if (thisYTruncated > prevYTruncated) { + pixelY = thisYTruncated; + redIncrement = 0x10000; + greenIncrement = 0x100; + blueIncrement = 1; + } + else { + pixelY = prevYTruncated; + redIncrement = 0xFF0000; + greenIncrement = 0xFF00; + blueIncrement = 0xFF; + } + + /* All edge count at the left of the clipRect are added there (at the left of the clipRect). + The effect is the same, and we need to clean up less stuff afterwards. + More important, it avoids trying to acess pixels outside our form, i.e. invalid array acesses. */ + prevYTruncated = thisYTruncated; + pixelIndexBase = pixelY * targetWidth; + + /* take the next red subpixel center to the right of x */ + redOffset = (((((sqInt)((x + subPixelDelta) + 1))) < clipLeft) ? clipLeft : (((sqInt)((x + subPixelDelta) + 1)))); + + /* take the next green subpixel center to the right of x */ + greenOffset = (((((sqInt)(x + 1))) < clipLeft) ? clipLeft : (((sqInt)(x + 1)))); + + /* take the next blue subpixel center to the right of x */ + blueOffset = (((((sqInt)((x - subPixelDelta) + 1))) < clipLeft) ? clipLeft : (((sqInt)((x - subPixelDelta) + 1)))); + redPixelIndex = pixelIndexBase + redOffset; + greenPixelIndex = pixelIndexBase + greenOffset; + + /* Three possible cases here: RGB in one word (pixel); RG in one, and G in another; R in one, GB in another */ + bluePixelIndex = pixelIndexBase + blueOffset; + if (redPixelIndex == bluePixelIndex) { + + /* First case: RGB in the same word */ + if (redOffset <= clipRight) { + countWord = edgeCounts[redPixelIndex]; + redCount = (countWord + redIncrement) & 0xFF0000; + greenCount = (countWord + greenIncrement) & 0xFF00; + blueCount = (countWord + blueIncrement) & 0xFF; + countWord = (redCount | greenCount) | blueCount; + edgeCounts[redPixelIndex] = countWord; + } + } + else { + if (redPixelIndex == greenPixelIndex) { + + /* Second case: RG in one word, B in previous */ + if (redOffset <= clipRight) { + countWord = edgeCounts[redPixelIndex]; + redCount = (countWord + redIncrement) & 0xFF0000; + greenCount = (countWord + greenIncrement) & 0xFF00; + rest = countWord & 0xFF; + countWord = (redCount | greenCount) | rest; + edgeCounts[redPixelIndex] = countWord; + } + if (blueOffset <= clipRight) { + countWord = edgeCounts[bluePixelIndex]; + rest = countWord & 0xFFFF00; + blueCount = (countWord + blueIncrement) & 0xFF; + countWord = rest | blueCount; + edgeCounts[bluePixelIndex] = countWord; + } + } + else { + + /* Third case: R in one word, GB in the previous */ + if (redOffset <= clipRight) { + countWord = edgeCounts[redPixelIndex]; + redCount = (countWord + redIncrement) & 0xFF0000; + rest = countWord & 0xFFFF; + countWord = redCount | rest; + edgeCounts[redPixelIndex] = countWord; + } + if (blueOffset <= clipRight) { + countWord = edgeCounts[bluePixelIndex]; + rest = countWord & 0xFF0000; + greenCount = (countWord + greenIncrement) & 0xFF00; + blueCount = (countWord + blueIncrement) & 0xFF; + countWord = (rest | greenCount) | blueCount; + edgeCounts[bluePixelIndex] = countWord; + } + } + } + return 0; +} + + +/* Compute edges intersecting with this horizontal line, for fills. */ + + /* VectorEnginePlugin>>#updateEdgeCountWPAtX:y: */ +static sqInt +updateEdgeCountWPAtXy(float x, float y) +{ + uint8_t count; + uint8_t increment; + sqInt pixelIndex; + sqInt pixelOffset; + sqInt pixelY; + sqInt thisYTruncated; + + + /* truncated, both in C and Smalltalk */ + thisYTruncated = ((sqInt)y); + if (thisYTruncated == prevYTruncated) { + return 0; + } + if (!(((thisYTruncated >= (clipTop - 1)) && (thisYTruncated <= clipBottom)))) { + return 0; + } + if (prevYTruncated == 0x7FFFFFFF) { + prevYTruncated = thisYTruncated; + return 0; + } + if (thisYTruncated > prevYTruncated) { + pixelY = thisYTruncated; + increment = 1; + } + else { + pixelY = prevYTruncated; + increment = 0xFF; + } + + /* All edge count at the left of the clipRect are added there (at the left of the clipRect). + The effect is the same, and we need to clean up less stuff afterwards. + More important, it avoids trying to acess pixels outside our form, i.e. invalid array acesses. */ + prevYTruncated = thisYTruncated; + + /* take the next pixel center to the right of x */ + pixelOffset = (((((sqInt)(x + 1))) < clipLeft) ? clipLeft : (((sqInt)(x + 1)))); + if (pixelOffset <= clipRight) { + pixelIndex = (pixelY * targetWidth) + pixelOffset; + count = edgeCountsWP[pixelIndex]; + count += increment; + edgeCountsWP[pixelIndex] = count; + } + return 0; +} + + +#ifdef SQUEAK_BUILTIN_PLUGIN + +static char _m[] = "VectorEnginePlugin"; +void* VectorEnginePlugin_exports[][3] = { + {(void*)_m, "getModuleName", (void*)getModuleName}, + {(void*)_m, "pluginApiVersion", (void*)pluginApiVersion}, + {(void*)_m, "primAntiAliasingWidthsubPixelDeltaHopLength", (void*)primAntiAliasingWidthsubPixelDeltaHopLength}, + {(void*)_m, "primArc", (void*)primArc}, + {(void*)_m, "primArcWP", (void*)primArcWP}, + {(void*)_m, "primBlendFillOnly", (void*)primBlendFillOnly}, + {(void*)_m, "primBlendFillOnlyWPOT", (void*)primBlendFillOnlyWPOT}, + {(void*)_m, "primBlendStrokeAndFill", (void*)primBlendStrokeAndFill}, + {(void*)_m, "primBlendStrokeAndFillWPOT", (void*)primBlendStrokeAndFillWPOT}, + {(void*)_m, "primBlendStrokeOnly", (void*)primBlendStrokeOnly}, + {(void*)_m, "primBlendStrokeOnlyWPOT", (void*)primBlendStrokeOnlyWPOT}, + {(void*)_m, "primClipCurrentMorph", (void*)primClipCurrentMorph}, + {(void*)_m, "primClipLeftclipTopclipRightclipBottom", (void*)primClipLeftclipTopclipRightclipBottom}, + {(void*)_m, "primCubicBezier", (void*)primCubicBezier}, + {(void*)_m, "primCubicBezierWP", (void*)primCubicBezierWP}, + {(void*)_m, "primCurrentMorphIdcurrentClipsSubmorphs", (void*)primCurrentMorphIdcurrentClipsSubmorphs}, + {(void*)_m, "primDisplayString", (void*)primDisplayString}, + {(void*)_m, "primDisplayStringWP", (void*)primDisplayStringWP}, + {(void*)_m, "primDisplayUtf32", (void*)primDisplayUtf32}, + {(void*)_m, "primDisplayUtf32WP", (void*)primDisplayUtf32WP}, + {(void*)_m, "primDisplayUtf8", (void*)primDisplayUtf8}, + {(void*)_m, "primDisplayUtf8WP", (void*)primDisplayUtf8WP}, + {(void*)_m, "primFillRGBA", (void*)primFillRGBA}, + {(void*)_m, "primGeometryTxSet", (void*)primGeometryTxSet}, + {(void*)_m, "primInitializePath", (void*)primInitializePath}, + {(void*)_m, "primLine", (void*)primLine}, + {(void*)_m, "primLineWP", (void*)primLineWP}, + {(void*)_m, "primNewTrajectoryFragment", (void*)primNewTrajectoryFragment}, + {(void*)_m, "primPathSequence", (void*)primPathSequence}, + {(void*)_m, "primPathSequenceWP", (void*)primPathSequenceWP}, + {(void*)_m, "primQuadraticBezier", (void*)primQuadraticBezier}, + {(void*)_m, "primQuadraticBezierWP", (void*)primQuadraticBezierWP}, + {(void*)_m, "primResetContour", (void*)primResetContour}, + {(void*)_m, "primSetTarget", (void*)primSetTarget}, + {(void*)_m, "primSetTargetWP", (void*)primSetTargetWP}, + {(void*)_m, "primSpanBottom", (void*)primSpanBottom}, + {(void*)_m, "primSpanLeft", (void*)primSpanLeft}, + {(void*)_m, "primSpanRight", (void*)primSpanRight}, + {(void*)_m, "primSpanTop", (void*)primSpanTop}, + {(void*)_m, "primStrokeRGBA", (void*)primStrokeRGBA}, + {(void*)_m, "primStrokeWidth", (void*)primStrokeWidth}, + {(void*)_m, "primUpdateContourLastLine", (void*)primUpdateContourLastLine}, + {(void*)_m, "setInterpreter", (void*)setInterpreter}, + {NULL, NULL, NULL} +}; + +#else /* ifdef SQ_BUILTIN_PLUGIN */ + + +#endif /* ifdef SQ_BUILTIN_PLUGIN */ diff --git a/src/plugins/WeDoPlugin/WeDoPlugin.c b/src/plugins/WeDoPlugin/WeDoPlugin.c index 9f16978384..d7d019ef32 100644 --- a/src/plugins/WeDoPlugin/WeDoPlugin.c +++ b/src/plugins/WeDoPlugin/WeDoPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - WeDoPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + WeDoPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "WeDoPlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "WeDoPlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -66,7 +66,7 @@ extern sqInt success(sqInt aBoolean); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "WeDoPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "WeDoPlugin VMMaker.oscog-eem.3024 " INT_EXT; @@ -209,17 +209,19 @@ setInterpreter(struct VirtualMachine *anInterpreter) static char _m[] = "WeDoPlugin"; void* WeDoPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primClosePort\000\377", (void*)primClosePort}, - {(void*)_m, "primOpenPort\000\377", (void*)primOpenPort}, - {(void*)_m, "primRead\000\000", (void*)primRead}, - {(void*)_m, "primWrite\000\000", (void*)primWrite}, + {(void*)_m, "primClosePort\000\377\000", (void*)primClosePort}, + {(void*)_m, "primOpenPort\000\377\000", (void*)primOpenPort}, + {(void*)_m, "primRead\000\000\000", (void*)primRead}, + {(void*)_m, "primWrite\000\000\000", (void*)primWrite}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primReadAccessorDepth = 0; -EXPORT(signed char) primWriteAccessorDepth = 0; +#if SPURVM +EXPORT(signed short) primReadMetadata = 0; +EXPORT(signed short) primWriteMetadata = 0; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c b/src/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c index fa751b343a..4aa3423dfe 100644 --- a/src/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c +++ b/src/plugins/Win32OSProcessPlugin/Win32OSProcessPlugin.c @@ -1,5 +1,5 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from Win32OSProcessPlugin VMConstruction-Plugins-OSProcessPlugin.oscog-eem.73 uuid: 78f4b0c0-0615-44be-81ad-5804b1f8a80c */ @@ -2599,69 +2599,71 @@ static char _m[] = "Win32OSProcessPlugin"; void* Win32OSProcessPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, - {(void*)_m, "primitiveAllocConsole\000\377", (void*)primitiveAllocConsole}, - {(void*)_m, "primitiveBufferValuesAt\000\001", (void*)primitiveBufferValuesAt}, - {(void*)_m, "primitiveCanAccessChildProcess\000\001", (void*)primitiveCanAccessChildProcess}, - {(void*)_m, "primitiveCloseHandle\000\001", (void*)primitiveCloseHandle}, - {(void*)_m, "primitiveCommand\000\002", (void*)primitiveCommand}, - {(void*)_m, "primitiveCommandWithInputOutputError\000\002", (void*)primitiveCommandWithInputOutputError}, - {(void*)_m, "primitiveCreatePipe\000\377", (void*)primitiveCreatePipe}, - {(void*)_m, "primitiveCreatePipeWithSessionIdentifier\000\001", (void*)primitiveCreatePipeWithSessionIdentifier}, - {(void*)_m, "primitiveFixPointersInArrayOfStrings\000\001", (void*)primitiveFixPointersInArrayOfStrings}, - {(void*)_m, "primitiveFreeConsole\000\377", (void*)primitiveFreeConsole}, - {(void*)_m, "primitiveGetCurrentWorkingDirectory\000\377", (void*)primitiveGetCurrentWorkingDirectory}, - {(void*)_m, "primitiveGetCurrentWorkingDirectoryAsBytes\000\377", (void*)primitiveGetCurrentWorkingDirectoryAsBytes}, - {(void*)_m, "primitiveGetEnvironmentStrings\000\377", (void*)primitiveGetEnvironmentStrings}, - {(void*)_m, "primitiveGetEnvironmentStringsAsBytes\000\377", (void*)primitiveGetEnvironmentStringsAsBytes}, - {(void*)_m, "primitiveGetExitStatusForHandle\000\001", (void*)primitiveGetExitStatusForHandle}, - {(void*)_m, "primitiveGetMainThreadHandle\000\377", (void*)primitiveGetMainThreadHandle}, - {(void*)_m, "primitiveGetMainThreadID\000\377", (void*)primitiveGetMainThreadID}, - {(void*)_m, "primitiveGetPid\000\377", (void*)primitiveGetPid}, - {(void*)_m, "primitiveGetPidHandle\000\377", (void*)primitiveGetPidHandle}, - {(void*)_m, "primitiveGetSession\000\377", (void*)primitiveGetSession}, - {(void*)_m, "primitiveGetStdError\000\001", (void*)primitiveGetStdError}, - {(void*)_m, "primitiveGetStdInput\000\001", (void*)primitiveGetStdInput}, - {(void*)_m, "primitiveGetStdOutput\000\001", (void*)primitiveGetStdOutput}, - {(void*)_m, "primitiveLastReadFor\000\000", (void*)primitiveLastReadFor}, - {(void*)_m, "primitiveLastReadForStoreIn\000\000", (void*)primitiveLastReadForStoreIn}, - {(void*)_m, "primitiveMakePipe\000\377", (void*)primitiveMakePipe}, - {(void*)_m, "primitiveMakePipeWithSessionIdentifier\000\001", (void*)primitiveMakePipeWithSessionIdentifier}, - {(void*)_m, "primitiveModuleName\000\377", (void*)primitiveModuleName}, - {(void*)_m, "primitiveNextFromSignaling\000\001", (void*)primitiveNextFromSignaling}, - {(void*)_m, "primitiveOneShot\000\377", (void*)primitiveOneShot}, - {(void*)_m, "primitiveSetStdErr\000\001", (void*)primitiveSetStdErr}, - {(void*)_m, "primitiveSetStdIn\000\001", (void*)primitiveSetStdIn}, - {(void*)_m, "primitiveSetStdOut\000\001", (void*)primitiveSetStdOut}, - {(void*)_m, "primitiveSetWaitForAnyProcessExitThenSignalSemaphoreWithIndex\000\001", (void*)primitiveSetWaitForAnyProcessExitThenSignalSemaphoreWithIndex}, - {(void*)_m, "primitiveSizeOfInt\000\377", (void*)primitiveSizeOfInt}, - {(void*)_m, "primitiveSizeOfPointer\000\377", (void*)primitiveSizeOfPointer}, - {(void*)_m, "primitiveTerminateThread\000\001", (void*)primitiveTerminateThread}, - {(void*)_m, "primitiveVersionString\000\377", (void*)primitiveVersionString}, + {(void*)_m, "primitiveAllocConsole\000\377\000", (void*)primitiveAllocConsole}, + {(void*)_m, "primitiveBufferValuesAt\000\001\000", (void*)primitiveBufferValuesAt}, + {(void*)_m, "primitiveCanAccessChildProcess\000\001\000", (void*)primitiveCanAccessChildProcess}, + {(void*)_m, "primitiveCloseHandle\000\001\000", (void*)primitiveCloseHandle}, + {(void*)_m, "primitiveCommand\000\002\000", (void*)primitiveCommand}, + {(void*)_m, "primitiveCommandWithInputOutputError\000\002\000", (void*)primitiveCommandWithInputOutputError}, + {(void*)_m, "primitiveCreatePipe\000\377\000", (void*)primitiveCreatePipe}, + {(void*)_m, "primitiveCreatePipeWithSessionIdentifier\000\001\000", (void*)primitiveCreatePipeWithSessionIdentifier}, + {(void*)_m, "primitiveFixPointersInArrayOfStrings\000\001\000", (void*)primitiveFixPointersInArrayOfStrings}, + {(void*)_m, "primitiveFreeConsole\000\377\000", (void*)primitiveFreeConsole}, + {(void*)_m, "primitiveGetCurrentWorkingDirectory\000\377\000", (void*)primitiveGetCurrentWorkingDirectory}, + {(void*)_m, "primitiveGetCurrentWorkingDirectoryAsBytes\000\377\000", (void*)primitiveGetCurrentWorkingDirectoryAsBytes}, + {(void*)_m, "primitiveGetEnvironmentStrings\000\377\000", (void*)primitiveGetEnvironmentStrings}, + {(void*)_m, "primitiveGetEnvironmentStringsAsBytes\000\377\000", (void*)primitiveGetEnvironmentStringsAsBytes}, + {(void*)_m, "primitiveGetExitStatusForHandle\000\001\000", (void*)primitiveGetExitStatusForHandle}, + {(void*)_m, "primitiveGetMainThreadHandle\000\377\000", (void*)primitiveGetMainThreadHandle}, + {(void*)_m, "primitiveGetMainThreadID\000\377\000", (void*)primitiveGetMainThreadID}, + {(void*)_m, "primitiveGetPid\000\377\000", (void*)primitiveGetPid}, + {(void*)_m, "primitiveGetPidHandle\000\377\000", (void*)primitiveGetPidHandle}, + {(void*)_m, "primitiveGetSession\000\377\000", (void*)primitiveGetSession}, + {(void*)_m, "primitiveGetStdError\000\001\000", (void*)primitiveGetStdError}, + {(void*)_m, "primitiveGetStdInput\000\001\000", (void*)primitiveGetStdInput}, + {(void*)_m, "primitiveGetStdOutput\000\001\000", (void*)primitiveGetStdOutput}, + {(void*)_m, "primitiveLastReadFor\000\000\000", (void*)primitiveLastReadFor}, + {(void*)_m, "primitiveLastReadForStoreIn\000\000\000", (void*)primitiveLastReadForStoreIn}, + {(void*)_m, "primitiveMakePipe\000\377\000", (void*)primitiveMakePipe}, + {(void*)_m, "primitiveMakePipeWithSessionIdentifier\000\001\000", (void*)primitiveMakePipeWithSessionIdentifier}, + {(void*)_m, "primitiveModuleName\000\377\000", (void*)primitiveModuleName}, + {(void*)_m, "primitiveNextFromSignaling\000\001\000", (void*)primitiveNextFromSignaling}, + {(void*)_m, "primitiveOneShot\000\377\000", (void*)primitiveOneShot}, + {(void*)_m, "primitiveSetStdErr\000\001\000", (void*)primitiveSetStdErr}, + {(void*)_m, "primitiveSetStdIn\000\001\000", (void*)primitiveSetStdIn}, + {(void*)_m, "primitiveSetStdOut\000\001\000", (void*)primitiveSetStdOut}, + {(void*)_m, "primitiveSetWaitForAnyProcessExitThenSignalSemaphoreWithIndex\000\001\000", (void*)primitiveSetWaitForAnyProcessExitThenSignalSemaphoreWithIndex}, + {(void*)_m, "primitiveSizeOfInt\000\377\000", (void*)primitiveSizeOfInt}, + {(void*)_m, "primitiveSizeOfPointer\000\377\000", (void*)primitiveSizeOfPointer}, + {(void*)_m, "primitiveTerminateThread\000\001\000", (void*)primitiveTerminateThread}, + {(void*)_m, "primitiveVersionString\000\377\000", (void*)primitiveVersionString}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ - -EXPORT(signed char) primitiveBufferValuesAtAccessorDepth = 1; -EXPORT(signed char) primitiveCanAccessChildProcessAccessorDepth = 1; -EXPORT(signed char) primitiveCloseHandleAccessorDepth = 1; -EXPORT(signed char) primitiveCommandAccessorDepth = 2; -EXPORT(signed char) primitiveCommandWithInputOutputErrorAccessorDepth = 2; -EXPORT(signed char) primitiveCreatePipeWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveFixPointersInArrayOfStringsAccessorDepth = 1; -EXPORT(signed char) primitiveGetExitStatusForHandleAccessorDepth = 1; -EXPORT(signed char) primitiveGetStdErrorAccessorDepth = 1; -EXPORT(signed char) primitiveGetStdInputAccessorDepth = 1; -EXPORT(signed char) primitiveGetStdOutputAccessorDepth = 1; -EXPORT(signed char) primitiveLastReadForAccessorDepth = 0; -EXPORT(signed char) primitiveLastReadForStoreInAccessorDepth = 0; -EXPORT(signed char) primitiveMakePipeWithSessionIdentifierAccessorDepth = 1; -EXPORT(signed char) primitiveNextFromSignalingAccessorDepth = 1; -EXPORT(signed char) primitiveSetStdErrAccessorDepth = 1; -EXPORT(signed char) primitiveSetStdInAccessorDepth = 1; -EXPORT(signed char) primitiveSetStdOutAccessorDepth = 1; -EXPORT(signed char) primitiveSetWaitForAnyProcessExitThenSignalSemaphoreWithIndexAccessorDepth = 1; -EXPORT(signed char) primitiveTerminateThreadAccessorDepth = 1; - -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN + +#if SPURVM +EXPORT(signed short) primitiveBufferValuesAtMetadata = 0x100; +EXPORT(signed short) primitiveCanAccessChildProcessMetadata = 0x100; +EXPORT(signed short) primitiveCloseHandleMetadata = 0x100; +EXPORT(signed short) primitiveCommandMetadata = 0x200; +EXPORT(signed short) primitiveCommandWithInputOutputErrorMetadata = 0x200; +EXPORT(signed short) primitiveCreatePipeWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveFixPointersInArrayOfStringsMetadata = 0x100; +EXPORT(signed short) primitiveGetExitStatusForHandleMetadata = 0x100; +EXPORT(signed short) primitiveGetStdErrorMetadata = 0x100; +EXPORT(signed short) primitiveGetStdInputMetadata = 0x100; +EXPORT(signed short) primitiveGetStdOutputMetadata = 0x100; +EXPORT(signed short) primitiveLastReadForMetadata = 0; +EXPORT(signed short) primitiveLastReadForStoreInMetadata = 0; +EXPORT(signed short) primitiveMakePipeWithSessionIdentifierMetadata = 0x100; +EXPORT(signed short) primitiveNextFromSignalingMetadata = 0x100; +EXPORT(signed short) primitiveSetStdErrMetadata = 0x100; +EXPORT(signed short) primitiveSetStdInMetadata = 0x100; +EXPORT(signed short) primitiveSetStdOutMetadata = 0x100; +EXPORT(signed short) primitiveSetWaitForAnyProcessExitThenSignalSemaphoreWithIndexMetadata = 0x100; +EXPORT(signed short) primitiveTerminateThreadMetadata = 0x100; +#endif // SPURVM + +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c b/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c index 5a7830c9d3..64c384ba65 100644 --- a/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c +++ b/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c @@ -1,5 +1,5 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from XDisplayControlPlugin VMConstruction-Plugins-XDisplayControlPlugin.oscog-eem.19 uuid: 51bf0a7a-bd19-4c35-9f1f-2d67c4cde3c4 */ @@ -510,23 +510,25 @@ void* XDisplayControlPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, {(void*)_m, "initialiseModule", (void*)initialiseModule}, {(void*)_m, "moduleUnloaded", (void*)moduleUnloaded}, - {(void*)_m, "primitiveCanConnectToDisplay\000\001", (void*)primitiveCanConnectToDisplay}, - {(void*)_m, "primitiveDisconnectDisplay\000\377", (void*)primitiveDisconnectDisplay}, - {(void*)_m, "primitiveFlushDisplay\000\377", (void*)primitiveFlushDisplay}, - {(void*)_m, "primitiveGetDisplayName\000\377", (void*)primitiveGetDisplayName}, - {(void*)_m, "primitiveIsConnectedToDisplay\000\377", (void*)primitiveIsConnectedToDisplay}, - {(void*)_m, "primitiveKillDisplay\000\377", (void*)primitiveKillDisplay}, - {(void*)_m, "primitiveModuleName\000\377", (void*)primitiveModuleName}, - {(void*)_m, "primitiveOpenDisplay\000\377", (void*)primitiveOpenDisplay}, - {(void*)_m, "primitiveSetDisplayName\000\001", (void*)primitiveSetDisplayName}, - {(void*)_m, "primitiveVersionString\000\377", (void*)primitiveVersionString}, + {(void*)_m, "primitiveCanConnectToDisplay\000\001\000", (void*)primitiveCanConnectToDisplay}, + {(void*)_m, "primitiveDisconnectDisplay\000\377\000", (void*)primitiveDisconnectDisplay}, + {(void*)_m, "primitiveFlushDisplay\000\377\000", (void*)primitiveFlushDisplay}, + {(void*)_m, "primitiveGetDisplayName\000\377\000", (void*)primitiveGetDisplayName}, + {(void*)_m, "primitiveIsConnectedToDisplay\000\377\000", (void*)primitiveIsConnectedToDisplay}, + {(void*)_m, "primitiveKillDisplay\000\377\000", (void*)primitiveKillDisplay}, + {(void*)_m, "primitiveModuleName\000\377\000", (void*)primitiveModuleName}, + {(void*)_m, "primitiveOpenDisplay\000\377\000", (void*)primitiveOpenDisplay}, + {(void*)_m, "primitiveSetDisplayName\000\001\000", (void*)primitiveSetDisplayName}, + {(void*)_m, "primitiveVersionString\000\377\000", (void*)primitiveVersionString}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveCanConnectToDisplayAccessorDepth = 1; -EXPORT(signed char) primitiveSetDisplayNameAccessorDepth = 1; +#if SPURVM +EXPORT(signed short) primitiveCanConnectToDisplayMetadata = 0x100; +EXPORT(signed short) primitiveSetDisplayNameMetadata = 0x100; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN diff --git a/src/plugins/ZipPlugin/ZipPlugin.c b/src/plugins/ZipPlugin/ZipPlugin.c index 496c26c267..2b99afa6cb 100644 --- a/src/plugins/ZipPlugin/ZipPlugin.c +++ b/src/plugins/ZipPlugin/ZipPlugin.c @@ -1,9 +1,9 @@ /* Automatically generated by - VMPluginCodeGenerator VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + VMPluginCodeGenerator VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 from - DeflatePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 + DeflatePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 */ -static char __buildInfo[] = "DeflatePlugin VMMaker.oscog-eem.2950 uuid: dbcba85e-dc26-495f-9ce8-aa01633f6aa5 " __DATE__ ; +static char __buildInfo[] = "DeflatePlugin VMMaker.oscog-eem.3024 uuid: 417aa150-be4e-4631-b35b-948afa18e190 " __DATE__ ; #include "config.h" @@ -134,7 +134,7 @@ extern sqInt superclassOf(sqInt classPointer); extern #endif struct VirtualMachine* interpreterProxy; -static const char *moduleName = "ZipPlugin VMMaker.oscog-eem.2950 " INT_EXT; +static const char *moduleName = "ZipPlugin VMMaker.oscog-eem.3024 " INT_EXT; static sqInt readStreamInstSize; static sqInt writeStreamInstSize; static unsigned int zipBaseDistance[] = { @@ -1859,23 +1859,25 @@ zipNextBits(sqInt n) static char _m[] = "ZipPlugin"; void* ZipPlugin_exports[][3] = { {(void*)_m, "getModuleName", (void*)getModuleName}, - {(void*)_m, "primitiveDeflateBlock\000\002", (void*)primitiveDeflateBlock}, - {(void*)_m, "primitiveDeflateUpdateHashTable\000\001", (void*)primitiveDeflateUpdateHashTable}, - {(void*)_m, "primitiveInflateDecompressBlock\000\002", (void*)primitiveInflateDecompressBlock}, - {(void*)_m, "primitiveUpdateAdler32\000\001", (void*)primitiveUpdateAdler32}, - {(void*)_m, "primitiveUpdateGZipCrc32\000\001", (void*)primitiveUpdateGZipCrc32}, - {(void*)_m, "primitiveZipSendBlock\000\002", (void*)primitiveZipSendBlock}, + {(void*)_m, "primitiveDeflateBlock\000\002\000", (void*)primitiveDeflateBlock}, + {(void*)_m, "primitiveDeflateUpdateHashTable\000\001\000", (void*)primitiveDeflateUpdateHashTable}, + {(void*)_m, "primitiveInflateDecompressBlock\000\002\000", (void*)primitiveInflateDecompressBlock}, + {(void*)_m, "primitiveUpdateAdler32\000\001\000", (void*)primitiveUpdateAdler32}, + {(void*)_m, "primitiveUpdateGZipCrc32\000\001\000", (void*)primitiveUpdateGZipCrc32}, + {(void*)_m, "primitiveZipSendBlock\000\002\000", (void*)primitiveZipSendBlock}, {(void*)_m, "setInterpreter", (void*)setInterpreter}, {NULL, NULL, NULL} }; -#else /* ifdef SQ_BUILTIN_PLUGIN */ +#else // ifdef SQ_BUILTIN_PLUGIN -EXPORT(signed char) primitiveDeflateBlockAccessorDepth = 2; -EXPORT(signed char) primitiveDeflateUpdateHashTableAccessorDepth = 1; -EXPORT(signed char) primitiveInflateDecompressBlockAccessorDepth = 2; -EXPORT(signed char) primitiveUpdateAdler32AccessorDepth = 1; -EXPORT(signed char) primitiveUpdateGZipCrc32AccessorDepth = 1; -EXPORT(signed char) primitiveZipSendBlockAccessorDepth = 2; +#if SPURVM +EXPORT(signed short) primitiveDeflateBlockMetadata = 0x200; +EXPORT(signed short) primitiveDeflateUpdateHashTableMetadata = 0x100; +EXPORT(signed short) primitiveInflateDecompressBlockMetadata = 0x200; +EXPORT(signed short) primitiveUpdateAdler32Metadata = 0x100; +EXPORT(signed short) primitiveUpdateGZipCrc32Metadata = 0x100; +EXPORT(signed short) primitiveZipSendBlockMetadata = 0x200; +#endif // SPURVM -#endif /* ifdef SQ_BUILTIN_PLUGIN */ +#endif // ifdef SQ_BUILTIN_PLUGIN