Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement InterpreterProxy #175

Merged
merged 164 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
a3a9490
[skip ci] Test NFI for non-existent named primitives
DieKautz Nov 5, 2023
a5bb9a0
[skip ci] Add initial createInterpreterProxy function in C
MariusDoe Nov 5, 2023
63632dc
Add stub methods for interpreter proxy
DieKautz Nov 10, 2023
34cafd2
Implement ByteStorage using extended UnsafeUtils and add TruffleExecu…
MariusDoe Nov 11, 2023
a4a53ad
Set absolute library path (for now)
DieKautz Nov 15, 2023
bb0e12b
Create InterpreterProxy and extract inner classes
DieKautz Nov 15, 2023
ea1f4ce
Fix argument
DieKautz Nov 15, 2023
25f9726
Generalize ByteStorage
DieKautz Nov 15, 2023
4ba75fc
Remove redundant fully-qualified class name
DieKautz Nov 16, 2023
f88ae6d
Do not assume ByteStorage
DieKautz Nov 16, 2023
f340233
Get correct byteSize for storage type
DieKautz Nov 16, 2023
cb53d61
Return isBytes by storage type
DieKautz Nov 16, 2023
bcc3f00
Stub symbols needed to support SqueakSSL
DieKautz Nov 16, 2023
2185699
Towards using SqueakSSL.so
MariusDoe Nov 18, 2023
d2498bb
Fix stack pointer before running C code
MariusDoe Nov 20, 2023
36a22fa
Use MaterializedFrames
MariusDoe Nov 25, 2023
78c60d1
Fix off-by-one in pre-call stackPointer adjustment
MariusDoe Nov 25, 2023
042a901
Fix stack access using stackPointer
MariusDoe Nov 25, 2023
903e974
Only load libraries once
MariusDoe Nov 25, 2023
1f6ce90
Add NFIUtils.loadMember
MariusDoe Nov 25, 2023
87ca9d3
Add loading of function symbols
MariusDoe Nov 25, 2023
1e4983b
Fix handling of return values
MariusDoe Nov 25, 2023
ff31a64
Keep TruffleExecutables in memory
MariusDoe Nov 25, 2023
0f5a24d
Make `ffi.native` use CMakeNinjaProject
DieKautz Nov 29, 2023
44cffa8
Format
DieKautz Nov 29, 2023
8a9252c
Load nfi libraries from image path
DieKautz Nov 29, 2023
5dae186
Import is not actually unused
DieKautz Nov 29, 2023
d7025ec
Prevent NFI closures from being freed
MariusDoe Dec 4, 2023
b1cb5c2
Add missing stubs from BitBlt support
DieKautz Dec 14, 2023
fd3453b
Implement some stubs and refactor
MariusDoe Dec 18, 2023
b7a18b1
[skip ci] Test NFI for non-existent named primitives
DieKautz Nov 5, 2023
e56b723
[skip ci] Add initial createInterpreterProxy function in C
MariusDoe Nov 5, 2023
bec7a02
Add stub methods for interpreter proxy
DieKautz Nov 10, 2023
0cd1f04
Implement ByteStorage using extended UnsafeUtils and add TruffleExecu…
MariusDoe Nov 11, 2023
71d775a
Set absolute library path (for now)
DieKautz Nov 15, 2023
e5340bc
Create InterpreterProxy and extract inner classes
DieKautz Nov 15, 2023
3f75e6a
Fix argument
DieKautz Nov 15, 2023
182f756
Generalize ByteStorage
DieKautz Nov 15, 2023
88a3972
Remove redundant fully-qualified class name
DieKautz Nov 16, 2023
8c9b050
Do not assume ByteStorage
DieKautz Nov 16, 2023
4e3d7d6
Get correct byteSize for storage type
DieKautz Nov 16, 2023
b64f5fb
Return isBytes by storage type
DieKautz Nov 16, 2023
fd1207c
Stub symbols needed to support SqueakSSL
DieKautz Nov 16, 2023
d6a4348
Towards using SqueakSSL.so
MariusDoe Nov 18, 2023
1c28473
Fix stack pointer before running C code
MariusDoe Nov 20, 2023
f08b4d3
Use MaterializedFrames
MariusDoe Nov 25, 2023
834e86b
Fix off-by-one in pre-call stackPointer adjustment
MariusDoe Nov 25, 2023
b01faa3
Fix stack access using stackPointer
MariusDoe Nov 25, 2023
ed23920
Only load libraries once
MariusDoe Nov 25, 2023
cb2d874
Add NFIUtils.loadMember
MariusDoe Nov 25, 2023
7bbb148
Add loading of function symbols
MariusDoe Nov 25, 2023
47b0127
Fix handling of return values
MariusDoe Nov 25, 2023
b64dd0b
Keep TruffleExecutables in memory
MariusDoe Nov 25, 2023
e5527bf
Make `ffi.native` use CMakeNinjaProject
DieKautz Nov 29, 2023
4578bd0
Format
DieKautz Nov 29, 2023
d1d1af4
Load nfi libraries from image path
DieKautz Nov 29, 2023
7511542
Import is not actually unused
DieKautz Nov 29, 2023
5c654e0
Prevent NFI closures from being freed
MariusDoe Dec 4, 2023
2fec6a4
Add missing stubs from BitBlt support
DieKautz Dec 14, 2023
366d95e
Implement some stubs and refactor
MariusDoe Dec 18, 2023
73e905d
Merge remote-tracking branch 'origin/wip/interpreter-proxy' into wip/…
DieKautz Dec 18, 2023
fd44984
Define supported VM_PROXY version
DieKautz Dec 18, 2023
e9d2e7e
Switch to newly introduced executeUncached
DieKautz Dec 18, 2023
67cf73d
Implement statNumGCs
DieKautz Dec 18, 2023
10e8a39
Clean up, regroup and comment NonExistentPrimitiveNode
MariusDoe Dec 21, 2023
ff2d639
Extract NonExistentPrimitiveNode
MariusDoe Dec 21, 2023
1da892b
Merge branch 'wip/interpreter-proxy' of https://github.com/hpi-swa/tr…
MariusDoe Dec 21, 2023
b93d7cc
Rename NonExistentPrimitiveNode to PrimExternalCallNode
MariusDoe Dec 21, 2023
4b9803a
Extract PostPrimitiveCleanup interface
MariusDoe Dec 21, 2023
4b33169
Refactor, organize and clean up InterpreterProxy
MariusDoe Dec 21, 2023
ef8d1ef
Move nativeAddress assignment into toNative
MariusDoe Dec 21, 2023
3ea777d
Refactor and reorder NFIUtils
MariusDoe Dec 21, 2023
c13ef1c
Use Predicate instead of Function
MariusDoe Dec 21, 2023
71e707b
Add copy note
MariusDoe Dec 21, 2023
9740643
Apply eclipseformat
DieKautz Dec 21, 2023
729be53
Use size in instantiateClassindexableSize
MariusDoe Dec 21, 2023
df32541
Suppress unused parameters warnings in stubs
MariusDoe Dec 21, 2023
e8ab255
Make InterpreterProxy.objectAt0 static
MariusDoe Dec 21, 2023
a25ca3d
Remove unnecessary ExportLibrary annotations
MariusDoe Dec 21, 2023
1a2e07e
Add guard for missing primitivePluginVersion on SqueakFFIPrims
DieKautz Dec 21, 2023
f47e0aa
Make parameters and variables final as advised by checkstyle
DieKautz Dec 21, 2023
347b856
Use LogUtils
DieKautz Dec 21, 2023
9c62c27
Apply misc suggestions
DieKautz Dec 21, 2023
f8fdb68
Rename references to uuidPlugin
DieKautz Dec 21, 2023
514baf6
Mark storage class and field as final
DieKautz Jan 8, 2024
5cdf731
Mark class final
DieKautz Jan 8, 2024
c635acc
Extract numBytes variables
DieKautz Jan 8, 2024
dca71f9
Mark field final
DieKautz Jan 8, 2024
543d77d
Remove redundant initialisation
DieKautz Jan 8, 2024
552aeaf
Replace raw exception type with assertion
DieKautz Jan 8, 2024
a4d180f
Merge remote-tracking branch 'origin/main' into wip/interpreter-proxy
DieKautz Jan 8, 2024
d598774
Put most of external call behind a TruffleBoundary
fniephaus Jan 11, 2024
6ae678b
Add a TruffleBoundary to TruffleExecutable
fniephaus Jan 11, 2024
95fc76e
Extract loading from execute
DieKautz Jan 11, 2024
9e71b6d
Move error handling closer to throw
DieKautz Jan 11, 2024
04bc4c9
Move handling of InteropExceptions and detect modules without setInte…
MariusDoe Jan 15, 2024
7751b28
Optionally call initialiseModule
MariusDoe Jan 15, 2024
32620db
Add TruffleBoundary to oopFor
MariusDoe Jan 15, 2024
8d0979a
Fix checked loading of setInterpreter
MariusDoe Jan 18, 2024
35d143a
Update TODOs
MariusDoe Jan 18, 2024
cbd7fc9
Merge remote-tracking branch 'origin/wip/interpreter-proxy' into wip/…
DieKautz Jan 18, 2024
36348af
Utilize CompilerDirectives.shouldNotReachHere
DieKautz Jan 20, 2024
1b021d0
Write out exceptions, add reminder to remove debug log
DieKautz Jan 20, 2024
4f114ab
Remove never thrown exceptions
DieKautz Jan 20, 2024
abfd2a9
Suppress unchecked cast warning
DieKautz Jan 20, 2024
cc91a71
Merge remote-tracking branch 'origin/dev' into wip/interpreter-proxy
DieKautz Jan 20, 2024
8b6652f
Remove assignment to a non-final static field
DieKautz Jan 21, 2024
ba761ca
Remove unneeded supress
DieKautz Jan 21, 2024
de36be4
Adjust return value to match sqInt to java long
DieKautz Jan 21, 2024
af2c682
Add primFailCode
DieKautz Jan 21, 2024
42c7ed7
Supress unused warning for linter on all interpreter proxy methods
DieKautz Jan 22, 2024
510bf0b
Return current primFailCode
DieKautz Jan 22, 2024
9ed2ab1
Fail correctly
DieKautz Jan 22, 2024
8320f67
Compare and return long value
DieKautz Jan 22, 2024
aa365c5
Call setInterpreter just once
DieKautz Jan 22, 2024
705e254
Declare as static
DieKautz Jan 23, 2024
fa31696
Mark arguments as final
DieKautz Jan 24, 2024
56c1c52
Add missing copyright
DieKautz Jan 24, 2024
3b1b752
Remove TruffleBoundary
DieKautz Jan 24, 2024
78a3191
Check for identity instead of equality
DieKautz Feb 5, 2024
69db916
Remove redundant final
DieKautz Feb 5, 2024
7d2ae5e
Throw if failed
DieKautz Feb 5, 2024
cf16be3
Try to load external plugin before Java plugin
DieKautz Feb 5, 2024
cdc55a2
Check for plugins without 'lib' prefix for compatibility with opensma…
DieKautz Feb 5, 2024
1d8682e
Re-add @TruffleBoundary for closure execute
DieKautz Feb 5, 2024
4169948
Lint
DieKautz Feb 5, 2024
51ff062
Fix null libraries not entered into map
DieKautz Feb 5, 2024
026c166
Add missing return
DieKautz Feb 5, 2024
230be16
Declare final
DieKautz Feb 5, 2024
65776c9
Change replace to substring
DieKautz Feb 7, 2024
c3e179d
Remove printStackTrace
DieKautz Feb 7, 2024
c0d7c28
Extract returnBoolean
MariusDoe Feb 8, 2024
fd4b58a
Use InterpreterProxy terminology in conversion helpers
MariusDoe Feb 8, 2024
37c3411
Add explicit integerToObject conversion
MariusDoe Feb 8, 2024
41c9d84
Add hasSucceeded helper
MariusDoe Feb 8, 2024
8f906ee
Implement methodReturn*
MariusDoe Feb 8, 2024
ea6ce0a
Implement isIntegerObject
MariusDoe Feb 8, 2024
212b4e2
Implement stringForCString
MariusDoe Feb 8, 2024
782e45d
Add missing import for BooleanObject
MariusDoe Feb 8, 2024
77c1ccb
Implement class*
MariusDoe Feb 8, 2024
7a0476a
Implement booleanValueOf
MariusDoe Feb 8, 2024
7b680ae
Correct copyright headers and import order
fniephaus Feb 9, 2024
e86fa72
Register unused but implemented proxy methods
fniephaus Feb 9, 2024
4c7338d
Minor cleanups
fniephaus Feb 9, 2024
d88f0f9
Add false and true object for LocalePlugin
fniephaus Feb 9, 2024
a6be20b
Re-use plugins from OpenSmalltalkVM
fniephaus Feb 9, 2024
a59cd4f
Implement showDisplayBitsLeftTopRightBottom
fniephaus Feb 9, 2024
4a95838
Address ECJ warnings
fniephaus Feb 9, 2024
cf2f6b1
Add InterpreterProxy and loaded modules to context
fniephaus Feb 9, 2024
3d16b0c
Fix ordering of methods
MariusDoe Feb 9, 2024
be4897c
Properly implement stringForCString
MariusDoe Feb 9, 2024
763ee32
Readd push
MariusDoe Feb 9, 2024
54c6482
Fix ECJ warnings
fniephaus Feb 9, 2024
a6b073e
Upgrade actions used in workflow for Node 20
fniephaus Feb 9, 2024
dac1d2d
Add final to instanceof variable declarations
MariusDoe Feb 9, 2024
6eae7fc
Fix 0-based error code and do not overwrite
DieKautz Feb 9, 2024
0a657e2
Add 32bit casts
DieKautz Feb 9, 2024
5d5e92d
Fix long return values
DieKautz Feb 9, 2024
a577ca2
Move loadedLibraries into InterpreterProxy
fniephaus Feb 9, 2024
3889b4b
Drop `PostPrimitiveCleanup`
fniephaus Feb 9, 2024
9eaa707
Adjust visibility
fniephaus Feb 9, 2024
fac45ec
Implement positive64BitIntegerFor
DieKautz Feb 9, 2024
79e1ded
Fix ECJ warnings
fniephaus Feb 9, 2024
692a26c
Move loadedLibraries back into context
fniephaus Feb 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Clone TruffleSqueak repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Set up dependencies
Expand Down Expand Up @@ -63,11 +63,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Clone TruffleSqueak repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Set up dependencies
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Clone TruffleSqueak repository
uses: actions/checkout@v3
uses: actions/checkout@v4
# Oracle GraalVM for JDK 22 not released yet
# - name: Set up Oracle GraalVM
# uses: graalvm/setup-graalvm@v1
Expand All @@ -164,7 +164,7 @@ jobs:
# cat "${JAVA_HOME}/LICENSE.txt" > "${GITHUB_WORKSPACE}/LICENSE"
# if: ${{ matrix.type == 'native' }}
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Set up dependencies
Expand Down
6 changes: 5 additions & 1 deletion mx.trufflesqueak/mx_trufflesqueak.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@

import mx
import mx_gate
import mx_unittest

import mx_sdk
import mx_sdk_vm
import mx_sdk_vm_impl
import mx_truffle
import mx_unittest

# re-export custom mx project classes so they can be used from suite.py
from mx_cmake import CMakeNinjaProject #pylint: disable=unused-import

_SUITE = mx.suite('trufflesqueak')
_COMPILER = mx.suite('compiler', fatalIfMissing=False)
Expand Down
56 changes: 40 additions & 16 deletions mx.trufflesqueak/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,30 @@
"sha1": "acd1c78c07e894647e8dcbd72c4fa9a136e20d6d",
"licence": "LGPLv21",
},
"OSVM_PLUGINS": {
"baseurl": "https://github.com/hpi-swa/trufflesqueak/releases/download/23.1.0/osvm-plugins-202312181441",
"os_arch": {
"linux": {
"amd64": {
"urls": ["{baseurl}-linux-amd64.zip"],
"digest": "sha512:5e94f289e5e1c71772b3033fda31e637cdcbea17321f2a4448a6755dff6db2db210086cffc993320249bcb6a1df395c17a2a06aedc9636159623336ca92e8008",
},
"aarch64": {
"urls" : ["{baseurl}-linux-aarch64.zip"],
"digest" : "sha512:b4801b2a442ca383c6d5718c5a085b1446e66010e73587f166ff2726d393ecc47d7a195bba9d586e7f6c40d587e9a89c874a39adb3f65e9633a12703b40268e9",
},
},
"windows": {
"amd64": {
"urls": ["{baseurl}-windows-amd64.zip"],
"digest": "sha512:10ec2b4b783bb83a814866ea237a424138802a99ee63b3cfbe2d2b2c6607e94ea000922f58f8a159108f66c0509764bc48b62885337d2a198534337eb2ed6f8e",
},
},
"<others>": {
"<others>": {"optional": True}
},
},
},
"TRUFFLE-ENTERPRISE": {
"digest": "sha512:b883d3ead84778617f9b09edaa43634183f07cdc6ae0666cb2f4edabc52fca913138c4a7a8f9ada1adbd4a9bbe7d16fb4a1b3ceac13446f4e0c47f3d1a20469f",
"maven": {
Expand Down Expand Up @@ -167,24 +191,17 @@
},
"de.hpi.swa.trufflesqueak.ffi.native": {
"subDir": "src",
"native": "shared_lib",
"deliverable": "SqueakFFIPrims",
"class": "CMakeNinjaProject",
"vpath": True,
"ninja_targets": ["all"],
"os_arch": {
"windows": {
"<others>": {
"cflags": []
}
},
"linux": {
"<others>": {
"cflags": ["-g", "-Wall", "-Werror", "-D_GNU_SOURCE"],
"ldlibs": ["-ldl"],
},
},
"<others>": {
"<others>": {
"cflags": ["-g", "-Wall", "-Werror"],
"ldlibs": ["-ldl"],
"cmakeConfig": {},
"results": [
"<lib:SqueakFFIPrims>",
"<lib:InterpreterProxy>",
],
},
},
},
Expand Down Expand Up @@ -308,7 +325,14 @@
"layout": {
"LICENSE_TRUFFLESQUEAK.txt": "file:LICENSE",
"README_TRUFFLESQUEAK.md": "file:README.md",
"lib/": "dependency:de.hpi.swa.trufflesqueak.ffi.native",
"lib/": [
"dependency:de.hpi.swa.trufflesqueak.ffi.native/*",
{
"source_type": "extracted-dependency",
"dependency": "OSVM_PLUGINS",
"path": "*",
},
],
},
"maven": False,
},
Expand Down
29 changes: 29 additions & 0 deletions src/de.hpi.swa.trufflesqueak.ffi.native/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Copyright (c) 2023-2024 Software Architecture Group, Hasso Plattner Institute
# Copyright (c) 2023-2024 Oracle and/or its affiliates
#
# Licensed under the MIT License.
#

cmake_minimum_required(VERSION 3.22)
project(de.hpi.swa.trufflesqueak.ffi.native)

if(NOT DEFINED SRC_DIR)
set(SRC_DIR "${CMAKE_SOURCE_DIR}")
endif()

set(CMAKE_C_STANDARD 11)

# don't install into the system but into the MX project's output dir
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})

set(CAPI_SRC "${SRC_DIR}/src")

function(build_library LIB_NAME SOURCE_FILE)
add_library(${LIB_NAME} SHARED ${SOURCE_FILE})
target_include_directories(${LIB_NAME} PUBLIC include)
endfunction()


build_library(InterpreterProxy "${CAPI_SRC}/InterpreterProxy.c")
build_library(SqueakFFIPrims "${CAPI_SRC}/SqueakFFIPrims.c")
114 changes: 114 additions & 0 deletions src/de.hpi.swa.trufflesqueak.ffi.native/include/sqMemoryAccess.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2023-2024 Software Architecture Group, Hasso Plattner Institute
* Copyright (c) 2023-2024 Oracle and/or its affiliates
*
* Licensed under the MIT License.
*/
#define SIZEOF_VOID_P 8

//////////// from here on: copied from
//////////// https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/ec421b99cf41fc5f2f5fb734b536d6233cdde809/platforms/Cross/vm/sqMemoryAccess.h

#ifndef SIZEOF_LONG
# if LLP64
# define SIZEOF_LONG 4
# else
# define SIZEOF_LONG SIZEOF_VOID_P /* default is sizeof(long)==sizeof(void *) */
# endif
#endif

#if (SQ_VI_BYTES_PER_WORD == 4)
# define SQ_IMAGE32 1
# define SQ_IMAGE64 0
#else
# define SQ_IMAGE64 1
# define SQ_IMAGE32 0
#endif

#if (SQ_IMAGE64 || SPURVM)
# define OBJECTS_64BIT_ALIGNED 1
# define OBJECTS_32BIT_ALIGNED 0
#else
# define OBJECTS_32BIT_ALIGNED 1
# define OBJECTS_64BIT_ALIGNED 0
#endif

#if (SIZEOF_VOID_P == 4)
# define SQ_HOST32 1
#elif (SIZEOF_VOID_P == 8)
# define SQ_HOST64 1
#else
# error host is neither 32- nor 64-bit?
#endif

/* sqInt is a signed integer with size adequate for holding an Object Oriented Pointer (or immediate value)
- that is 32bits long on a 32bits image or 64bits long on a 64bits image
we could use C99 int32_t and int64_t once retiring legacy compiler support this time has not yet come
usqInt is the unsigned flavour
SQABS is a macro for taking absolute value of an sqInt */
#if SQ_IMAGE32
typedef int sqInt;
typedef unsigned int usqInt;
#define PRIdSQINT "d"
#define PRIuSQINT "u"
#define PRIxSQINT "x"
#define PRIXSQINT "X"
# define SQABS abs
#elif SQ_HOST64 && (SIZEOF_LONG == 8)
typedef long sqInt;
typedef unsigned long usqInt;
#define PRIdSQINT "ld"
#define PRIuSQINT "lu"
#define PRIxSQINT "lx"
#define PRIXSQINT "lX"
# define SQABS labs
#elif (SIZEOF_LONG_LONG != 8)
# error long long integers are not 64-bits wide?
#else
typedef long long sqInt;
typedef unsigned long long usqInt;
#define PRIdSQINT "lld"
#define PRIuSQINT "llu"
#define PRIxSQINT "llx"
#define PRIXSQINT "llX"
# define SQABS llabs
#endif

/* sqLong is a signed integer with at least 64bits on both 32 and 64 bits images
usqLong is the unsigned flavour
SQLABS is a macro for taking absolute value of a sqLong */
#if !defined(sqLong)
# if SIZEOF_LONG == 8
# define sqLong long
# define usqLong unsigned long
# define SQLABS labs
# elif _MSC_VER
# define sqLong __int64
# define usqLong unsigned __int64
# define SQLABS llabs
# else
# define sqLong long long
# define usqLong unsigned long long
# define SQLABS llabs
# endif
#endif /* !defined(sqLong) */

/* sqIntptr_t is a signed integer with enough bits to hold a pointer
usqIntptr_t is the unsigned flavour
this is essentially C99 intptr_t and uintptr_t but we support legacy compilers
the C99 printf formats macros are also defined with SQ prefix */
#if SIZEOF_LONG == SIZEOF_VOID_P
typedef long sqIntptr_t;
typedef unsigned long usqIntptr_t;
#define PRIdSQPTR "ld"
#define PRIuSQPTR "lu"
#define PRIxSQPTR "lx"
#define PRIXSQPTR "lX"
#else
typedef long long sqIntptr_t;
typedef unsigned long long usqIntptr_t;
#define PRIdSQPTR "lld"
#define PRIuSQPTR "llu"
#define PRIxSQPTR "llx"
#define PRIXSQPTR "llX"
#endif
Loading
Loading