diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ad19622748..709833fda3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,7 @@ elseif(WIN) SET(CMAKE_SYSTEM_NAME Windows) add_compile_definitions(WIN32_LEAN_AND_MEAN) - add_compile_definitions(NO_ISNAN NO_SERVICE LSB_FIRST=1 AllocationCheckFiller=0xADD4E55) + add_compile_definitions(NO_ISNAN LSB_FIRST=1 AllocationCheckFiller=0xADD4E55) #Setting minimal Windows Version to VISTA add_compile_definitions(_WIN32_WINNT=0x0600 WINVER=0x0600 NTDDI_VERSION=0x06000000 WIN64=1) @@ -298,7 +298,6 @@ add_compile_options( add_compile_definitions( IMMUTABILITY=1 COGMTVM=0 - PharoVM=1 DEBUGVM=${DEBUGVM} _FILE_OFFSET_BITS=64 ) @@ -347,14 +346,6 @@ message(STATUS "long ${SIZEOF_LONG}") message(STATUS "long long ${SIZEOF_LONG_LONG}") message(STATUS "void* ${SIZEOF_VOID_P}") -if("${SIZEOF_LONG}" STREQUAL "8") - set(SQUEAK_INT64_TYPEDEF "long") -elseif("${SIZEOF_LONG_LONG}" STREQUAL "8") - set(SQUEAK_INT64_TYPEDEF "long long") -else() - message(FATAL_ERROR "Failed to find a 64 bits integer type.") -endif() - set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/build/vm/") #If in OSX, configure creation of Bundle diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 47bd7d283f6..00000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,244 +0,0 @@ -# How to contribute - -First, opensmalltalk-vm (a.k.a. the Cog VM) is the virtual machine beneath the -Cuis, Pharo and Squeak Smalltalk dialects and one of the VMs beneath the -Newspeak language. For issues related to these systems that are unrelated to -the VM itself, please use their forums: -* http://www.cuis-smalltalk.org -* http://pharo.org/community -* http://squeak.org/community/ -* http://newspeaklanguage.org - -Second, the core VM, which comprises the execution engine and garbage collector, -and the core plugins, is developed in Smalltalk, using the *VM Simulator*. This -repository contains the code generated by the Simulator, and the platform support -code for the entire VM, its CI infrastructure and so on. The core VM **should -not** be developed by editing the generated code. The core VM should be -developed using Smalltalk. You can find scripts to build a Smalltalk image in -which to do core VM development in the [image](https://github.com/OpenSmalltalk/opensmalltalk-vm/tree/Cog/image) directory in this repository. -You can read about the Simulator here: -* https://www.researchgate.net/publication/328509577_Two_Decades_of_Smalltalk_VM_Development_Live_VM_Development_through_Simulation_Tools -* https://hal.archives-ouvertes.fr/hal-01883380/document - -The development of the Cog virtual machine takes place on the *Cog* -branch. External contributors have to submit pull requests for review. Core -contributors will generally work on the Cog branch by pushing to it -directly. However, larger features should be developed on separate feature -branches and presented to the community for review through pull requests. Rule -of thumb: If you're working on any feature that will take more than a couple of -days to stabilize or anything that could potentially destabilize the VM for -other people, do it on a feature branch and open a pull request. - -### TL;DR Workflow -* Create a topic branch from where you want to base your work. - * This is usually the Cog branch. - * Only target other branches if you are certain your fix must be on that - branch. - * To quickly create a topic branch based on *Cog*; `git checkout -b - feature/Cog/my_contribution Cog && git push -u origin - feature/Cog/my_contribution`. -* Prefer many small commits of logical units that still compile over one large - commit. Use `git add --patch` to review and stage your work interactively or - use `magit` in Emacs or go through the changed lines in the github desktop - client. Try to make each commit the smallest possible coherent change that - still compiles. -* Give meaningful but small commit messages. Avoid large "SVN-style" commits - where you dump a large number of changes into one commit. You will be thankful - later when you need to use `git bisect` to find where a bug comes from. This - also means that you should avoid rebasing or squashing your work. Just keep - the history. - -### Regarding /src and alike directories - -Versioning the generated source code is of critical importance for debugging the -VM, since it is not posssible to guarantee that source files will not differ -from another set of source files generated in the same environment. For this -same reason, counting with a clean, versioned set of source files makes it -easier to check the newly generated source for bugs in parts of the system such -as the Slang translator. - -C source files are manually generated and committed when necessary by core -contributors. Unless source files -* need to be updated to fix a bug or make available new functionality urgently -needed -* have been carefully checked for bugs that may have been introduced by -modifications in parts of the system involved in the generation process -* are generated from versioned imput (i.e. none of the packages to be translated -or involved in the generation process are dirty) - -it's preferrable that no changes to them are submitted. - -# Integration of GIT with the source tree organization - -There are two subtree modules in the Cog branch, `platforms/Cross/plugins` and -`platforms/win32/plugins`. These are tracked on separate branches in the -repository and shared with the `oldTrunk` branch of development. For -contributors this can mostly be ignored, as we can easily split any changes in -those directories and cross-merge them across branches. The split is mostly just -historical right now, since most development takes place on the Cog branch. - -Also a historical artifact is that we use source tree substitutions. -Specifically, any sq*SCCSVersion.h files anywhere in the tree are -processed to replace `$Rev$`, `$Date$`, `$URL$` and `$CommitHash$` with -the current revision (defined as the timestamp %Y%m%d%H%M of the latest -commit), the human readable date of that commit, and the URL of the -origin repository these sources were cloned from. - -The first time you clone this repository, you *must* therefore run this command: - - ./scripts/updateSCCSVersions - - -This will install filters, post-commit, and post-merge hooks to update the -sq*SCCSVersion.h files anytime you commit or merge. If you know your way around -Git, you will know when to manually run this file again. If you do not know your -way around, please refrain from copy and pasting random snippets you found on -StackOverflow to "fix" an issue you have. Stick with the well known `add, -commit, push, pull, checkout, revert` tools in your workflow. - -### Using GUI clients - -You can use GUI clients (I hear the github desktop client is good), **but only -after you ran the updateSCCSVersions script**. - -### A note to Windows and other users not on UNIX - -You must use some Unix-y (Cygwin or MSYS or some such) layer that provides Perl -and a Bash shell and common Unix tools like sed, grep, find, ... . Our scripts -are written for that, and the source file replacement scripts probably won't -work without such an environment. - -# Shortcuts for newcomers to Git - -If you are new to Git, here are a few tips that will make it easier for you to -work within the contribution guidelines: - -### Getting the code - -If you're a core developer, clone the repository and set it up: - - git clone git@github.com:OpenSmalltalk/vm.git - cd vm - ./scripts/updateSCCSVersions - -If you're an external developer, go to github and fork the repository, then -clone your fork: - - git clone git@github.com:YOUR-GITHUB-USERNAME/vm.git - cd vm - ./scripts/updateSCCSVersions - -### Moving to a feature branch - - git checkout -b MY-FEATURE-BRANCH-NAME Cog - git push -u origin MY-FEATURE-BRANCH-NAME:MY-FEATURE-BRANCH-NAME - -### Making, reviewing, and committing changes -You can set up a Git alias that helps you keep commits small and related changes -together: - - git config --global --add alias.go "!git add --patch && git commit && git status" - -Then whenever you want to commit your changes run: - - git go - -This will go over all the changes in tracked files and you can quickly decide to -stage them or leave them out of this commit, then you commit them, and then -you'll get a status info. Repeat `git go` until all modifications you want to -keep are committed. - -For new files, you'll have to add them with `git add`. - -Once you've committed everything and want to get rid of all remaining changes, -just run this: - - git checkout -- . - -### Commit Messages - -Keep them short. Also, since we're testing each commit on CI, if your changes -are only documentation or some other change that does not affect compilation or -function of the VM, please prepend `[skip ci]` to your commit message to not -trigger unnecessary builds. - -### Undoing commits - -We do not allow force-pushes to our main development branches. If you want to -undo any change, you should use `git revert SHA`. This will create a new commit -with the reverse patch of `SHA`, thus keeping history intact. - -### Publishing your work - -Every so many commits it is a good idea to push your work. Please refrain from -rebasing, unless your history looks like this: - - commit 9053988200f86da55c7a599a3e93e6d5a6c4e3c7 - Author: Tim Felgentreff - Date: Tue Apr 28 09:09:49 2015 +0200 - - maybe this works? - - commit fcede7be5a9347d56670af0d07ac303baba41d31 - Author: Tim Felgentreff - Date: Tue Apr 28 07:17:17 2015 +0200 - - try once more - - commit 66c6b1b036c4bd90237c575221db0530b850ec17 - Author: Tim Felgentreff - Date: Tue Apr 28 06:51:46 2015 +0200 - - try again - - commit b8e60620c1285f7e19dbb3ff23e1d201eecb8c24 - Author: Tim Felgentreff - Date: Tue Apr 28 06:44:04 2015 +0200 - - try a different build script - -(However, if you're unsure what rebasing is, just forget about it and push the -history as-is. Seriously, skipping bad commits a bisect is easier than fixing -someones git tree once they have lost commits to the depths of -reflog. Especially if their recovery attempts have already triggered a Git GC.) - -If you were working on Cog and the change isn't too large, just do: - - git push origin Cog - -If you were working on a feature branch, do this: - - git push origin MY-FEATURE-BRANCH-NAME - -If your feature branch is ready or you are an external contributor with your own -fork, use the github web interface to open a pull request. - - -# C Source Code Formatting - -When editing an existing file, please be polite and first follow the -guidelines below, and secondly follow the general rule of keeping to the -same formatting conventions as exist in the file. - - -## C Function Declarations - -C function declarations should have the type on one line and the -function name and parameters on the following line, e.g.: - -```c -static int -convertCopy(char *from, int fromLen, char *to, int toLen, int term) -``` - -This facilitates searching for function definitions by searching for the -name at the beginning of the line. - - -## Tab stops are 4 spaces - -In this case the first rule is to keep the existing formatting within a -file - we don't want to polute the code history with space changes. - -The goal is to use tabs set to 4 spaces. - diff --git a/include/pharovm/common/sqaio.h b/include/pharovm/common/aio.h similarity index 75% rename from include/pharovm/common/sqaio.h rename to include/pharovm/common/aio.h index 00e6700caf1..034e915049d 100644 --- a/include/pharovm/common/sqaio.h +++ b/include/pharovm/common/aio.h @@ -1,11 +1,11 @@ -/* sqaio.h -- asynchronous file i/o +/* aio.h -- asynchronous file i/o * * Copyright (C) 1996-2004 by Ian Piumarta and other authors/contributors * listed elsewhere in this file. * All rights reserved. * * This file is part of Unix Squeak. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation @@ -28,8 +28,7 @@ /* author: ian.piumarta@inria.fr */ -#ifndef __sqaio_h -#define __sqaio_h +#pragma once #define AIO_X (1<<0) /* handle for exceptions */ #define AIO_R (1<<1) /* handle for read */ @@ -86,44 +85,3 @@ EXPORT(void) aioDisable(int fd); * handler(s) being called before returning. */ EXPORT(long) aioPoll(long microSeconds); - -extern unsigned volatile long long ioUTCMicroseconds(void); -extern unsigned volatile long long ioUTCMicrosecondsNow(void); - -/* - * I interrupt the poll when there is an event that the VM should handle. - * For example, when signalling a Pharo semaphore - */ -EXPORT(void) aioInterruptPoll(); - -/** - * I block the caller if we are in the aioPoll - */ -EXPORT(void) aioWaitIfInPoll(); - -/* debugging stuff. */ -#ifdef AIO_DEBUG -# ifdef ACORN -# define FPRINTF(s) \ - do { \ - extern os_error privateErr; \ - extern void platReportError(os_error *e); \ - privateErr.errnum = (bits)0; \ - sprintf s; \ - platReportError((os_error *)&privateErr); \ - } while (0) -# else /* !ACORN */ - extern long aioLastTick, aioThisTick, ioMSecs(void); - extern const char *__shortFileName(const char *); -# define FPRINTF(X) do { \ - aioThisTick = ioMSecs(); \ - fprintf(stderr, "%8ld %4ld %s:%d ", aioThisTick, aioThisTick - aioLastTick,\ - __shortFileName(__FILE__),__LINE__); \ - aioLastTick = aioThisTick; \ - fprintf X; } while (0) -# endif /* ACORN */ -#else /* !DEBUG */ -# define FPRINTF(X) -#endif - -#endif /* __sqaio_h */ diff --git a/include/pharovm/common/sqAssert.h b/include/pharovm/common/assert.h similarity index 88% rename from include/pharovm/common/sqAssert.h rename to include/pharovm/common/assert.h index a1650bc13bf..8e3d9b1b3f4 100644 --- a/include/pharovm/common/sqAssert.h +++ b/include/pharovm/common/assert.h @@ -12,18 +12,13 @@ * * assertl, assertal & assertfl take a line number as an argument. */ +#pragma once #include "pharovm/debug.h" -/* Include assert to ensure our macros do not get redefined by the standard ones.*/ -#include - -#undef assert -#undef asserta -#undef assertf -#undef assertl -#undef assertal -#undef assertfl -#undef eassert + +#ifdef assert +# error "Do not include system asserts" +#endif #ifdef NDEBUG /* compatible with Mac OS X (FreeBSD) /usr/include/assert.h */ # define assert(expr) (void) 0 /* hack disabling of asserts. Better in makefile? */ diff --git a/include/pharovm/common/sqAtomicOps.h b/include/pharovm/common/atomic.h similarity index 99% rename from include/pharovm/common/sqAtomicOps.h rename to include/pharovm/common/atomic.h index 7a55b54d5ce..952e6b93fd4 100644 --- a/include/pharovm/common/sqAtomicOps.h +++ b/include/pharovm/common/atomic.h @@ -6,7 +6,7 @@ * Atomic 32-bit increment (e.g. for signalSemaphoreWithIndex:). * sqAtomicAddConst(var,n) * sqCompareAndSwap(var,old,new) -* FILE: sqAtomicOps.h +* FILE: atomic.h * * AUTHOR: Eliot Miranda * EMAIL: eliot@teleplace.com @@ -139,7 +139,7 @@ AtomicGet(uint64_t *target) * can only depend on global variables being correctly aligned on systems * such as Mac OS X, which aligns the stack on a 128-bit boundary. */ -# include "sqAssert.h" +# include "assert.h" # define lo32(x) (*(((unsigned long *)&(x))+0)) # define hi32(x) (*(((unsigned long *)&(x))+1)) @@ -223,7 +223,7 @@ AtomicGet(unsigned long long *target) # endif #else /* neither IS_64_BIT_ARCH nor IS_32_BIT_ARCH */ -# error Could not infer if architecture is 32 or 64 bits. Please modify sqAtomicOps.h inference rules. +# error Could not infer if architecture is 32 or 64 bits. Please modify atomic.h inference rules. #endif #if defined(__GNUC__) diff --git a/include/pharovm/common/sqCogStackAlignment.h b/include/pharovm/common/cogStackAlignment.h similarity index 99% rename from include/pharovm/common/sqCogStackAlignment.h rename to include/pharovm/common/cogStackAlignment.h index 8e9b50fa628..941707eff9a 100644 --- a/include/pharovm/common/sqCogStackAlignment.h +++ b/include/pharovm/common/cogStackAlignment.h @@ -1,5 +1,5 @@ /**************************************************************************** - * FILE: sqCogUnixStackAlignment.h + * FILE: cogStackAlignment.h * CONTENT: Answer & check stack alignment for current plaform * * AUTHOR: Eliot Miranda diff --git a/include/pharovm/common/dispdbg.h b/include/pharovm/common/dispdbg.h index a97e6cfd545..dad4f458251 100644 --- a/include/pharovm/common/dispdbg.h +++ b/include/pharovm/common/dispdbg.h @@ -5,7 +5,7 @@ * sendBreakpointreceiver and bytecodeDispatchDebugHook macros. */ -#include "sqAssert.h" +#include "assert.h" #include "pharovm/debug.h" diff --git a/include/pharovm/common/sqMemoryAccess.h b/include/pharovm/common/memoryAccess.h similarity index 99% rename from include/pharovm/common/sqMemoryAccess.h rename to include/pharovm/common/memoryAccess.h index 05d83a9ecf6..112a81fb305 100644 --- a/include/pharovm/common/sqMemoryAccess.h +++ b/include/pharovm/common/memoryAccess.h @@ -1,4 +1,4 @@ -/* sqMemoryAccess.h -- memory accessors (and associated type definitions) +/* memoryAccess.h -- memory accessors (and associated type definitions) * * Author: Ian.Piumarta@squeakland.org * @@ -34,7 +34,7 @@ # define SQ_IMAGE32 0 #endif -#if (SQ_IMAGE64 || SPURVM) +#if (SQ_IMAGE64) # define OBJECTS_64BIT_ALIGNED 1 # define OBJECTS_32BIT_ALIGNED 0 #else diff --git a/include/pharovm/common/sqMemoryFence.h b/include/pharovm/common/memoryFence.h similarity index 99% rename from include/pharovm/common/sqMemoryFence.h rename to include/pharovm/common/memoryFence.h index 971e7039cd1..057c4b1a1b9 100644 --- a/include/pharovm/common/sqMemoryFence.h +++ b/include/pharovm/common/memoryFence.h @@ -1,4 +1,4 @@ -/* sqMemoryFence.h +/* memoryFence.h * Support for synchronisation above weakly-ordered memory models. * * Author: Eliot Miranda diff --git a/include/pharovm/common/sq.h b/include/pharovm/common/sq.h index 11cd7320b24..d38245a9b4f 100644 --- a/include/pharovm/common/sq.h +++ b/include/pharovm/common/sq.h @@ -23,8 +23,8 @@ #include #include -#include "sqMemoryAccess.h" -#include "sqVirtualMachine.h" +#include "memoryAccess.h" +#include "virtualMachine.h" #define true 1 @@ -34,31 +34,12 @@ #include "pharovm/semaphores/platformSemaphore.h" -#if !defined(IMAGE_DIALECT_NAME) -# if NewspeakVM -# define IMAGE_DIALECT_NAME "Newspeak" -# define DEFAULT_IMAGE_NAME "newspeak.image" -# define IMAGE_ENV_NAME "NEWSPEAK_IMAGE" -# elif PharoVM -# define IMAGE_DIALECT_NAME "Pharo" -# if !defined(DEFAULT_IMAGE_NAME) -# define DEFAULT_IMAGE_NAME "Pharo.image" -# endif -# define IMAGE_ENV_NAME "PHARO_IMAGE" -# else -# define IMAGE_DIALECT_NAME "Squeak" -# define DEFAULT_IMAGE_NAME "squeak.image" -# define IMAGE_ENV_NAME "SQUEAK_IMAGE" -# endif -#endif - -#if SPURVM /* Allocate a region of memory of al least sz bytes, at or above minAddr. * If the attempt fails, answer null. If the attempt succeeds, answer the * start of the region and assign its size through asp. */ extern void sqDeallocateMemorySegmentAtOfSize(void *addr, sqInt sz); -#endif /* SPURVM */ + /* Platform-dependent memory size adjustment macro. */ /* Note: This macro can be redefined to allows platforms with a @@ -74,7 +55,7 @@ extern void sqDeallocateMemorySegmentAtOfSize(void *addr, sqInt sz); /* Platform-dependent millisecond clock macros. */ -/* Note: The Squeak VM uses two different clock functions for timing, and +/* Note: The VM uses two different clock functions for timing, and the Cog VMs provide a third. The primary one, ioMSecs(), is used to implement Delay and Time @@ -185,39 +166,15 @@ extern VM_EXPORT void *displayBits; extern VM_EXPORT int displayWidth, displayHeight, displayDepth; extern VM_EXPORT sqInt sendWheelEvents; -sqInt ioBeep(void); sqInt ioExit(void); sqInt ioExitWithErrorCode(int); sqInt crashInThisOrAnotherThread(sqInt flags); -sqInt fullDisplayUpdate(void); -void ioNoteDisplayChangedwidthheightdepth(void *bitsOrHandle, int w, int h, int d); -sqInt ioForceDisplayUpdate(void); -sqInt ioFormPrint(sqInt bitsAddr, sqInt width, sqInt height, sqInt depth, - double hScale, double vScale, sqInt landscapeFlag); -sqInt ioSetFullScreen(sqInt fullScreen); -double ioScreenScaleFactor(void); -sqInt ioScreenSize(void); -sqInt ioScreenDepth(void); sqInt ioSeconds(void); sqInt ioSecondsNow(void); -sqInt ioSetCursor(sqInt cursorBitsIndex, sqInt offsetX, sqInt offsetY); -sqInt ioSetCursorWithMask(sqInt cursorBitsIndex, sqInt cursorMaskIndex, sqInt offsetX, sqInt offsetY); -sqInt ioShowDisplay(sqInt dispBitsIndex, sqInt width, sqInt height, sqInt depth, - sqInt affectedL, sqInt affectedR, sqInt affectedT, sqInt affectedB); -sqInt ioHasDisplayDepth(sqInt depth); -sqInt ioSetDisplayMode(sqInt width, sqInt height, sqInt depth, sqInt fullscreenFlag); -char* ioGetLogDirectory(void); -sqInt ioSetLogDirectoryOfSize(void* lblIndex, sqInt sz); -char* ioGetWindowLabel(void); -sqInt ioSetWindowLabelOfSize(void *lblIndex, sqInt sz); -sqInt ioGetWindowWidth(void); -sqInt ioGetWindowHeight(void); -sqInt ioSetWindowWidthHeight(sqInt w, sqInt h); -sqInt ioIsWindowObscured(void); sqInt ioRelinquishProcessorForMicroseconds(sqInt microSeconds); -#if STACKVM || NewspeakVM +#if STACKVM /* thread subsystem support for e.g. sqExternalSemaphores.c */ void ioInitThreads(); @@ -239,7 +196,7 @@ int ioOSThreadsEqual(sqOSThread,sqOSThread); extern sqOSThread ioVMThread; # define getVMOSThread() ioVMThread # endif -#endif /* STACKVM || NewspeakVM */ +#endif /* STACKVM */ #if STACKVM /* Event polling via periodic heartbeat thread. */ @@ -291,190 +248,6 @@ void ioTransferTimeslice(void); # endif #endif /* COGMTVM */ -/* Profiling. */ -void ioProfileStatus(sqInt *running, void **exestartpc, void **exelimitpc, - void **vmhst, long *nvmhbin, void **eahst, long *neahbin); -void ioControlProfile(int on, void **vhp, long *nvb, void **ehp, long *neb); -long ioControlNewProfile(int on, unsigned long buffer_size); -void ioNewProfileStatus(sqInt *running, long *buffersize); -long ioNewProfileSamplesInto(void *sampleBuffer); -void ioClearProfile(void); - -/* Power management. */ - -sqInt ioDisablePowerManager(sqInt disableIfNonZero); - -/* User input recording I: - In general, either set of input function can be supported, - depending on the platform. This (first) set is state based - and should be supported even on platforms that make use - of the newer event driven API to support older images - without event support. -*/ - -sqInt ioGetButtonState(void); -sqInt ioGetKeystroke(void); -sqInt ioMousePoint(void); -sqInt ioPeekKeystroke(void); -/* Note: In an event driven architecture, ioProcessEvents is obsolete. - It can be implemented as a no-op since the image will check for - events in regular intervals. */ -sqInt ioProcessEvents(void); - - -/* User input recording II: - The following functions and definition can be used on - platform supporting events directly. -*/ - -/* Event types. */ -#define EventTypeNone 0 -#define EventTypeMouse 1 -#define EventTypeKeyboard 2 -#define EventTypeDragDropFiles 3 -#define EventTypeMenu 4 -#define EventTypeWindow 5 -#define EventTypeComplex 6 /* For iPhone apps */ -#define EventTypeMouseWheel 7 /* optional; see sendWheelEvents & vm param 48 */ -#define EventTypePlugin 8 /* Terf: events from ActiveX Controls */ - - -/* Keypress state for keyboard events. */ -#define EventKeyChar 0 -#define EventKeyDown 1 -#define EventKeyUp 2 - -/* Button definitions. */ -#define RedButtonBit 4 -#define YellowButtonBit 2 -#define BlueButtonBit 1 - -/* Modifier definitions. */ -#define ShiftKeyBit 1 -#define CtrlKeyBit 2 -#define OptionKeyBit 4 -#define CommandKeyBit 8 - -/* generic input event */ -typedef struct sqInputEvent -{ - sqIntptr_t type; /* type of event; either one of EventTypeXXX */ - usqIntptr_t timeStamp; /* time stamp */ - /* the interpretation of the following fields depend on the type of the event */ - sqIntptr_t unused1; - sqIntptr_t unused2; - sqIntptr_t unused3; - sqIntptr_t unused4; - sqIntptr_t unused5; - sqIntptr_t windowIndex; /* SmallInteger used in image to identify a host window structure */ -} sqInputEvent; - -/* mouse input event */ -typedef struct sqMouseEvent -{ - sqIntptr_t type; /* EventTypeMouse */ - usqIntptr_t timeStamp; /* time stamp */ - sqIntptr_t x; /* mouse position x */ - sqIntptr_t y; /* mouse position y */ - sqIntptr_t buttons; /* combination of xxxButtonBit */ - sqIntptr_t modifiers; /* combination of xxxKeyBit */ - sqIntptr_t nrClicks; /* number of clicks in button downs - was reserved1 */ - sqIntptr_t windowIndex; /* host window structure */ -} sqMouseEvent; - -/* keyboard input event */ -typedef struct sqKeyboardEvent -{ - sqIntptr_t type; /* EventTypeKeyboard */ - usqIntptr_t timeStamp; /* time stamp */ - sqIntptr_t charCode; /* character code in Mac Roman encoding */ - sqIntptr_t pressCode; /* press code; any of EventKeyXXX */ - sqIntptr_t modifiers; /* combination of xxxKeyBit */ - sqIntptr_t utf32Code; /* UTF-32 unicode value */ - sqIntptr_t reserved1; /* reserved for future use */ - sqIntptr_t windowIndex; /* host window structure */ -} sqKeyboardEvent; - -/* drop files event */ -typedef struct sqDragDropFilesEvent -{ - sqIntptr_t type; /* EventTypeDropFiles */ - usqIntptr_t timeStamp; /* time stamp */ - sqIntptr_t dragType; /* one of DragXXX (see below) */ - sqIntptr_t x; /* mouse position x */ - sqIntptr_t y; /* mouse position y */ - sqIntptr_t modifiers; /* combination of xxxKeyBit */ - sqIntptr_t numFiles; /* number of files in transaction */ - sqIntptr_t windowIndex; /* host window structure */ -} sqDragDropFilesEvent; - -#define SQDragEnter 1 /* drag operation from OS entered Squeak window */ -#define SQDragMove 2 /* drag operation from OS moved within Squeak window */ -#define SQDragLeave 3 /* drag operation from OS left Squeak window */ -#define SQDragDrop 4 /* drag operation dropped contents onto Squeak. */ -#define SQDragRequest 5 /* data request from other app. */ - -/* menu event */ -typedef struct sqMenuEvent -{ - sqIntptr_t type; /* type of event; EventTypeMenu */ - usqIntptr_t timeStamp; /* time stamp */ - /* the interpretation of the following fields depend on the type of the event */ - sqIntptr_t menu; /* platform-dependent to indicate which menu was picked */ - sqIntptr_t menuItem; /* given a menu having 1 to N items this maps to the menu item number */ - sqIntptr_t reserved1; /* reserved for future use */ - sqIntptr_t reserved2; /* reserved for future use */ - sqIntptr_t reserved3; /* reserved for future use */ - sqIntptr_t windowIndex; /* host window structure */ -} sqMenuEvent; - -/* window action event */ -typedef struct sqWindowEvent -{ - sqIntptr_t type; /* type of event; EventTypeWindow */ - usqIntptr_t timeStamp; /* time stamp */ - /* the interpretation of the following fields depend on the type of the event */ - sqIntptr_t action; /* one of WindowEventXXX (see below) */ - sqIntptr_t value1; /* used for rectangle edges */ - sqIntptr_t value2; /* used for rectangle edges */ - sqIntptr_t value3; /* used for rectangle edges */ - sqIntptr_t value4; /* used for rectangle edges */ - sqIntptr_t windowIndex; /* host window structure */ -} sqWindowEvent; - -#define WindowEventMetricChange 1 /* size or position of window changed - value1-4 are left/top/right/bottom values */ -#define WindowEventClose 2 /* window close icon pressed */ -#define WindowEventIconise 3 /* window iconised or hidden etc */ -#define WindowEventActivated 4 /* window made active - some platforms only - do not rely upon this */ -#define WindowEventPaint 5 /* window area (in value1-4) needs updating. Some platforms do not need to send this, do not rely on it in image */ -#define WindowEventStinks 6 /* this window stinks (just to see if people read this stuff) */ - -typedef struct sqComplexEvent -{ - sqIntptr_t type; /* type of event; EventTypeComplex */ - usqIntptr_t timeStamp; /* time stamp */ - /* the interpretation of the following fields depend on the type of the event */ - sqIntptr_t action; /* one of ComplexEventXXX (see below) */ - sqIntptr_t objectPointer; /* used to point to object */ - sqIntptr_t unused1; - sqIntptr_t unused2; - sqIntptr_t unused3; - sqIntptr_t windowIndex; /* host window structure */ -} sqComplexEvent; - -#define ComplexEventTypeTouchsDown 1 -#define ComplexEventTypeTouchsUp 2 -#define ComplexEventTypeTouchsMoved 3 -#define ComplexEventTypeTouchsStationary 4 -#define ComplexEventTypeTouchsCancelled 5 -#define ComplexEventTypeAccelerationData 6 -#define ComplexEventTypeLocationData 7 -#define ComplexEventTypeApplicationData 8 - - -/* Set an asynchronous input semaphore index for events. */ -sqInt ioSetInputSemaphore(sqInt semaIndex); - /* Image file and VM path names. */ extern char _imageName[]; char *getImageName(void); @@ -498,12 +271,6 @@ sqInt ioDisableImageWrite(void); sqInt readImageNamed(char* fileName); -/* Clipboard (cut/copy/paste). */ -sqInt clipboardSize(void); -sqInt clipboardReadIntoAt(sqInt count, sqInt byteArrayIndex, sqInt startIndex); -sqInt clipboardWriteFromAt(sqInt count, sqInt byteArrayIndex, sqInt startIndex); - - /* Interpreter entry points needed by compiled primitives. */ void *arrayValueOf(sqInt arrayOop); sqInt checkedIntegerValueOf(sqInt intOop); @@ -526,11 +293,9 @@ sqInt getAttributeIntoLength(sqInt indexNumber, sqInt byteArrayIndex, sqInt leng void *ioLoadExternalFunctionOfLengthFromModuleOfLength (sqInt functionNameIndex, sqInt functionNameLength, sqInt moduleNameIndex, sqInt moduleNameLength); -#if SPURVM void *ioLoadExternalFunctionOfLengthFromModuleOfLengthAccessorDepthInto (sqInt functionNameIndex, sqInt functionNameLength, sqInt moduleNameIndex, sqInt moduleNameLength, sqInt *accessorDepthPtr); -#endif sqInt ioUnloadModuleOfLength(sqInt moduleNameIndex, sqInt moduleNameLength); void *ioLoadFunctionFrom(char *functionName, char *pluginName); sqInt ioShutdownAllModules(void); @@ -556,12 +321,8 @@ void *ioLoadModule(char *pluginName); 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) -#else -void *ioFindExternalFunctionIn(char *lookupName, void *moduleHandle); -#endif +#define ioFindExternalFunctionIn(ln,mh) ioFindExternalFunctionInAccessorDepthInto(ln,mh,0) /* ioFreeModule: Free the module with the associated handle. @@ -569,7 +330,7 @@ void *ioFindExternalFunctionIn(char *lookupName, void *moduleHandle); */ sqInt ioFreeModule(void *moduleHandle); -/* The Squeak version from which this interpreter was generated. */ +/* The version from which this interpreter was generated. */ extern const char *interpreterVersion; void warning(char* msg); diff --git a/include/pharovm/common/sqVirtualMachine.h b/include/pharovm/common/virtualMachine.h similarity index 93% rename from include/pharovm/common/sqVirtualMachine.h rename to include/pharovm/common/virtualMachine.h index 08811cf45ad..50a9f41d9ac 100644 --- a/include/pharovm/common/sqVirtualMachine.h +++ b/include/pharovm/common/virtualMachine.h @@ -1,34 +1,11 @@ -#ifndef _SqueakVM_H -#define _SqueakVM_H +#pragma once -/* We expect interp.h to define VM_PROXY_MAJOR & VM_PROXY_MINOR, and other - * defines such as STACKVM, appropriately for the VM generated with it. - */ #include "interp.h" +#define VM_PROXY_MAJOR 1 +#define VM_PROXY_MINOR 15 -#if SPURVM -# define VM_VERSION "5.0" -#else -# define VM_VERSION "4.5" -#endif - -#ifndef VM_PROXY_MAJOR -/* Increment the following number if you change the order of - functions listed or if you remove functions */ -# define VM_PROXY_MAJOR 1 -#endif - -#ifndef VM_PROXY_MINOR -/* Increment the following number if you add functions at the end */ -# if SPURVM -# define VM_PROXY_MINOR 15 -# else -# define VM_PROXY_MINOR 12 -# endif -#endif - -#include "sqMemoryAccess.h" +#include "memoryAccess.h" #include "pharovm/semaphores/pSemaphore.h" @@ -341,6 +318,4 @@ typedef struct VirtualMachine { void (*waitOnExternalSemaphoreIndex)(sqInt semaphoreIndex); -} VirtualMachine; - -#endif /* _SqueakVM_H */ +} VirtualMachine; \ No newline at end of file diff --git a/include/pharovm/config.h.in b/include/pharovm/config.h.in index ff0da809019..a236a5412ab 100644 --- a/include/pharovm/config.h.in +++ b/include/pharovm/config.h.in @@ -42,8 +42,6 @@ #define SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@ #define SIZEOF_VOID_P @SIZEOF_VOID_P@ -#define squeakInt64 @SQUEAK_INT64_TYPEDEF@ - #cmakedefine HAVE_SYS_UUID_H #cmakedefine HAVE_UUID_UUID_H #cmakedefine HAVE_UUID_H diff --git a/include/pharovm/imageAccess.h b/include/pharovm/imageAccess.h index ea82ee2bc95..0a5efc2a771 100644 --- a/include/pharovm/imageAccess.h +++ b/include/pharovm/imageAccess.h @@ -5,7 +5,7 @@ #include #define sqImageFile void* -#define squeakFileOffsetType uint64_t +#define fileOffset_t uint64_t typedef struct { sqInt (*imageFileClose)(sqImageFile f); diff --git a/include/pharovm/osx/sqConfig.h b/include/pharovm/osx/sqConfig.h index f72d4b741f4..9bb965497d5 100644 --- a/include/pharovm/osx/sqConfig.h +++ b/include/pharovm/osx/sqConfig.h @@ -4,7 +4,6 @@ /* For Apple's OS X versions of darwin */ # include #endif -#define macintoshSqueak 1 # if defined(SQ_CONFIG_DONE) # error configuration conflict diff --git a/include/pharovm/osx/sqPlatformSpecific.h b/include/pharovm/osx/sqPlatformSpecific.h index 2e2e9667e5f..1084ee3c902 100644 --- a/include/pharovm/osx/sqPlatformSpecific.h +++ b/include/pharovm/osx/sqPlatformSpecific.h @@ -49,12 +49,11 @@ Alternately, this acknowledgment may appear in the software itself, in the same form and location as other such third-party acknowledgments. */ -// + +#pragma once #include "pharovm/exportDefinition.h" -#ifdef macintoshSqueak -//#define SQUEAK_BUILTIN_PLUGIN #define ENABLE_URL_FETCH /* replace the image file manipulation macros with functions */ @@ -142,8 +141,4 @@ extern const pthread_key_t tltiIndex; #if !defined(VM_LABEL) || COGVM # undef VM_LABEL # define VM_LABEL(foo) ((void)0) -#endif - -#endif /* macintoshSqueak */ - - +#endif \ No newline at end of file diff --git a/include/pharovm/pharo.h b/include/pharovm/pharo.h index e5f4f86cedf..4d410585a9e 100644 --- a/include/pharovm/pharo.h +++ b/include/pharovm/pharo.h @@ -15,7 +15,7 @@ #include "interpreter.h" #include "debug.h" -#include "sqAssert.h" +#include "assert.h" #ifdef _WIN32 @@ -25,9 +25,6 @@ EXPORT(const char*) getSourceVersion(); EXPORT(const char*) getVMVersion(); -EXPORT(char*) getVMName(); - -EXPORT(void) setVMName(const char* name); EXPORT(void) setVMPath(const char* path); diff --git a/include/pharovm/threads/vmthread.h b/include/pharovm/threads/vmthread.h deleted file mode 100644 index 4736aff6ae8..00000000000 --- a/include/pharovm/threads/vmthread.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __VM_THREAD__ -#define __VM_THREAD__ - -#endif // ifndef __VM_THREAD__ \ No newline at end of file diff --git a/include/pharovm/unix/sqGnu.h b/include/pharovm/unix/sqGnu.h index c4abe2383b7..911b0bb9835 100644 --- a/include/pharovm/unix/sqGnu.h +++ b/include/pharovm/unix/sqGnu.h @@ -4,8 +4,6 @@ * listed elsewhere in this file. * All rights reserved. * - * This file is part of Unix Squeak. - * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation diff --git a/include/pharovm/unix/sqPlatformSpecific.h b/include/pharovm/unix/sqPlatformSpecific.h index a8b67c525f2..2d565269baf 100644 --- a/include/pharovm/unix/sqPlatformSpecific.h +++ b/include/pharovm/unix/sqPlatformSpecific.h @@ -30,7 +30,7 @@ #include "pharovm/exportDefinition.h" -#include "sqMemoryAccess.h" +#include "memoryAccess.h" extern usqInt sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize, usqInt baseAddress); extern void* allocateJITMemory(usqInt desiredSize, usqInt desiredPosition); @@ -48,7 +48,7 @@ extern void reportMinimumUnusedHeadroom(void); #endif /* Thread support for thread-safe signalSemaphoreWithIndex and/or the COGMTVM */ -#if STACKVM || NewspeakVM +#if STACKVM # define sqLowLevelYield() sched_yield() /* linux's sched.h defines clone that conflicts with the interpreter's */ # define clone NameSpacePollutant @@ -77,7 +77,7 @@ extern const pthread_key_t tltiIndex; # define ioTransferTimeslice() sched_yield() # define ioMilliSleep(ms) usleep((ms) * 1000) # endif /* COGMTVM */ -#endif /* STACKVM || NewspeakVM */ +#endif /* STACKVM */ #include diff --git a/include/pharovm/win/sqPlatformSpecific.h b/include/pharovm/win/sqPlatformSpecific.h index ac498c18b6b..8a2642f5c17 100644 --- a/include/pharovm/win/sqPlatformSpecific.h +++ b/include/pharovm/win/sqPlatformSpecific.h @@ -14,7 +14,7 @@ /* Override necessary definitions */ # undef putchar # include "sqWin32Alloc.h" -#include "sqMemoryAccess.h" +#include "memoryAccess.h" # include @@ -49,7 +49,6 @@ # if _MSC_VER < 1300 /* maybe not available before MSVC 7.0 2003 ??? */ # define fabsf(x) ((float)fabs((double)(x))) # endif -# define bzero(pointer,size) ZeroMemory(pointer,size) #endif #ifdef __GNUC__ @@ -95,7 +94,7 @@ extern void reportMinimumUnusedHeadroom(void); #endif /* Thread support for thread-safe signalSemaphoreWithIndex and/or the COGMTVM */ -#if STACKVM || NewspeakVM +#if STACKVM # define sqLowLevelYield() Sleep(0) /* these are used both in the STACKVM & the COGMTVM */ # define sqOSThread DWORD @@ -113,7 +112,7 @@ extern const unsigned long tltiIndex; # define ioTransferTimeslice() Sleep(0) # define ioMilliSleep(ms) Sleep(ms) # endif /* COGMTVM */ -#endif /* STACKVM || NewspeakVM */ +#endif /* STACKVMM */ #if defined(__GNUC__) # if !defined(VM_LABEL) diff --git a/include/pharovm/win/sqWin32.h b/include/pharovm/win/sqWin32.h index 6df9b513081..ff99b23aad8 100644 --- a/include/pharovm/win/sqWin32.h +++ b/include/pharovm/win/sqWin32.h @@ -23,48 +23,10 @@ # define FINALLY #endif -#define NO_TABLET - - #ifdef _WIN32_WCE /*************************************************************/ /* Windows CE */ /*************************************************************/ -#ifndef WIN32_FILE_SUPPORT -# error "You must define WIN32_FILE_SUPPORT for compiling on WINCE" -#endif - -/* OS/Processor definitions */ -#define WIN32_NAME "Win32" -#define WIN32_OS_NAME "CE" -#if defined (_SH3_) -# define WIN32_PROCESSOR_NAME "SH3" -#elif defined(_MIPS_) -# define WIN32_PROCESSOR_NAME "MIPS" -#else -# error "Unknown Windows CE configuration" -#endif - -/* Remove subsystems we don't support on CE based devices */ -#define NO_JOYSTICK -#define NO_PRINTER -#define NO_MIDI -#define WCE_PREFERENCES -#define NO_ASYNC_FILES -#define NO_PLUGIN_SUPPORT - -#define USE_DIB_SECTIONS - -#define GMEM_MOVEABLE 0 -#define GMEM_DDESHARE 0 -#define GMEM_ZEROINIT 0 - -#define MB_TASKMODAL 0 -#define CS_OWNDC 0 -#define WS_EX_APPWINDOW WS_VISIBLE -#define WS_OVERLAPPEDWINDOW WS_VISIBLE -#define SW_SHOWMAXIMIZED SW_SHOW -#define SW_RESTORE SW_SHOW #ifndef SEEK_SET # define SEEK_SET 0 @@ -76,375 +38,8 @@ # define SEEK_END 2 #endif -#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION - #define LPEXCEPTION_POINTERS EXCEPTION_POINTERS* -#define MF_DISABLED MF_GRAYED - -#ifndef FPOS_T_DEFINED - typedef unsigned long fpos_t; /* Could be 64 bits for Win32 */ -# define FPOS_T_DEFINED -#endif - -#define isdigit(src) ((src <= '9') && (src >= '0')) -#define MoveMemory(_Destination, _Source, _Length) memmove(_Destination, _Source, _Length) -#define ZeroMemory(_Destination, _Length) memset(_Destination, 0, _Length) -#define timeGetTime() 0 // no multimedia timers - - -#else /* !(_WIN32_WCE) */ -/*************************************************************/ -/* Windows 95/98/NT/Blablabla */ -/*************************************************************/ - -/* #define USE_DIRECT_X */ -#define NO_DIRECTINPUT - -/* Definition for Intel Processors */ -#if defined(_M_IX86) || defined(i386) -# define WIN32_NAME "Win32" -# define WIN32_OS_NAME "NT" -# define WIN32_PROCESSOR_NAME "IX86" - -# if defined(X86) -# undef X86 -# define X86 i386 -# endif - -#endif /* _M_IX86 */ - -/* We are stuck with Win32 as a misnomer for the Windows operating system for - * historical reasons. Images up to and including Squeak 5/Pharo 6 expect - * getSystemAttribute: 1001 ("platform name") to answer 'Win32' on Windows. - * Yes, this is regrettable. No, it's not easy to fix without breaking existing - * images :-(. The NT vs CE distinction isn't particularly meaningful either. - * Further (see sqWin32Window.c) parameter 1005 (the windoing system name) also - * answers Win32. Perhaps this could be changed to "Windows", because at least - * in a base Squeak 5.1 image as of mid 2017 there is no use of windowSystemName - * that depends on its result being 'Win32' (see e.g. HandMorph class>> - * #compositionWindowManager). - * eem 2017/05/16 - */ -#if defined(__amd64__) || defined(__amd64) || defined(x86_64) || defined(__x86_64__) || defined(__x86_64) || defined(x64) || defined(_M_X64) -# define WIN32_NAME "Win32" -# define WIN32_OS_NAME "NT" -# define WIN32_PROCESSOR_NAME "X64" - -#endif /* _M_X64 & al */ - #endif /* (_WIN32_WCE) */ -/* Experimental */ -#ifdef MINIMAL - /* The hardcoded defs: - * No virtual memory support; no service support; no preferences; no printing - */ -# define NO_VIRTUAL_MEMORY -# define NO_SERVICE -# define NO_PREFERENCES -# define NO_PRINTER -# define NO_WHEEL_MOUSE - /* Use stub definitions from sqWin32Stubs.c */ -# define NO_SOUND -# define NO_SERIAL_PORT -# define NO_NETWORK -# define NO_JOYSTICK -# define NO_MIDI -# define NO_ASYNC_FILES - /* Do not rely on stdio functions but rather pure Win32 stuff */ -# define WIN32_FILE_SUPPORT - /* Take out the static strings */ -# define NO_WARNINGS -#endif /* MINIMAL */ - -/********************************************************/ -/* Message hooks for processing out of sqWin32Window.c */ -/********************************************************/ -typedef int (*messageHook)(void *, unsigned int, unsigned int, long); - -/********************************************************/ -/* Several setup functions */ -/********************************************************/ -void SetupFilesAndPath(); -void SetupKeymap(); -void SetupWindows(); -void SetupPixmaps(); -void SetupPrinter(); -void SetupMIDI(); - -/********************************************************/ -/* Startup helper functions */ -/********************************************************/ -int findImageFile(); -int openImageFile(); - -/********************************************************/ -/* external SYNCHRONIZED signaling of semaphores */ -/********************************************************/ -int synchronizedSignalSemaphoreWithIndex(int semaIndex); - -/********************************************************/ -/* Image options / VM options */ -/********************************************************/ -char *GetImageOption(int id); -char *GetVMOption(int id); - -/********************************************************/ -/* Misc functions */ -/********************************************************/ -void SetWindowSize(); - -/********************************************************/ -/* Service Stuff */ -/********************************************************/ -#ifndef NO_SERVICE -/* The external startup point for installing squeak as NT service */ -void sqServiceInstall(void); -/* The main() function used by NT services */ -int sqServiceMain(void); -/* The generic main() function for starting squeak */ -int sqMain(int argc, char *argv[]); -#endif - -/********************************************************/ -/********************************************************/ -/* Stuff requiring to include windows.h */ -/********************************************************/ -/********************************************************/ - -#if defined(_WINDOWS_) || defined(__WINDOWS__) || defined(_WINDOWS_H) - -#ifdef _MSC_VER -#define COMPILER "Microsoft Visual C++ " -#define VERSION "" -#endif -#ifdef __GNUC__ -#define COMPILER "gcc " -#define VERSION __VERSION__ -#endif -#ifndef COMPILER -#define COMPILER "(unknown) " -#endif -#ifndef VERSION -#define VERSION "" -#endif - -/********************************************************/ -/* image reversal functions */ -/********************************************************/ -int reverse_image_bytes(unsigned int* dst, unsigned int *src,int depth, int width, RECT *rect); -int reverse_image_words(unsigned int *dst, unsigned int *src,int depth, int width, RECT *rect); - -/********************************************************/ -/* Declarations we may need by other modules */ -/********************************************************/ - -/* Note: a character can require up to 4 bytes in UTF8 encoding - But the expansion from UTF16 -> UTF8 is never more than 3 bytes for 1 short - U+ 0000-U+ 007F - 1byte in utf8, 1 short in utf16. - U+ 0080-U+ 07FF - 2byte in utf8, 1 short in utf16. - U+ 0800-U+ FFFF - 3byte in utf8, 1 short in utf16. - U+10000-U+10FFFF - 4byte in utf8, 2 short in utf16. -*/ -#define MAX_PATH_UTF8 (MAX_PATH*3) - -extern char _imageName []; /* full path and name to image - UTF8 */ -extern WCHAR imageNameW[]; /* full path and name to image - UTF16 */ -extern char imagePathA[]; /* full path to image - UTF8 */ -extern WCHAR imagePathW[]; /* full path to image - UTF16 */ -extern char vmPathA[]; /* full path to interpreter's directory - UTF8 */ -extern WCHAR vmPathW[]; /* full path to interpreter's directory - UTF16 */ -extern char vmNameA[]; /* name of the interpreter's executable - UTF8 */ -extern WCHAR vmNameW[]; /* name of the interpreter's executable - UTF16 */ -extern char windowTitle[]; /* window title string - UTF8 */ -extern char vmBuildString[]; /* the vm build string */ -extern TCHAR windowClassName[]; /* class name for the window */ -extern char squeakIniNameA[]; /* full path to ini file - UTF8 */ -extern WCHAR squeakIniNameW[]; /* full path to ini file - UTF16 */ - -#ifdef UNICODE -#define imageNameT imageNameW /* define the generic TCHAR* version */ -#define imagePath imagePathW -#define vmName vmNameW -#define vmPath vmPathW -#define squeakIniName squeakIniNameW -#else -#define imageNameT _imageName -#define imagePath imagePathA -#define vmName vmNameA -#define vmPath vmPathA -#define squeakIniName squeakIniNameA -#endif - -#define __UNICODE_TEXT(x) L##x -#define _UNICODE_TEXT(x) __UNICODE_TEXT(x) - -extern UINT SQ_LAUNCH_DROP; - -extern const TCHAR U_ON[]; -extern const TCHAR U_OFF[]; -extern const TCHAR U_GLOBAL[]; -extern const WCHAR W_BACKSLASH[]; - -#ifndef NO_PREFERENCES -extern HMENU vmPrefsMenu; /* preferences menu */ -#endif - -extern HWND consoleWindow; /* console */ - - -extern HWND stWindow; /* the squeak window */ -extern HINSTANCE hInstance; /* the instance of squeak running */ -extern HCURSOR currentCursor; /* current cursor displayed by squeak */ -extern HPALETTE palette; /* the palette (might be unused) */ -extern LOGPALETTE *logPal; /* the logical palette definition */ -extern BITMAPINFO *bmi1; /* 1 bit depth bitmap info */ -extern BITMAPINFO *bmi4; /* 4 bit depth bitmap info */ -extern BITMAPINFO *bmi8; /* 8 bit depth bitmap info */ -extern BITMAPINFO *bmi16; /* 16 bit depth bitmap info */ -extern BITMAPINFO *bmi32; /* 32 bit depth bitmap info */ -extern BOOL fIsConsole; /* Are we running as a console app? */ - -/* Startup options */ -extern BOOL fHeadlessImage; /* Do we run headless? */ -extern BOOL fRunService; /* Do we run as NT service? */ -extern DWORD dwMemorySize; /* How much memory do we use? */ -extern BOOL fUseDirectSound;/* Do we use DirectSound?! */ -extern BOOL fUseOpenGL; /* Do we use OpenGL?! */ -extern BOOL fReduceCPUUsage; /* Should we reduce CPU usage? */ -extern BOOL fReduceCPUInBackground; /* reduce CPU usage when not active? */ -extern BOOL f1ButtonMouse; /* Should we use a 1 button mouse mapping? */ -extern BOOL f3ButtonMouse; /* Should we use a 3 button mouse mapping? */ -extern BOOL fShowAllocations; /* Show memory allocations */ -extern BOOL fPriorityBoost; /* thread priority boost */ -extern BOOL fEnableAltF4Quit; /* can we quit using Alt-F4? */ -extern BOOL fEnableF2Menu; /* can we get prefs menu via F2? */ -extern BOOL fEnablePrefsMenu; /* can we get prefs menu at all? */ -extern BOOL fRunSingleApp; /* do we only allow one instance? */ - -extern HANDLE vmWakeUpEvent; /* wakeup event for interpret() */ - -/* variables for cached display */ -extern RECT updateRect; /* the rectangle to update */ -extern HRGN updateRgn; /* the region to update (more accurate) */ -extern BOOL updateRightNow; /* update flag */ - -/********************************************************/ -/* Preference values */ -/********************************************************/ -extern BOOL fDeferredUpdate; /* I prefer the deferred update*/ -extern BOOL fShowConsole; /* do we show the console window?*/ -extern BOOL fDynamicConsole; /* Should we show the console if any errors occur? */ -extern BOOL fReduceCPUUsage; /* Should we reduce CPU usage? */ -extern BOOL f3ButtonMouse; /* Should we use a real 3 button mouse mapping? */ -extern BOOL fBufferMouse; /* Should we buffer mouse input? */ - - -/******************************************************/ -/* Output stuff */ -/******************************************************/ -#ifndef sqMessageBox -int __cdecl sqMessageBox(DWORD dwFlags, const TCHAR *titleString, const TCHAR* fmt, ...); -#endif - -#ifndef abortMessage -int __cdecl abortMessage(TCHAR *fmt, ...); -#endif - -/* neat little helpers - print prefix and the GetLastError() meaning */ -#ifndef printLastError -void printLastError(TCHAR *prefix); -#endif - -#ifndef vprintLastError -void vprintLastError(TCHAR *fmt, ...); -#endif - -/******************************************************/ -/* Misc functions */ -/******************************************************/ -DWORD SqueakImageLength(WCHAR *fileName); -int isLocalFileName(TCHAR *fileName); - -#ifndef NO_PLUGIN_SUPPORT -void pluginInit(void); -void pluginExit(void); -void pluginHandleEvent(MSG* msg); -#endif /* NO_PLUGIN_SUPPORT */ - -#ifndef NO_DROP -int recordDragDropEvent(HWND wnd, int dragType, int x, int y, int numFiles); -#endif - -/****************************************************************************/ -/* few addtional definitions for those having older include files */ -/****************************************************************************/ -#if (WINVER < 0x0400) && !defined(_GNU_H_WINDOWS_H) -/* CreateWindowEx params since Win95/NT4 */ -#define WS_EX_WINDOWEDGE 0x00000100L -#define WS_EX_CLIENTEDGE 0x00000200L -#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE) -#define WS_EX_APPWINDOW 0x00040000L -#define WS_EX_TOOLWINDOW 0x00000080L -#define WS_EX_CONTEXTHELP 0x00000400L - -/* WM_USERCHANGED since Win95/NT4 */ -#define WM_USERCHANGED 0x0054 - -/* Shell_NoifiyIcon() for the system tray on Win95/NT4 */ -typedef struct _NOTIFYICONDATAA { - DWORD cbSize; - HWND hWnd; - UINT uID; - UINT uFlags; - UINT uCallbackMessage; - HICON hIcon; - CHAR szTip[64]; -} NOTIFYICONDATA, *PNOTIFYICONDATA; - -#define NIM_ADD 0x00000000 -#define NIM_MODIFY 0x00000001 -#define NIM_DELETE 0x00000002 - -#define NIF_MESSAGE 0x00000001 -#define NIF_ICON 0x00000002 -#define NIF_TIP 0x00000004 - -#endif /* WINVER < 0x0400 */ - -/* WM_MOUSEWHEEL since Win98/NT4 */ -#ifndef WM_MOUSEWHEEL -#define WM_MOUSEWHEEL 0x020A -#endif - -/******************************************************/ -/* Profiling support */ -/******************************************************/ -#if 0 -#define PROFILE /* if you want some information about times */ -#define PROFILE_DISPLAY 1 /* measure times in ioShowDisplay() */ -#endif - -#if defined(PROFILE) && 0 -#define PROFILE_BEGIN(condition) if(condition) { DWORD __profileTicks = GetTickCount(); -#define PROFILE_END(variable) variable += GetTickCount() - __profileTicks; } -#define PROFILE_SHOW(variable) if(variable) {char s[20]; MessageBox(0,itoa(variable, s, 10), "Milliseconds for " #variable, MB_OK); } -#else -#define PROFILE_BEGIN(condition) -#define PROFILE_END(variable) -#define PROFILE_SHOW(variable) -#endif - -#if defined(PROFILE) && 0 -extern DWORD ticksForReversal; /* time needed for byte/word reversal */ -extern DWORD ticksForBlitting; /* time needed for actual blts */ -#endif - -#endif /* _WINDOWS_ */ - -#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION -# define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000 -#endif - #endif /* SQ_WIN_32_H */ diff --git a/include/pharovm/win/sqWin32Alloc.h b/include/pharovm/win/sqWin32Alloc.h index 34ee257f4eb..472cf0034a7 100644 --- a/include/pharovm/win/sqWin32Alloc.h +++ b/include/pharovm/win/sqWin32Alloc.h @@ -1,8 +1,7 @@ #ifndef __SQ_WIN32_ALLOC_H #define __SQ_WIN32_ALLOC_H -#ifndef NO_VIRTUAL_MEMORY -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /* Limit the default size for virtual memory to 512MB to avoid nasty @@ -28,5 +27,4 @@ sqAllocateMemory(minimumMemory, heapSize, baseAddress) int sqMemoryExtraBytesLeft(int includingSwap); -#endif /* NO_VIRTUAL_MEMORY */ #endif /* __SQ_WIN32_ALLOC_H */ diff --git a/plugins/B2DPlugin/src/common/B2DPlugin.c b/plugins/B2DPlugin/src/common/B2DPlugin.c index 9cafd4318b5..092f7036984 100644 --- a/plugins/B2DPlugin/src/common/B2DPlugin.c +++ b/plugins/B2DPlugin/src/common/B2DPlugin.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.2480 uuid: bb /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -30,7 +30,7 @@ static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.2480 uuid: bb # define EXPORT(returnType) static returnType #endif -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ @@ -798,7 +798,7 @@ extern sqInt isArray(sqInt oop); extern sqInt isBytes(sqInt oop); extern sqInt isFloatObject(sqInt oop); #if !defined(isImmediate) -#if VM_PROXY_MAJOR > 1 || (VM_PROXY_MAJOR == 1 && VM_PROXY_MINOR >= 13) +#if VM_PROXY_MINOR >= 13 extern sqInt isImmediate(sqInt anObject); #else # define isImmediate(anObject) 0 @@ -12561,9 +12561,7 @@ setAALevel(sqInt level) } -/* Note: This is coded so that it can be run in Squeak. */ - - /* InterpreterPlugin>>#setInterpreter: */ +/* InterpreterPlugin>>#setInterpreter: */ EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter) { diff --git a/plugins/BitBltPlugin/include/common/BitBltDispatch.h b/plugins/BitBltPlugin/include/common/BitBltDispatch.h index fa1e71586f4..e643538c52a 100644 --- a/plugins/BitBltPlugin/include/common/BitBltDispatch.h +++ b/plugins/BitBltPlugin/include/common/BitBltDispatch.h @@ -27,7 +27,7 @@ #define BITBLTDISPATCH_H_ #include -#include "sqVirtualMachine.h" +#include "virtualMachine.h" #ifndef ColorMapPresent #define ColorMapPresent 1 diff --git a/plugins/BitBltPlugin/src/common/BitBltPlugin.c b/plugins/BitBltPlugin/src/common/BitBltPlugin.c index 00b19b93a43..93c65a9a175 100644 --- a/plugins/BitBltPlugin/src/common/BitBltPlugin.c +++ b/plugins/BitBltPlugin/src/common/BitBltPlugin.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.2493 uuid: d7437 /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -30,14 +30,14 @@ static char __buildInfo[] = "BitBltSimulation VMMaker.oscog-eem.2493 uuid: d7437 # define EXPORT(returnType) static returnType #endif -#include "sqAssert.h" +#include "assert.h" #ifdef ENABLE_FAST_BLT #include "BitBltDispatch.h" #else // to handle the unavoidable decl in the spec of copyBitsFallback(); #define operation_t void #endif -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ diff --git a/plugins/DSAPrims/src/common/DSAPrims.c b/plugins/DSAPrims/src/common/DSAPrims.c index 7688877ed37..b9645af52af 100644 --- a/plugins/DSAPrims/src/common/DSAPrims.c +++ b/plugins/DSAPrims/src/common/DSAPrims.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "DSAPlugin CryptographyPlugins-eem.14 uuid: 54292ff0 /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -30,7 +30,7 @@ static char __buildInfo[] = "DSAPlugin CryptographyPlugins-eem.14 uuid: 54292ff0 # define EXPORT(returnType) static returnType #endif -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ diff --git a/plugins/FileAttributesPlugin/src/common/FileAttributesPlugin.c b/plugins/FileAttributesPlugin/src/common/FileAttributesPlugin.c index ce32deec713..442f1323f6a 100644 --- a/plugins/FileAttributesPlugin/src/common/FileAttributesPlugin.c +++ b/plugins/FileAttributesPlugin/src/common/FileAttributesPlugin.c @@ -50,7 +50,7 @@ static char __buildInfo[] = "FileAttributesPlugin FileAttributesPlugin.oscog-akg /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -62,7 +62,7 @@ static char __buildInfo[] = "FileAttributesPlugin FileAttributesPlugin.oscog-akg #endif #include "faCommon.h" -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ @@ -243,15 +243,8 @@ attributeArrayformask(sqInt *attributeArrayPtr, fapath *faPath, sqInt attributeM return -15 /* interpreterError */; } -#if SPURVM status = faFileStatAttributes(faPath, getLinkStats, attributeArray); - -#else /* SPURVM */ - pushRemappableOop(attributeArray); - status = faFileStatAttributes(faPath, getLinkStats, attributeArray); - attributeArray = popRemappableOop() -#endif /* SPURVM */ -; + if (status != 0) { return status; } @@ -259,15 +252,8 @@ attributeArrayformask(sqInt *attributeArrayPtr, fapath *faPath, sqInt attributeM } if (getAccess) { -#if SPURVM accessArray = instantiateClassindexableSize(classArray(), 3); -#else /* SPURVM */ - pushRemappableOop(attributeArray); - accessArray = instantiateClassindexableSize(classArray(), 3); - attributeArray = popRemappableOop() -#endif /* SPURVM */ -; if (!(accessArray)) { primitiveFailFor(PrimErrNoMemory); @@ -282,17 +268,8 @@ attributeArrayformask(sqInt *attributeArrayPtr, fapath *faPath, sqInt attributeM if (getStats && (getAccess)) { -#if SPURVM resultOop = instantiateClassindexableSize(classArray(), 2); -#else /* SPURVM */ - pushRemappableOop(attributeArray); - pushRemappableOop(accessArray); - resultOop = instantiateClassindexableSize(classArray(), 2); - accessArray = popRemappableOop(); - attributeArray = popRemappableOop() -#endif /* SPURVM */ -; if (!(resultOop)) { primitiveFailFor(PrimErrNoMemory); @@ -773,7 +750,6 @@ primitiveOpendir(void) faInitSessionId(&faPathPtr.sessionId); (faPathPtr.faPath = faPath); -#if SPURVM /* begin objectFromStruct:size: */ aMachineAddress = (&faPathPtr); structSize = sizeOfFaPathPtr(); @@ -787,23 +763,6 @@ primitiveOpendir(void) dirOop = addressOop; l1: /* end objectFromStruct:size: */; -#else /* SPURVM */ - pushRemappableOop(resultOop); - /* begin objectFromStruct:size: */ - aMachineAddress = (&faPathPtr); - structSize = sizeOfFaPathPtr(); - addressOop = instantiateClassindexableSize(classByteArray(), structSize); - if (!(addressOop)) { - dirOop = primitiveFailFor(PrimErrNoMemory); - goto l1; - } - addressOopArrayPointer = arrayValueOf(addressOop); - memcpy(addressOopArrayPointer, aMachineAddress, structSize); - dirOop = addressOop; - l1: /* end objectFromStruct:size: */; - resultOop = popRemappableOop() -#endif /* SPURVM */ -; return (storePointerofObjectwithValue(2, resultOop, dirOop), methodReturnValue(resultOop)); } @@ -1069,17 +1028,8 @@ processDirectory(fapath *faPath) } } -#if SPURVM resultArray = instantiateClassindexableSize(classArray(), 3); -#else /* SPURVM */ - pushRemappableOop(entryName); - pushRemappableOop(attributeArray); - resultArray = instantiateClassindexableSize(classArray(), 3); - attributeArray = popRemappableOop(); - entryName = popRemappableOop() -#endif /* SPURVM */ -; if (!(resultArray)) { return primitiveFailFor(PrimErrNoMemory); } diff --git a/plugins/FilePlugin/include/common/FilePlugin.h b/plugins/FilePlugin/include/common/FilePlugin.h index 1ec7fc23d20..7ad6dccad38 100644 --- a/plugins/FilePlugin/include/common/FilePlugin.h +++ b/plugins/FilePlugin/include/common/FilePlugin.h @@ -24,7 +24,7 @@ typedef int mode_t; #endif -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /* squeak file record; see sqFilePrims.c for details */ typedef struct { @@ -49,7 +49,7 @@ typedef struct { sqInt sqFileAtEnd(SQFile *f); sqInt sqFileClose(SQFile *f); sqInt sqFileDeleteNameSize(char *sqFileName, sqInt sqFileNameSize); -squeakFileOffsetType sqFileGetPosition(SQFile *f); +fileOffset_t sqFileGetPosition(SQFile *f); sqInt sqFileInit(void); sqInt sqFileShutdown(void); sqInt sqFileOpen(SQFile *f, char *sqFileName, sqInt sqFileNameSize, sqInt writeFlag); @@ -58,13 +58,13 @@ sqInt sqConnectToFileDescriptor(SQFile *f, int fd, sqInt writeFlag); sqInt sqConnectToFile(SQFile *f, void *file, sqInt writeFlag); size_t sqFileReadIntoAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startIndex); sqInt sqFileRenameOldSizeNewSize(char *sqOldName, sqInt sqOldNameSize, char *sqNewName, sqInt sqNewNameSize); -sqInt sqFileSetPosition(SQFile *f, squeakFileOffsetType position); -squeakFileOffsetType sqFileSize(SQFile *f); +sqInt sqFileSetPosition(SQFile *f, fileOffset_t position); +fileOffset_t sqFileSize(SQFile *f); sqInt sqFileValid(SQFile *f); size_t sqFileWriteFromAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startIndex); sqInt sqFileFlush(SQFile *f); sqInt sqFileSync(SQFile *f); -sqInt sqFileTruncate(SQFile *f,squeakFileOffsetType offset); +sqInt sqFileTruncate(SQFile *f,fileOffset_t offset); sqInt sqFileThisSession(void); sqInt sqFileStdioHandlesInto(SQFile files[3]); sqInt sqFileDescriptorType(int fdNum); @@ -79,11 +79,11 @@ sqInt dir_Delimitor(void); sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink); + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink); sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char *nameString, sqInt nameStringLength, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink); + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink); sqInt dir_PathToWorkingDir(char *pathName, sqInt pathNameMax); sqInt dir_SetMacFileTypeAndCreator(char *filename, sqInt filenameSize, char *fType, char *fCreator); sqInt dir_GetMacFileTypeAndCreator(char *filename, sqInt filenameSize, char *fType, char *fCreator); diff --git a/plugins/FilePlugin/src/unix/sqFilePluginBasicPrims.c b/plugins/FilePlugin/src/unix/sqFilePluginBasicPrims.c index 1373a49b4a0..e5bb1ddf1aa 100644 --- a/plugins/FilePlugin/src/unix/sqFilePluginBasicPrims.c +++ b/plugins/FilePlugin/src/unix/sqFilePluginBasicPrims.c @@ -19,41 +19,31 @@ fseeko ftruncate & fileno macro-ise use of sqFTruncate to avoid non-ansi -* 1/22/2002 JMM Use squeakFileOffsetType versus off_t -* -*****************************************************************************/ +* 1/22/2002 JMM Use fileOffset_t fileOffset_t +************************************************************************/ /* The basic prim code for file operations. See also the platform specific * files typically named 'sq{blah}Directory.c' for details of the directory -* handling code. Note that the win32 platform #defines NO_STD_FILE_SUPPORT -* and thus bypasses this file +* handling code. */ #include "sq.h" #include -#ifndef NO_STD_FILE_SUPPORT - #include #include #include #include -#ifdef _MSC_VER -#ifndef S_ISFIFO -#define S_ISFIFO(x) 0 -#endif -#endif - -#include "sqMemoryAccess.h" +#include "memoryAccess.h" #include "FilePlugin.h" /* must be included after sq.h */ -#include "sqaio.h" +#include "aio.h" /*** The state of a file is kept in the following structure, - which is stored directly in a Squeak bytes object. - NOTE: The Squeak side is responsible for creating an + which is stored directly in a bytes object. + NOTE: The library side is responsible for creating an object with enough room to store sizeof(SQFile) bytes. The session ID is used to detect stale file objects-- @@ -119,12 +109,12 @@ static void setFile(SQFile *f, FILE *file) # define setFile(f,fileptr) ((f)->file = (fileptr)) #endif /* OBJECTS_32BIT_ALIGNED */ -static squeakFileOffsetType getSize(SQFile *f) +static fileOffset_t getSize(SQFile *f) { FILE *file = getFile(f); - squeakFileOffsetType currentPosition = ftell(file); + fileOffset_t currentPosition = ftell(file); fseek(file, 0, SEEK_END); - squeakFileOffsetType size = ftell(file); + fileOffset_t size = ftell(file); fseek(file, currentPosition, SEEK_SET); return size; } @@ -219,16 +209,15 @@ sqFileDeleteNameSize(char *sqFileName, sqInt sqFileNameSize) { return 1; } -squeakFileOffsetType +fileOffset_t sqFileGetPosition(SQFile *f) { /* Return the current position of the file's read/write head. */ - squeakFileOffsetType position; + fileOffset_t position; if (!sqFileValid(f)) return interpreterProxy->success(false); - if (f->isStdioStream - && !f->writable) + if (f->isStdioStream && !f->writable) return f->lastChar == EOF ? 0 : 1; position = ftell(getFile(f)); if (position == -1) @@ -307,7 +296,7 @@ sqFileOpen(SQFile *f, char *sqFileName, sqInt sqFileNameSize, sqInt writeFlag) { /* Opens the given file using the supplied sqFile structure to record its state. Fails with no side effects if f is already open. Files are always opened in binary mode; - Squeak must take care of any line-end character mapping. + The Library must take care of any line-end character mapping. */ char cFileName[PATH_MAX]; @@ -417,7 +406,7 @@ sqFileOpenNew(SQFile *f, char *sqFileName, sqInt sqFileNameSize, int *exists) { When failing, it sets 'exists' to true if the failure was caused by the named file already existing. Fails with no side effects (besides resetting 'exists') if f is already - open. Files are always opened in binary mode; Squeak must + open. Files are always opened in binary mode; the Library must take care of any line-end character mapping. */ @@ -591,7 +580,6 @@ sqInt sqFileDescriptorType(int fdNum) { /* Is this a pipe? */ status = fstat(fdNum, &statBuf); if (status) return -1; - if (S_ISFIFO(statBuf.st_mode)) return 2; /* Must be a normal file */ return 3; @@ -602,7 +590,7 @@ size_t sqFileReadIntoAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startIndex) { /* Read count bytes from the given file into byteArray starting at startIndex. byteArray is the address of the first byte of a - Squeak bytes object (e.g. String or ByteArray). startIndex + The library bytes object (e.g. String or ByteArray). startIndex is a zero-based index; that is a startIndex of 0 starts writing at the first byte of byteArray. */ @@ -613,7 +601,7 @@ sqFileReadIntoAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startInde #if COGMTVM sqInt myThreadIndex; #endif -#if COGMTVM && SPURVM +#if COGMTVM int wasPinned; sqInt bufferOop = (sqInt)byteArrayIndex - BaseHeaderSize; #endif @@ -630,23 +618,12 @@ sqFileReadIntoAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startInde dst = byteArrayIndex + startIndex; if (f->isStdioStream) { #if COGMTVM -# if SPURVM if (!(wasPinned = interpreterProxy->isPinned(bufferOop))) { if (!(bufferOop = interpreterProxy->pinObject(bufferOop))) return 0; dst = bufferOop + BaseHeaderSize + startIndex; } myThreadIndex = interpreterProxy->disownVM(0); -# else - if (interpreterProxy->isInMemory((sqInt)f) - && interpreterProxy->isYoung((sqInt)f) - || interpreterProxy->isInMemory((sqInt)dst) - && interpreterProxy->isYoung((sqInt)dst)) { - interpreterProxy->primitiveFailFor(PrimErrObjectMayMove); - return 0; - } - myThreadIndex = interpreterProxy->disownVM(DisownVMLockOutFullGC); -# endif #endif bytesRead = 0; @@ -675,10 +652,8 @@ sqFileReadIntoAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startInde #if COGMTVM interpreterProxy->ownVM(myThreadIndex); -# if SPURVM if (!wasPinned) interpreterProxy->unpinObject(bufferOop); -# endif #endif /* COGMTVM */ } else @@ -715,7 +690,7 @@ sqFileRenameOldSizeNewSize(char *sqOldName, sqInt sqOldNameSize, char *sqNewName } sqInt -sqFileSetPosition(SQFile *f, squeakFileOffsetType position) { +sqFileSetPosition(SQFile *f, fileOffset_t position) { /* Set the file's read/write head to the given position. */ if (!sqFileValid(f)) @@ -724,7 +699,7 @@ sqFileSetPosition(SQFile *f, squeakFileOffsetType position) { /* support one character of pushback for stdio streams. */ if (!f->writable && f->lastChar != EOF) { - squeakFileOffsetType currentPos = f->lastChar == EOF ? 0 : 1; + fileOffset_t currentPos = f->lastChar == EOF ? 0 : 1; if (currentPos == position) return 1; if (currentPos - 1 == position) { @@ -740,7 +715,7 @@ sqFileSetPosition(SQFile *f, squeakFileOffsetType position) { return 1; } -squeakFileOffsetType +fileOffset_t sqFileSize(SQFile *f) { /* Return the length of the given file. */ @@ -757,7 +732,7 @@ sqFileFlush(SQFile *f) { if (!sqFileValid(f)) return interpreterProxy->success(false); - + /* * fflush() can fail for the same reasons write() can so errors must be checked but * sqFileFlush() must support being called on readonly files for historical reasons @@ -781,7 +756,7 @@ sqFileSync(SQFile *f) { } sqInt -sqFileTruncate(SQFile *f, squeakFileOffsetType offset) { +sqFileTruncate(SQFile *f, fileOffset_t offset) { if (!sqFileValid(f)) return interpreterProxy->success(false); fflush(getFile(f)); @@ -844,6 +819,4 @@ waitForDataonSemaphoreIndex(SQFile *file, sqInt semaphoreIndex){ aioHandle(fileno(getFile(file)), signalOnDataArrival, AIO_R); return interpreterProxy->success(true); -} - -#endif /* NO_STD_FILE_SUPPORT */ +} \ No newline at end of file diff --git a/plugins/FilePlugin/src/unix/sqUnixCharConv.c b/plugins/FilePlugin/src/unix/sqUnixCharConv.c index 164b7efa3c9..b483dd40c54 100644 --- a/plugins/FilePlugin/src/unix/sqUnixCharConv.c +++ b/plugins/FilePlugin/src/unix/sqUnixCharConv.c @@ -30,7 +30,7 @@ */ #if !defined(__MACH__) -# include "sqMemoryAccess.h" +# include "memoryAccess.h" #endif #include "sqUnixCharConv.h" @@ -60,7 +60,7 @@ static int convertCopy(char *from, int fromLen, char *to, int toLen, int term) // - the free libiconv cannot handle the canonical decomposition used in HFS+ # include -# include "sqMemoryAccess.h" +# include "memoryAccess.h" typedef struct { diff --git a/plugins/FilePlugin/src/unix/sqUnixFile.c b/plugins/FilePlugin/src/unix/sqUnixFile.c index c1802df9aac..a4b038e3358 100644 --- a/plugins/FilePlugin/src/unix/sqUnixFile.c +++ b/plugins/FilePlugin/src/unix/sqUnixFile.c @@ -174,7 +174,7 @@ static int maybeOpenDir(char *unixPath) sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt * posixPermissions, sqInt *isSymlink) + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt * posixPermissions, sqInt *isSymlink) { /* Lookup the index-th entry of the directory with the given path, starting at the root of the file system. Set the name, name length, creation date, @@ -296,7 +296,7 @@ sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index, sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char* nameString, sqInt nameStringLength, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink) + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink) { /* Lookup the given name in the given directory, Set the name, name length, creation date, diff --git a/plugins/FilePlugin/src/win/sqWin32Directory.c b/plugins/FilePlugin/src/win/sqWin32Directory.c index c8db78e4f5b..43343020345 100644 --- a/plugins/FilePlugin/src/win/sqWin32Directory.c +++ b/plugins/FilePlugin/src/win/sqWin32Directory.c @@ -156,7 +156,7 @@ typedef union { DWORD dwLow; DWORD dwHigh; }; - squeakFileOffsetType offset; + fileOffset_t offset; } win32FileOffset; DWORD convertToSqueakTime(SYSTEMTIME st) @@ -193,7 +193,7 @@ sqInt dir_Delimitor(void) { return '\\'; } sqInt dir_Lookup(char *pathString, sqInt pathLength, sqInt index, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink) + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink) { /* Lookup the index-th entry of the directory with the given path, starting at the root of the file system. Set the name, name length, creation date, @@ -305,11 +305,7 @@ sqInt dir_Lookup(char *pathString, sqInt pathLength, sqInt index, if (findHandle == INVALID_HANDLE_VALUE) { /* Directory could be empty, so we must check for that */ DWORD dwErr = GetLastError(); -#ifdef PharoVM return (dwErr == ERROR_NO_MORE_FILES || dwErr == ERROR_ACCESS_DENIED) ? NO_MORE_ENTRIES : BAD_PATH; -#else - return (dwErr == ERROR_NO_MORE_FILES) ? NO_MORE_ENTRIES : BAD_PATH; -#endif } while (1) { /* check for '.' or '..' directories */ @@ -354,7 +350,7 @@ sqInt dir_Lookup(char *pathString, sqInt pathLength, sqInt index, sqInt dir_EntryLookup(char *pathString, sqInt pathLength, char* nameString, sqInt nameStringLength, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink) + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink) { /* Lookup a given file in a given named directory. Set the name, name length, creation date, @@ -431,15 +427,11 @@ sqInt dir_EntryLookup(char *pathString, sqInt pathLength, char* nameString, sqIn ALLOC_WIN32_PATH(win32Path, fullPath, fullPathLength); if (!GetFileAttributesExW(win32Path, 0, &winAttrs)) { -#ifdef PharoVM if (GetLastError() == ERROR_SHARING_VIOLATION) { if (!findFileFallbackOnSharingViolation(win32Path, &winAttrs)) return NO_MORE_ENTRIES; } else { return NO_MORE_ENTRIES; } -#else - return NO_MORE_ENTRIES; -#endif } memcpy(name, nameString, nameStringLength); diff --git a/plugins/FilePlugin/src/win/sqWin32FilePrims.c b/plugins/FilePlugin/src/win/sqWin32FilePrims.c index 1ae648ce48e..0c766987a01 100644 --- a/plugins/FilePlugin/src/win/sqWin32FilePrims.c +++ b/plugins/FilePlugin/src/win/sqWin32FilePrims.c @@ -11,8 +11,6 @@ * 1) This is a bare windows implementation *not* using any stdio stuff. * It can be used instead of the standard sqFilePrims.c file on systems * not having standard io libraries (e.g. WinCE) -* 2) For using this you'll need to define WIN32_FILE_SUPPORT globally -* (e.g., in your compiler's project settings) * * UPDATES: * 1) Support for long path names added by using UNC prefix in that case @@ -32,12 +30,10 @@ #include "sqWin32File.h" #include "pharovm/debug.h" -#include "sqaio.h" +#include "aio.h" extern struct VirtualMachine *interpreterProxy; -#ifdef WIN32_FILE_SUPPORT - #define true 1 #define false 0 @@ -79,7 +75,7 @@ int hasCaseSensitiveDuplicate(WCHAR *path); typedef union { LARGE_INTEGER li; - squeakFileOffsetType offset; + fileOffset_t offset; } win32FileOffset; @@ -142,7 +138,7 @@ sqInt sqFileDeleteNameSize(char* fileNameIndex, sqInt fileNameSize) { return 1; } -squeakFileOffsetType sqFileGetPosition(SQFile *f) { +fileOffset_t sqFileGetPosition(SQFile *f) { win32FileOffset ofs; /* Return the current position of the file's read/write head. */ if (!sqFileValid(f)) @@ -464,7 +460,7 @@ sqInt sqFileRenameOldSizeNewSize(char* oldNameIndex, sqInt oldNameSize, char* ne return 1; } -sqInt sqFileSetPosition(SQFile *f, squeakFileOffsetType position) +sqInt sqFileSetPosition(SQFile *f, fileOffset_t position) { win32FileOffset ofs; ofs.offset = position; @@ -475,7 +471,7 @@ sqInt sqFileSetPosition(SQFile *f, squeakFileOffsetType position) return 1; } -squeakFileOffsetType sqFileSize(SQFile *f) { +fileOffset_t sqFileSize(SQFile *f) { /* Return the length of the given file. */ win32FileOffset ofs; if (!sqFileValid(f)) @@ -501,7 +497,7 @@ sqInt sqFileSync(SQFile *f) { return sqFileFlush(f); } -sqInt sqFileTruncate(SQFile *f, squeakFileOffsetType offset) { +sqInt sqFileTruncate(SQFile *f, fileOffset_t offset) { win32FileOffset ofs; ofs.offset = offset; if (!sqFileValid(f)) @@ -552,6 +548,4 @@ handleWaitOnStream(int fd, void *clientData, int flag){ EXPORT(sqInt) waitForDataonSemaphoreIndex(SQFile *file, sqInt semaphoreIndex){ aioEnableExternalHandler((int)FILE_HANDLE(file), FILE_HANDLE(file), (void*)semaphoreIndex, handleWaitOnStream, AIO_R); -} - -#endif /* WIN32_FILE_SUPPORT */ +} \ No newline at end of file diff --git a/plugins/JPEGReadWriter2Plugin/src/common/JPEGReadWriter2Plugin.c b/plugins/JPEGReadWriter2Plugin/src/common/JPEGReadWriter2Plugin.c index bb9e1550fff..0c85d2ad024 100644 --- a/plugins/JPEGReadWriter2Plugin/src/common/JPEGReadWriter2Plugin.c +++ b/plugins/JPEGReadWriter2Plugin/src/common/JPEGReadWriter2Plugin.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "JPEGReadWriter2Plugin VMMaker.oscog-eem.2493 uuid: /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -31,7 +31,7 @@ static char __buildInfo[] = "JPEGReadWriter2Plugin VMMaker.oscog-eem.2493 uuid: #endif #include "JPEGReadWriter2Plugin.h" -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ diff --git a/plugins/JPEGReaderPlugin/src/common/JPEGReaderPlugin.c b/plugins/JPEGReaderPlugin/src/common/JPEGReaderPlugin.c index a8e0acaa7ee..f43abfc17ff 100644 --- a/plugins/JPEGReaderPlugin/src/common/JPEGReaderPlugin.c +++ b/plugins/JPEGReaderPlugin/src/common/JPEGReaderPlugin.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.2480 uuid: bb3ff /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -30,7 +30,7 @@ static char __buildInfo[] = "JPEGReaderPlugin VMMaker.oscog-eem.2480 uuid: bb3ff # define EXPORT(returnType) static returnType #endif -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ diff --git a/plugins/LargeIntegers/src/common/LargeIntegers.c b/plugins/LargeIntegers/src/common/LargeIntegers.c index 5bac5ba9af2..f80106c4364 100644 --- a/plugins/LargeIntegers/src/common/LargeIntegers.c +++ b/plugins/LargeIntegers/src/common/LargeIntegers.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.2495 uuid: fc /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -30,7 +30,7 @@ static char __buildInfo[] = "LargeIntegersPlugin VMMaker.oscog-eem.2495 uuid: fc # define EXPORT(returnType) static returnType #endif -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ @@ -79,7 +79,6 @@ static const int andOpIndex = 0; # define isIntegerObject(oop) ((oop) & 1) -# if SPURVM extern sqInt classIndexOf(sqInt); # define LargeNegativeIntegerClassIndex 32 # define LargePositiveIntegerClassIndex 33 @@ -92,7 +91,6 @@ extern sqInt classIndexOf(sqInt); # define isLargeIntegerObject(oop) (!isImmediate(oop) && (unsigned)(classIndexOf(oop) - LargeNegativeIntegerClassIndex) <= 1) # define isLargeNegativeIntegerObject(oop) (!isImmediate(oop) && classIndexOf(oop) == LargeNegativeIntegerClassIndex) # define isLargePositiveIntegerObject(oop) (!isImmediate(oop) && classIndexOf(oop) == LargePositiveIntegerClassIndex) -# endif /* SPURVM */ #endif /* defined(SQUEAK_BUILTIN_PLUGIN) */ #if !defined(isKindOfInteger) @@ -476,15 +474,8 @@ digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, sqInt opIx) return primitiveFail(); } -#if SPURVM firstLarge = createLargeFromSmallInteger(firstInteger); -#else /* SPURVM */ - pushRemappableOop(secondInteger); - firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop() -#endif /* SPURVM */ -; } else { if (!(isLargePositiveIntegerObject(firstInteger))) { @@ -497,15 +488,7 @@ digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, sqInt opIx) return primitiveFail(); } -#if SPURVM - secondLarge = createLargeFromSmallInteger(secondInteger); - -#else /* SPURVM */ - pushRemappableOop(firstLarge); secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop() -#endif /* SPURVM */ -; } else { if (!(isLargePositiveIntegerObject(secondInteger))) { @@ -530,17 +513,8 @@ digitBitLogicwithopIndex(sqInt firstInteger, sqInt secondInteger, sqInt opIx) longLarge = firstLarge; } -#if SPURVM result = instantiateClassindexableSize(classLargePositiveInteger(), longLen); -#else /* SPURVM */ - pushRemappableOop(shortLarge); - pushRemappableOop(longLarge); - result = instantiateClassindexableSize(classLargePositiveInteger(), longLen); - longLarge = popRemappableOop(); - shortLarge = popRemappableOop() -#endif /* SPURVM */ -; if (!(result)) { return primitiveFailFor(PrimErrNoMemory); } @@ -641,15 +615,8 @@ digitLshift(sqInt anOop, sqInt shiftCount) } newByteLen = ((highBit + shiftCount) + 7) / 8; -#if SPURVM newOop = instantiateClassindexableSize(fetchClassOf(anOop), newByteLen); -#else /* SPURVM */ - pushRemappableOop(anOop); - newOop = instantiateClassindexableSize(fetchClassOf(anOop), newByteLen); - anOop = popRemappableOop() -#endif /* SPURVM */ -; if (!(newOop)) { primitiveFailFor(PrimErrNoMemory); return null; @@ -745,15 +712,8 @@ digitRshiftlookfirst(sqInt anOop, sqInt shiftCount, sqInt a) newByteLen = (newBitLen + 7) / 8; newDigitLen = (newByteLen + 3) / 4; -#if SPURVM newOop = instantiateClassindexableSize(fetchClassOf(anOop), newByteLen); -#else /* SPURVM */ - pushRemappableOop(anOop); - newOop = instantiateClassindexableSize(fetchClassOf(anOop), newByteLen); - anOop = popRemappableOop() -#endif /* SPURVM */ -; if (!(newOop)) { return primitiveFailFor(PrimErrNoMemory); } @@ -841,24 +801,12 @@ largeIntgrowTo(sqInt aBytesObject, sqInt newByteLen) unsigned int *pFrom; unsigned int *pTo; - -#if SPURVM newBytes = instantiateClassindexableSize(fetchClassOf(aBytesObject), newByteLen); if (!(newBytes)) { primitiveFailFor(PrimErrNoMemory); return null; } -#else /* SPURVM */ - pushRemappableOop(aBytesObject); - newBytes = instantiateClassindexableSize(fetchClassOf(aBytesObject), newByteLen); - if (!(newBytes)) { - primitiveFailFor(PrimErrNoMemory); - return null; - } - aBytesObject = popRemappableOop() -#endif /* SPURVM */ -; newDigitLen = (newByteLen + 3) / 4; /* begin digitSizeOfLargeInt: */ oldDigitLen = ((slotSizeOf(aBytesObject)) + 3) / 4; @@ -1091,16 +1039,7 @@ primDigitAdd(void) if (isIntegerObject(firstInteger)) { /* convert it to a not normalized LargeInteger */ - -#if SPURVM - firstLarge = createLargeFromSmallInteger(firstInteger); - -#else /* SPURVM */ - pushRemappableOop(secondInteger); firstLarge = createLargeFromSmallInteger(firstInteger); - secondInteger = popRemappableOop() -#endif /* SPURVM */ -; } else { firstLarge = firstInteger; @@ -1109,15 +1048,7 @@ primDigitAdd(void) /* convert it to a not normalized LargeInteger */ -#if SPURVM - secondLarge = createLargeFromSmallInteger(secondInteger); - -#else /* SPURVM */ - pushRemappableOop(firstLarge); secondLarge = createLargeFromSmallInteger(secondInteger); - firstLarge = popRemappableOop() -#endif /* SPURVM */ -; } else { secondLarge = secondInteger; @@ -1140,23 +1071,11 @@ primDigitAdd(void) longDigitLen = firstDigitLen; } -#if SPURVM /* begin createLargeIntegerNeg:digitLength: */ sum = instantiateClassindexableSize((neg ? classLargeNegativeInteger() : classLargePositiveInteger()), longDigitLen * 4); -#else /* SPURVM */ - pushRemappableOop(shortInt); - pushRemappableOop(longInt); - /* begin createLargeIntegerNeg:digitLength: */ - sum = instantiateClassindexableSize((neg - ? classLargeNegativeInteger() - : classLargePositiveInteger()), longDigitLen * 4); - longInt = popRemappableOop(); - shortInt = popRemappableOop() -#endif /* SPURVM */ -; if (!(sum)) { _return_value = primitiveFailFor(PrimErrNoMemory); goto l6; @@ -1179,21 +1098,11 @@ primDigitAdd(void) /* sum := sum growby: 1. */ -#if SPURVM /* begin createLargeIntegerNeg:byteLength: */ newSum = instantiateClassindexableSize((neg ? classLargeNegativeInteger() : classLargePositiveInteger()), (longDigitLen * 4) + 1); -#else /* SPURVM */ - pushRemappableOop(sum); - /* begin createLargeIntegerNeg:byteLength: */ - newSum = instantiateClassindexableSize((neg - ? classLargeNegativeInteger() - : classLargePositiveInteger()), (longDigitLen * 4) + 1); - sum = popRemappableOop() -#endif /* SPURVM */ -; if (!(newSum)) { _return_value = primitiveFailFor(PrimErrNoMemory); goto l6; diff --git a/plugins/LocalePlugin/include/osx/sqIOSLocale.h b/plugins/LocalePlugin/include/osx/sqIOSLocale.h index 07202716ee3..bbedee5d24a 100644 --- a/plugins/LocalePlugin/include/osx/sqIOSLocale.h +++ b/plugins/LocalePlugin/include/osx/sqIOSLocale.h @@ -6,7 +6,7 @@ * */ -#include "sqMemoryAccess.h" +#include "memoryAccess.h" #include #include "sq.h" diff --git a/plugins/LocalePlugin/src/common/LocalePlugin.c b/plugins/LocalePlugin/src/common/LocalePlugin.c index 6a697c2d77e..d49e641dcb8 100644 --- a/plugins/LocalePlugin/src/common/LocalePlugin.c +++ b/plugins/LocalePlugin/src/common/LocalePlugin.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "LocalePlugin VMMaker.oscog-eem.2495 uuid: fcbf4c90- /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -31,7 +31,7 @@ static char __buildInfo[] = "LocalePlugin VMMaker.oscog-eem.2495 uuid: fcbf4c90- #endif #include "LocalePlugin.h" -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Function Prototypes ***/ diff --git a/plugins/MiscPrimitivePlugin/src/common/MiscPrimitivePlugin.c b/plugins/MiscPrimitivePlugin/src/common/MiscPrimitivePlugin.c index 0eb51e8a803..e279afb589c 100644 --- a/plugins/MiscPrimitivePlugin/src/common/MiscPrimitivePlugin.c +++ b/plugins/MiscPrimitivePlugin/src/common/MiscPrimitivePlugin.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.2480 uuid: bb /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -30,7 +30,7 @@ static char __buildInfo[] = "MiscPrimitivePlugin VMMaker.oscog-eem.2480 uuid: bb # define EXPORT(returnType) static returnType #endif -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ diff --git a/plugins/SocketPlugin/src/common/SocketPlugin.c b/plugins/SocketPlugin/src/common/SocketPlugin.c index 3babff982c8..ba25ff22ef0 100644 --- a/plugins/SocketPlugin/src/common/SocketPlugin.c +++ b/plugins/SocketPlugin/src/common/SocketPlugin.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.2495 uuid: fcbf4c90- /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -31,7 +31,7 @@ static char __buildInfo[] = "SocketPlugin VMMaker.oscog-eem.2495 uuid: fcbf4c90- #endif #include "SocketPlugin.h" -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Constants ***/ diff --git a/plugins/SocketPlugin/src/common/SocketPluginImpl.c b/plugins/SocketPlugin/src/common/SocketPluginImpl.c index e15000ab287..85375d47f46 100644 --- a/plugins/SocketPlugin/src/common/SocketPluginImpl.c +++ b/plugins/SocketPlugin/src/common/SocketPluginImpl.c @@ -54,7 +54,7 @@ #include "pharovm/pharo.h" #include "sq.h" #include "SocketPlugin.h" -#include "sqaio.h" +#include "aio.h" #include "pharovm/debug.h" #ifdef ACORN @@ -294,19 +294,6 @@ int getLastSocketError(){ #endif } - -#ifdef AIO_DEBUG -char *socketHandlerName(aioHandler h) -{ - if (h == acceptHandler) return "acceptHandler"; - if (h == connectHandler) return "connectHandler"; - if (h == dataHandler) return "dataHandler"; - if (h == closeHandler) return "closeHandler"; - return "***unknownHandler***"; -} -#endif - - /*** module initialisation/shutdown ***/ #ifdef _WIN32 diff --git a/plugins/SqueakSSL/src/common/SqueakSSL.c b/plugins/SqueakSSL/src/common/SqueakSSL.c index 04dde31c21b..66c6a638236 100644 --- a/plugins/SqueakSSL/src/common/SqueakSSL.c +++ b/plugins/SqueakSSL/src/common/SqueakSSL.c @@ -19,7 +19,7 @@ static char __buildInfo[] = "SqueakSSLPlugin VMMaker.oscog-eem.2480 uuid: bb3ffd /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -31,7 +31,7 @@ static char __buildInfo[] = "SqueakSSLPlugin VMMaker.oscog-eem.2480 uuid: bb3ffd #endif #include "SqueakSSL.h" -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /*** Function Prototypes ***/ diff --git a/plugins/SurfacePlugin/include/common/SurfacePlugin.h b/plugins/SurfacePlugin/include/common/SurfacePlugin.h index cf97708be02..d76720a52f5 100644 --- a/plugins/SurfacePlugin/include/common/SurfacePlugin.h +++ b/plugins/SurfacePlugin/include/common/SurfacePlugin.h @@ -1,7 +1,7 @@ #ifndef __SQ_DRAW_SURFACE_H #define __SQ_DRAW_SURFACE_H -#include "sqMemoryAccess.h" +#include "memoryAccess.h" /* v1.0 */ #define SQ_SURFACE_MAJOR 1 #define SQ_SURFACE_MINOR 0 diff --git a/plugins/SurfacePlugin/src/common/sqManualSurface.c b/plugins/SurfacePlugin/src/common/sqManualSurface.c index d7ed4efb68c..47d446150cc 100644 --- a/plugins/SurfacePlugin/src/common/sqManualSurface.c +++ b/plugins/SurfacePlugin/src/common/sqManualSurface.c @@ -1,6 +1,6 @@ #include "sq.h" -#include "sqVirtualMachine.h" +#include "virtualMachine.h" extern struct VirtualMachine* interpreterProxy; #ifndef NULL diff --git a/plugins/UnixOSProcessPlugin/src/common/UnixOSProcessPlugin.c b/plugins/UnixOSProcessPlugin/src/common/UnixOSProcessPlugin.c index 7f1c125845a..0517b6db5d7 100644 --- a/plugins/UnixOSProcessPlugin/src/common/UnixOSProcessPlugin.c +++ b/plugins/UnixOSProcessPlugin/src/common/UnixOSProcessPlugin.c @@ -35,7 +35,7 @@ static char __buildInfo[] = "UnixOSProcessPlugin VMConstruction-Plugins-OSProces /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -50,8 +50,8 @@ static char __buildInfo[] = "UnixOSProcessPlugin VMConstruction-Plugins-OSProces #include "FilePlugin.h" #include "SocketPlugin.h" -#include "sqaio.h" -#include "sqMemoryAccess.h" +#include "aio.h" +#include "memoryAccess.h" /*** Constants ***/ diff --git a/smalltalksrc/Melchor/VMBasicConstants.class.st b/smalltalksrc/Melchor/VMBasicConstants.class.st index 8ff11c859e8..624b88091d9 100644 --- a/smalltalksrc/Melchor/VMBasicConstants.class.st +++ b/smalltalksrc/Melchor/VMBasicConstants.class.st @@ -99,8 +99,7 @@ VMBasicConstants class >> namesDefinedAtCompileTime [ will be emitted within #if defined(ANameDefinedAtCompileTime)...#endif." ^#( VMBIGENDIAN IMMUTABILITY - STACKVM COGVM SPURVM - PharoVM "Pharo vs Squeak" + STACKVM COGVM CheckRememberedInTrampoline "IMMUTABILITY" LLDB "As of lldb-370.0.42 Swift-3.1, passing funciton parameters to printOopsSuchThat fails with Internal error [IRForTarget]: Couldn't rewrite one of the arguments of a function call. Turning off link time optimization with -fno-lto has no effect. hence we define some debugging functions as being " diff --git a/smalltalksrc/Melchor/VMClass.class.st b/smalltalksrc/Melchor/VMClass.class.st index 1dd12ee7a90..6a94e53a23d 100644 --- a/smalltalksrc/Melchor/VMClass.class.st +++ b/smalltalksrc/Melchor/VMClass.class.st @@ -154,7 +154,7 @@ VMClass class >> initialize [ { #category : 'initialization' } VMClass class >> initializePrimitiveErrorCodes [ "Define the VM's primitive error codes. N.B. these are - replicated in platforms/Cross/vm/sqVirtualMachine.h." + replicated in platforms/Cross/vm/virtualMachine.h." "VMClass initializePrimitiveErrorCodes" | pet | PrimErrTableIndex := 51. "Zero-relative" diff --git a/smalltalksrc/Melchor/VMPluginCodeGenerator.class.st b/smalltalksrc/Melchor/VMPluginCodeGenerator.class.st index 5042506e1b3..094a958669a 100644 --- a/smalltalksrc/Melchor/VMPluginCodeGenerator.class.st +++ b/smalltalksrc/Melchor/VMPluginCodeGenerator.class.st @@ -144,7 +144,7 @@ VMPluginCodeGenerator >> emitCHeaderOn: aStream [ /* 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 "virtualMachine.h" /* The virtual machine proxy definition */ #include "sqPlatformSpecific.h" /* Platform specific definitions */ #define true 1 @@ -154,7 +154,7 @@ VMPluginCodeGenerator >> emitCHeaderOn: aStream [ # undef EXPORT # define EXPORT(returnType) static returnType #endif'; newLine; newLine. - self addHeaderFile: '"sqMemoryAccess.h"'. + self addHeaderFile: '"memoryAccess.h"'. "Additional header files; include squeak VM ones last" self emitHeaderFiles: (headerFiles reject: [:hdr| hdr includes: $<]) on: aStream. self maybePutPreambleFor: pluginClass on: aStream. @@ -223,7 +223,7 @@ VMPluginCodeGenerator >> generateCASTRemapOopIn: aTSendNode [ "Generate the C code for this message onto the given stream." | arm result | - "Avoid nesting #if SPURVM...#else...#endif within arms of an outer #if SPURVM...#else...#endif." + "Avoid nesting #if DEFINE...#else...#endif within arms of an outer #if DEFINE...#else...#endif." (Notification new tag: #inRemapOopInArm; signal) ifNotNil: [ :inRemapOopInArm | @@ -418,7 +418,6 @@ VMPluginCodeGenerator >> preDeclareMacrosForFastClassCheckingOn: aStream [ '# define isIntegerObject(oop) ((oop) & 1)' newLine - '# if SPURVM' 'extern sqInt classIndexOf(sqInt);' "Compact class indices are hardcoded here because there is no guarantee that the pool values at generation time are that of SPUR.. Make sure they are in sync with SpurMemoryManager class>>initializeCompactClassIndices" @@ -433,7 +432,6 @@ VMPluginCodeGenerator >> preDeclareMacrosForFastClassCheckingOn: aStream [ '# define isLargeIntegerObject(oop) (!isImmediate(oop) && (unsigned)(classIndexOf(oop) - LargeNegativeIntegerClassIndex) <= 1)' '# define isLargeNegativeIntegerObject(oop) (!isImmediate(oop) && classIndexOf(oop) == LargeNegativeIntegerClassIndex)' '# define isLargePositiveIntegerObject(oop) (!isImmediate(oop) && classIndexOf(oop) == LargePositiveIntegerClassIndex)' - '# endif /* SPURVM */' '#endif /* defined(SQUEAK_BUILTIN_PLUGIN) */' newLine "If the functionality has not been defined via macros, define default versions using existing plugin API" diff --git a/smalltalksrc/Slang/TPrintfFormatStringNode.class.st b/smalltalksrc/Slang/TPrintfFormatStringNode.class.st index cf4a9074d98..dbee40e461b 100644 --- a/smalltalksrc/Slang/TPrintfFormatStringNode.class.st +++ b/smalltalksrc/Slang/TPrintfFormatStringNode.class.st @@ -8,7 +8,7 @@ Class { { #category : 'C code generation' } TPrintfFormatStringNode >> emitCCodeOn: aStream level: level generator: aCodeGen [ - "Transform the printf string according to the LP64/LLP64 convention in sqMemoryAccess.h." + "Transform the printf string according to the LP64/LLP64 convention in memoryAccess.h." aStream nextPutAll: (aCodeGen cLiteralForPrintfString: value). comment ifNotNil: [aStream diff --git a/smalltalksrc/VMMaker/BitBltSimulation.class.st b/smalltalksrc/VMMaker/BitBltSimulation.class.st index be08c875b66..8395473d2a9 100644 --- a/smalltalksrc/VMMaker/BitBltSimulation.class.st +++ b/smalltalksrc/VMMaker/BitBltSimulation.class.st @@ -200,7 +200,7 @@ BitBltSimulation class >> declareCVarsIn: aCCodeGenerator [ "add option of fast path BitBLT code header" aCCodeGenerator - addHeaderFile:'"sqAssert.h"'; + addHeaderFile:'"assert.h"'; addHeaderFile:'#ifdef ENABLE_FAST_BLT #include "BitBltDispatch.h" #else diff --git a/smalltalksrc/VMMaker/CoInterpreter.class.st b/smalltalksrc/VMMaker/CoInterpreter.class.st index 05578253517..548dbe722d8 100644 --- a/smalltalksrc/VMMaker/CoInterpreter.class.st +++ b/smalltalksrc/VMMaker/CoInterpreter.class.st @@ -147,7 +147,7 @@ CoInterpreter class >> declareCVarsIn: aCCodeGenerator [ "Override to avoid repeating StackInterpreter's declarations and add our own extensions" self class == thisContext methodClass ifFalse: [^self]. "Don't duplicate decls in subclasses" aCCodeGenerator - addHeaderFile:'"sqCogStackAlignment.h"'; + addHeaderFile:'"cogStackAlignment.h"'; addHeaderFile:'"cogmethod.h"'. aCCodeGenerator addHeaderFile: '"cointerp.h"'; diff --git a/smalltalksrc/VMMaker/Cogit.class.st b/smalltalksrc/VMMaker/Cogit.class.st index 7f0e74b5fd3..bd49d7f6fcb 100644 --- a/smalltalksrc/VMMaker/Cogit.class.st +++ b/smalltalksrc/VMMaker/Cogit.class.st @@ -439,7 +439,7 @@ Cogit class >> declareCVarsIn: aCCodeGenerator [ addHeaderFile: ''; "for e.g. offsetof"addHeaderFile: '"jit/jit.h"'; addHeaderFile: '"debug.h"'; - addHeaderFile: '"sqCogStackAlignment.h"'; + addHeaderFile: '"cogStackAlignment.h"'; addHeaderFile: '"dispdbg.h"'; "must precede cointerp.h & cogit.h otherwise NoDbgRegParms gets screwed up" addHeaderFile: '"cogmethod.h"'. @@ -553,7 +553,7 @@ Cogit class >> defineAtCompileTime: anObject [ because the VM generated is specific to these varables." anObject isSymbol ifFalse: [^false]. - (#(STACKVM COGVM SPURVM) includes: anObject) ifTrue: + (#(STACKVM COGVM) includes: anObject) ifTrue: [^false]. ^VMBasicConstants namesDefinedAtCompileTime includes: anObject ] @@ -3205,7 +3205,7 @@ Cogit >> annotationIsForUncheckedEntryPoint: annotation [ { #category : 'simulation only' } Cogit >> assertCStackWellAligned [ "Check alignment of the C stack. This is a simulation only facsimilie. - See platforms/Cross/vm/sqCogStackAlignment.h for the real code." + See cogStackAlignment.h for the real code." self assert: processor sp \\ cStackAlignment = expectedSPAlignment. self assert: processor fp \\ cStackAlignment = expectedFPAlignment diff --git a/smalltalksrc/VMMaker/ComposedMetadataStruct.class.st b/smalltalksrc/VMMaker/ComposedMetadataStruct.class.st index 1a5f27a8a34..08468eea649 100644 --- a/smalltalksrc/VMMaker/ComposedMetadataStruct.class.st +++ b/smalltalksrc/VMMaker/ComposedMetadataStruct.class.st @@ -23,11 +23,11 @@ ComposedMetadataStruct class >> instVarNamesAndTypesForTranslationDo: aBinaryBlo "enumerate aBinaryBlock with the names and C type strings for the inst vars to include in a struct of this type." - + aBinaryBlock value: 'dataSize' value:'size_t'; - value: 'startAddress' value:'squeakFileOffsetType'. + value: 'startAddress' value:'fileOffset_t'. ] diff --git a/smalltalksrc/VMMaker/FilePlugin.class.st b/smalltalksrc/VMMaker/FilePlugin.class.st index 210cbc7712b..25e9c4016e6 100644 --- a/smalltalksrc/VMMaker/FilePlugin.class.st +++ b/smalltalksrc/VMMaker/FilePlugin.class.st @@ -153,7 +153,7 @@ FilePlugin >> makeDirEntryName: entryName size: entryNameSize createDate: createDate modDate: modifiedDate isDir: dirFlag fileSize: fileSize [ - + | modDateOop createDateOop nameString results stringPtr fileSizeOop | @@ -190,7 +190,7 @@ FilePlugin >> makeDirEntryName: entryName size: entryNameSize { #category : 'directory primitives' } FilePlugin >> makeDirEntryName: entryName size: entryNameSize createDate: createDate modDate: modifiedDate isDir: dirFlag fileSize: fileSize posixPermissions: posixPermissions isSymlink: symlinkFlag [ - + | modDateOop createDateOop nameString results stringPtr posixPermissionsOop fileSizeOop | @@ -354,7 +354,7 @@ FilePlugin >> primitiveDirectoryEntry [ - + requestedName := interpreterProxy stackValue: 0. @@ -442,7 +442,7 @@ FilePlugin >> primitiveDirectoryLookup [ - + | index pathName pathNameIndex pathNameSize status entryName entryNameSize createDate modifiedDate dirFlag symlinkFlag posixPermissions fileSize | index := interpreterProxy stackIntegerValue: 0. @@ -608,7 +608,7 @@ FilePlugin >> primitiveFileFlush [ FilePlugin >> primitiveFileGetPosition [ | file position | - + file := self fileValueOf: (interpreterProxy stackValue: 0). interpreterProxy failed ifFalse: [position := self sqFileGetPosition: file]. @@ -716,9 +716,9 @@ FilePlugin >> primitiveFileRename [ FilePlugin >> primitiveFileSetPosition [ | newPosition file | - + - (interpreterProxy byteSizeOf: (interpreterProxy stackValue: 0)) > (self sizeof: #squeakFileOffsetType) ifTrue: + (interpreterProxy byteSizeOf: (interpreterProxy stackValue: 0)) > (self sizeof: #fileOffset_t) ifTrue: [^interpreterProxy primitiveFail]. newPosition := interpreterProxy positive64BitValueOf: (interpreterProxy stackValue: 0). file := self fileValueOf: (interpreterProxy stackValue: 1). @@ -732,7 +732,7 @@ FilePlugin >> primitiveFileSetPosition [ FilePlugin >> primitiveFileSize [ | file size | - + file := self fileValueOf: (interpreterProxy stackValue: 0). interpreterProxy failed ifFalse:[size := self sqFileSize: file]. @@ -795,10 +795,10 @@ FilePlugin >> primitiveFileTruncate [ "ftruncate is not an ansi function so we have a macro to point to a suitable platform implementation" | truncatePosition file | - + (interpreterProxy isIntegerObject: (interpreterProxy stackValue: 0)) ifFalse: - [(interpreterProxy byteSizeOf: (interpreterProxy stackValue: 0)) > (self sizeof: #squeakFileOffsetType) ifTrue: + [(interpreterProxy byteSizeOf: (interpreterProxy stackValue: 0)) > (self sizeof: #fileOffset_t) ifTrue: [^interpreterProxy primitiveFail]]. truncatePosition := interpreterProxy positive64BitValueOf: (interpreterProxy stackValue: 0). file := self fileValueOf: (interpreterProxy stackValue: 1). diff --git a/smalltalksrc/VMMaker/FilePluginSimulator.class.st b/smalltalksrc/VMMaker/FilePluginSimulator.class.st index e64d7133f97..8c27da5d14e 100644 --- a/smalltalksrc/VMMaker/FilePluginSimulator.class.st +++ b/smalltalksrc/VMMaker/FilePluginSimulator.class.st @@ -29,7 +29,7 @@ FilePluginSimulator >> close [ "close any files that ST may have opened" FilePluginSimulator >> dir_EntryLookup: pathString _: pathStringLength _: entryNameString _: entryNameStringLength _: name _: nameLength _: creationDate _: modificationDate _: isDirectory _: sizeIfFile _: posixPermissions _: isSymlink [ "sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char *nameString, sqInt nameStringLength, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink)" + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink)" | result pathName entryName | pathName := ((0 to: pathStringLength - 1) collect: [:i| (pathString at: i) asCharacter]) as: ByteString. entryName := ((0 to: entryNameStringLength - 1) collect: [:i| (entryNameString at: i) asCharacter]) as: ByteString. @@ -54,7 +54,7 @@ FilePluginSimulator >> dir_EntryLookup: pathString _: pathStringLength _: entryN FilePluginSimulator >> dir_Lookup: pathString _: pathStringLength _: index _: name _: nameLength _: creationDate _: modificationDate _: isDirectory _: sizeIfFile _: posixPermissions _: isSymlink [ "sqInt dir_Lookup( char *pathString, sqInt pathStringLength, sqInt index, /* outputs: */ char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate, - sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt * posixPermissions, sqInt *isSymlink)" + sqInt *isDirectory, fileOffset_t *sizeIfFile, sqInt * posixPermissions, sqInt *isSymlink)" | result pathName | pathName := ((0 to: pathStringLength - 1) collect: [:i| (pathString at: i) asCharacter]) as: ByteString. result := self primLookupEntryIn: pathName index: index. diff --git a/smalltalksrc/VMMaker/InterpreterPlugin.class.st b/smalltalksrc/VMMaker/InterpreterPlugin.class.st index ace348970e6..04a95ee46fe 100644 --- a/smalltalksrc/VMMaker/InterpreterPlugin.class.st +++ b/smalltalksrc/VMMaker/InterpreterPlugin.class.st @@ -543,7 +543,7 @@ InterpreterPlugin >> sizeof: objectSymbolOrClass [ objectSymbolOrClass == #SQSocket ifTrue: [^8 + interpreterProxy wordSize]. "We assume the file offset type is always 64-bits." - objectSymbolOrClass == #squeakFileOffsetType ifTrue: + objectSymbolOrClass == #fileOffset_t ifTrue: [^8]. (objectSymbolOrClass last == $* or: [#long == objectSymbolOrClass diff --git a/smalltalksrc/VMMaker/InterpreterPrimitives.class.st b/smalltalksrc/VMMaker/InterpreterPrimitives.class.st index 2fb9a65b85a..4956589ea27 100644 --- a/smalltalksrc/VMMaker/InterpreterPrimitives.class.st +++ b/smalltalksrc/VMMaker/InterpreterPrimitives.class.st @@ -109,7 +109,7 @@ InterpreterPrimitives class >> defineAtCompileTime: anObject [ because the VM generated is specific to these varables." anObject isSymbol ifFalse: [^false]. - (#(STACKVM COGVM SPURVM) includes: anObject) ifTrue: + (#(STACKVM COGVM) includes: anObject) ifTrue: [^false]. ^VMBasicConstants namesDefinedAtCompileTime includes: anObject ] @@ -481,14 +481,9 @@ InterpreterPrimitives >> magnitude64BitValueOf: oop [ [self primitiveFail. ^0]. - "self cppIf: SPURVM - ifTrue: - [""Memory is 8 byte aligned in Spur and oversized bytes are set to zero, so we can safely fetch 8 bytes"" - value := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: - ["sz > 4 - ifTrue: [value := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: [value := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']"]". + sz > 4 + ifTrue: [value := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] + ifFalse: [value := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']. ^value ] @@ -629,14 +624,9 @@ InterpreterPrimitives >> positive64BitValueOf: oop [ [self primitiveFail. ^0]. - "self cppIf: SPURVM - ifTrue: - [""Memory is 8 byte aligned in Spur and oversized bytes are set to zero, so we can safely fetch 8 bytes"" - value := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: - ["sz > 4 - ifTrue: [value := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: [value := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']"]". + sz > 4 + ifTrue: [value := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] + ifFalse: [value := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']. ^value ] @@ -668,15 +658,9 @@ InterpreterPrimitives >> positiveMachineIntegerValueOf: oop [ [self primitiveFail. ^0]. - "self cppIf: SPURVM - ifTrue: [""Memory is 8 byte aligned in Spur and oversized bytes are set to zero, so we can safely fetch 8 bytes"" - ^objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: ["((self sizeof: #'usqIntptr_t') = 8 - and: [bs > 4]) - ifTrue: - [^objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: - [^self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']"]" + ((self sizeof: #'usqIntptr_t') = 8 and: [bs > 4]) + ifTrue: [^objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] + ifFalse: [^self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int'] ] { #category : 'arithmetic integer primitives' } @@ -3712,13 +3696,6 @@ InterpreterPrimitives >> primitiveSquareRoot [ ifFalse: [self primitiveFail] ] -{ #category : 'process primitives' } -InterpreterPrimitives >> primitiveStartVMProfiling [ - "Primitive. Start the VM profiler." - self cCode: 'ioControlProfile(1,0,0,0,0)'. - self pop: argumentCount -] - { #category : 'indexing primitives' } InterpreterPrimitives >> primitiveStringAt [ @@ -4310,14 +4287,9 @@ InterpreterPrimitives >> signed64BitValueOf: oop [ [self primitiveFail. ^0]. - "self cppIf: SPURVM - ifTrue: - [""Memory is 8 byte aligned in Spur and oversized bytes are set to zero, so we can safely fetch 8 bytes"" - magnitude := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: - ["sz > 4 - ifTrue: [magnitude := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: [magnitude := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']"]". + sz > 4 + ifTrue: [magnitude := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] + ifFalse: [magnitude := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']. (negative ifTrue: [magnitude > 16r8000000000000000] @@ -4360,17 +4332,9 @@ InterpreterPrimitives >> signedMachineIntegerValueOf: oop [ bs > (self sizeof: #'usqIntptr_t') ifTrue: [^self primitiveFail]. - "self cppIf: SPURVM - ifTrue: - [""Memory is 8 byte aligned in Spur and oversized bytes are set to zero, so we can safely fetch 8 bytes"" - magnitude := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: - ["((self sizeof: #'sqIntptr_t') = 8 - and: [bs > 4]) - ifTrue: - [magnitude := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] - ifFalse: - [magnitude := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']"]". + ((self sizeof: #'sqIntptr_t') = 8 and: [bs > 4]) + ifTrue: [magnitude := objectMemory byteSwapped64IfBigEndian: (objectMemory fetchLong64: 0 ofObject: oop)] + ifFalse: [magnitude := self cCoerceSimple: (objectMemory byteSwapped32IfBigEndian: (objectMemory fetchLong32: 0 ofObject: oop)) to: #'unsigned int']. limit := 1 asUnsignedIntegerPtr << ((self sizeof: #'sqIntptr_t') * 8 - 1). (negative diff --git a/smalltalksrc/VMMaker/SpurImageHeaderStruct.class.st b/smalltalksrc/VMMaker/SpurImageHeaderStruct.class.st index 35c648e5212..bfb1e9439db 100644 --- a/smalltalksrc/VMMaker/SpurImageHeaderStruct.class.st +++ b/smalltalksrc/VMMaker/SpurImageHeaderStruct.class.st @@ -39,7 +39,7 @@ SpurImageHeaderStruct class >> instVarNamesAndTypesForTranslationDo: aBinaryBloc - + self filteredInstVarNames do: [:ivn| @@ -48,7 +48,7 @@ SpurImageHeaderStruct class >> instVarNamesAndTypesForTranslationDo: aBinaryBloc value: (ivn caseOf: { ['dataSize'] -> [#'size_t']. ['desiredHeapSize'] -> [#'size_t']. - ['headerStart'] -> [#'squeakFileOffsetType']. + ['headerStart'] -> [#'fileOffset_t']. } otherwise: [ #'sqInt' ])] ] diff --git a/smalltalksrc/VMMaker/SpurImageReader.class.st b/smalltalksrc/VMMaker/SpurImageReader.class.st index 286437cb2fd..782344f4e9d 100644 --- a/smalltalksrc/VMMaker/SpurImageReader.class.st +++ b/smalltalksrc/VMMaker/SpurImageReader.class.st @@ -68,7 +68,7 @@ SpurImageReader >> getWord32FromFile: aFile swap: swapFlag [ SpurImageReader >> readHeaderFrom: f startingAt: headerStart [ - + @@ -148,7 +148,7 @@ SpurImageReader >> readImageFromFile: f StartingAt: headerStart [ Smalltalk by invoking the image name as a command." - + diff --git a/smalltalksrc/VMMaker/SpurImageWriter.class.st b/smalltalksrc/VMMaker/SpurImageWriter.class.st index 1115db7ce21..2fb714ab1f0 100644 --- a/smalltalksrc/VMMaker/SpurImageWriter.class.st +++ b/smalltalksrc/VMMaker/SpurImageWriter.class.st @@ -124,7 +124,7 @@ SpurImageWriter >> writeImageFile: imageFileName fromHeader: header [ - + diff --git a/smalltalksrc/VMMaker/StackInterpreter.class.st b/smalltalksrc/VMMaker/StackInterpreter.class.st index 1d25da78b02..4dba3abbbc7 100644 --- a/smalltalksrc/VMMaker/StackInterpreter.class.st +++ b/smalltalksrc/VMMaker/StackInterpreter.class.st @@ -211,9 +211,6 @@ nativeSP nativeStackPointer - Lowcode, the native (C) stack pointer (?; then why nativeSP?) -nextPollUsecs - - if non-zero, the micosecond clock value at which to next poll for events, used to control event polling rate - nextWakeupUsecs - if non-zero, the micosecond clock value at which the next delay expires @@ -335,7 +332,6 @@ Class { 'highestRunnableProcessPriority', 'reenterInterpreter', 'nextWakeupUsecs', - 'nextPollUsecs', 'interruptPending', 'imageHeaderFlags', 'extraVMMemory', @@ -502,7 +498,7 @@ StackInterpreter class >> declareCVarsIn: aCCodeGenerator [ addHeaderFile: '"sigjmp_support.h"'; addHeaderFile: ' /* for wint_t */'; addHeaderFile: '"vmCallback.h"'; - addHeaderFile: '"sqMemoryFence.h"'; + addHeaderFile: '"memoryFence.h"'; addHeaderFile: '"dispdbg.h"'; addHeaderFile: '"vmMemoryMap.h"'; addHeaderFile: '"vmRememberedSet.h"'; @@ -590,7 +586,7 @@ If ffi is put as a separate header, slang will sort the header and put it outsid self declareCAsUSqLong: - #( nextPollUsecs nextWakeupUsecs longRunningPrimitiveGCUsecs + #( nextWakeupUsecs longRunningPrimitiveGCUsecs longRunningPrimitiveStartUsecs longRunningPrimitiveStopUsecs "these are high-frequency enough that they're overflowing quite quickly on modern hardware" statProcessSwitch statForceInterruptCheck @@ -1542,11 +1538,7 @@ warningat(char *s, int l) { /* ditto with line number. */ void invalidCompactClassError(char *s) { /* Print a (compact) class index error message and exit. */ -#if SPURVM vm_printf("\nClass %s does not have the required class index\n", s); -#else - vm_printf("\nClass %s does not have the required compact class index\n", s); -#endif exit(-1); } @@ -1749,9 +1741,6 @@ StackInterpreter class >> writeVMHeaderTo: aStream bytesPerWord: bytesPerWord ge (SistaVM or: [ IMMUTABILITY ]) ifTrue: [aStream cr]. aCCodeGenerator putDefineOf: #STACKVM as: 1 on: aStream. - (InitializationOptions at: #SpurObjectMemory ifAbsent: false) ifTrue: - [aCCodeGenerator putDefineOf: #SPURVM as: 1 on: aStream]. - ] { #category : 'simulation' } @@ -3889,17 +3878,8 @@ StackInterpreter >> checkForEventsMayContextSwitch: mayContextSwitch [ (sema ~= objectMemory nilObject and: [self synchronousSignal: sema]) ifTrue: [switched := true]]. - - "inIOProcessEvents prevents reentrancy into ioProcessEvents and allows disabling - ioProcessEvents e.g. for native GUIs. We would like to manage that here but can't - since the platform code may choose to call ioProcessEvents itself in various places." - (now := self ioUTCMicroseconds) >= nextPollUsecs ifTrue: [ - self ioProcessEvents. "sets interruptPending if interrupt key pressed; may callback" - "msecs to wait before next call to ioProcessEvents." - nextPollUsecs := now + 20000 - "Note that strictly speaking we might need to update 'now' at this point since - ioProcessEvents could take a very long time on some platforms" ]. + now := self ioUTCMicroseconds. nextWakeupUsecs ~= 0 ifTrue: [now >= nextWakeupUsecs ifTrue: @@ -7531,7 +7511,6 @@ StackInterpreter >> initialize [ stackPage := overflowedPage := 0. extraFramesToMoveOnOverflow := 0. highestRunnableProcessPriority := 0. - nextPollUsecs := 0. nextWakeupUsecs := 0. tempOop := tempOop2 := theUnknownShort := 0. maxStacksToPrint := 0. diff --git a/smalltalksrc/VMMaker/StackInterpreterSimulator.class.st b/smalltalksrc/VMMaker/StackInterpreterSimulator.class.st index 6cf3d691df9..3009755c26a 100644 --- a/smalltalksrc/VMMaker/StackInterpreterSimulator.class.st +++ b/smalltalksrc/VMMaker/StackInterpreterSimulator.class.st @@ -5,9 +5,6 @@ To see the thing actually run, you could (after backing up this image and change (StackInterpreterSimulator new openOn: Smalltalk imageName) test - ((StackInterpreterSimulator newWithOptions: #(NewspeakVM true MULTIPLEBYTECODESETS true)) - openOn: 'ns101.image') test - and be patient both to wait for things to happen, and to accept various things that may go wrong depending on how large or unusual your image may be. We usually do this with a small and simple benchmark image. Here's an example of what Eliot uses to launch the simulator in a window. The bottom-right window has a menu packed with useful stuff: diff --git a/smalltalksrc/VMMaker/VMCallbackContext.class.st b/smalltalksrc/VMMaker/VMCallbackContext.class.st index c180d66b8a3..31b6036c39f 100644 --- a/smalltalksrc/VMMaker/VMCallbackContext.class.st +++ b/smalltalksrc/VMMaker/VMCallbackContext.class.st @@ -46,7 +46,7 @@ VMCallbackContext class >> instVarNamesAndTypesForTranslationDo: aBinaryBlock [ { #category : 'translation' } VMCallbackContext class >> needsTypeTag [ - "This allows sqVirtualMachine.h to declare VMCallbackContext as an + "This allows virtualMachine.h to declare VMCallbackContext as an opaque type avoiding everyone including setjmp.h & vmCallback.h" ^true ] diff --git a/src/common/heartbeat.c b/src/common/heartbeat.c index 64846bbbc11..f4a667d6d09 100644 --- a/src/common/heartbeat.c +++ b/src/common/heartbeat.c @@ -17,8 +17,8 @@ #include "sq.h" -#include "sqAssert.h" -#include "sqMemoryFence.h" +#include "assert.h" +#include "memoryFence.h" //#include "sqSCCSVersion.h" #include @@ -31,7 +31,7 @@ #include -#include "sqaio.h" +#include "aio.h" #include "pharovm/debug.h" @@ -148,7 +148,7 @@ currentUTCMicroseconds() * implemented without locks using atomic 64-bit reads and writes. */ -#include "sqAtomicOps.h" +#include "atomic.h" static void updateMicrosecondClock() diff --git a/src/common/sqExternalSemaphores.c b/src/common/sqExternalSemaphores.c index f8dcdca5aa3..2fd322c663f 100644 --- a/src/common/sqExternalSemaphores.c +++ b/src/common/sqExternalSemaphores.c @@ -30,9 +30,9 @@ */ #include "sq.h" -#include "sqAssert.h" -#include "sqAtomicOps.h" -#include "sqMemoryFence.h" +#include "assert.h" +#include "atomic.h" +#include "memoryFence.h" #include "pharovm/semaphores/platformSemaphore.h" #include "pharovm/interpreter.h" diff --git a/src/common/sqNamedPrims.c b/src/common/sqNamedPrims.c index 60d1a8db2dc..ecb6f23f063 100644 --- a/src/common/sqNamedPrims.c +++ b/src/common/sqNamedPrims.c @@ -31,7 +31,7 @@ typedef struct ModuleEntry { } ModuleEntry; -static ModuleEntry *squeakModule = NULL; +static ModuleEntry *intrinsicsModule = NULL; static ModuleEntry *firstModule = NULL; struct VirtualMachine *sqGetInterpreterProxy(void); @@ -39,7 +39,7 @@ static void * findLoadedModule(char *pluginName) { ModuleEntry *module; - if(!pluginName || !pluginName[0]) return squeakModule; + if(!pluginName || !pluginName[0]) return intrinsicsModule; module = firstModule; while(module) { if(strcmp(module->name, pluginName) == 0) return module; @@ -157,7 +157,7 @@ static void * findFunctionAndAccessorDepthIn(char *functionName, ModuleEntry *module, sqInt fnameLength, sqInt *accessorDepthPtr) { - return module->handle == squeakModule->handle + return module->handle == intrinsicsModule->handle ? findInternalFunctionIn(functionName, module->name, fnameLength, accessorDepthPtr) : findExternalFunctionIn(functionName, module, @@ -167,7 +167,7 @@ findFunctionAndAccessorDepthIn(char *functionName, ModuleEntry *module, static void * findFunctionIn(char *functionName, ModuleEntry *module) { - return module->handle == squeakModule->handle + return module->handle == intrinsicsModule->handle ? findInternalFunctionIn(functionName, module->name, 0, 0) : findExternalFunctionIn(functionName, module, 0, 0); } @@ -268,14 +268,14 @@ findAndLoadModule(char *pluginName, sqInt ffiLoad) if(!handle) { /* might be internal, so go looking for setInterpreter() */ if(findInternalFunctionIn("setInterpreter", pluginName, 0, 0)) - handle = squeakModule->handle; + handle = intrinsicsModule->handle; else return NULL; /* PluginName_setInterpreter() not found */ } module = addToModuleList(pluginName, handle, ffiLoad); if(!callInitializersIn(module)) { /* Initializers failed */ - if(handle != squeakModule->handle) { + if(handle != intrinsicsModule->handle) { /* physically unload module */ ioFreeModule(handle); } @@ -295,9 +295,9 @@ findOrLoadModule(char *pluginName, sqInt ffiLoad) { ModuleEntry *module; - if(!squeakModule) { + if(!intrinsicsModule) { /* Load intrinsics (if possible) */ - squeakModule = addToModuleList("", NULL, 1); + intrinsicsModule = addToModuleList("", NULL, 1); firstModule = NULL; /* drop off module list - will never be unloaded */ } @@ -488,7 +488,7 @@ ioUnloadModule(char *moduleName) { ModuleEntry *entry, *temp; - if(!squeakModule) return 0; /* Nothing has been loaded */ + if(!intrinsicsModule) return 0; /* Nothing has been loaded */ if(!moduleName || !moduleName[0]) return 0; /* nope */ entry = findLoadedModule(moduleName); @@ -513,7 +513,7 @@ ioUnloadModule(char *moduleName) temp = temp->next; } /* And actually unload it if it isn't just the VM... */ - if(entry->handle != squeakModule->handle) + if(entry->handle != intrinsicsModule->handle) ioFreeModule(entry->handle); removeFromList(entry); free(entry); /* give back space */ diff --git a/src/common/sqTicker.c b/src/common/sqTicker.c index 1b99932c7d9..c7a021316a7 100644 --- a/src/common/sqTicker.c +++ b/src/common/sqTicker.c @@ -52,9 +52,9 @@ */ #include "sq.h" -#include "sqAssert.h" -#include "sqAtomicOps.h" -#include "sqMemoryFence.h" +#include "assert.h" +#include "atomic.h" +#include "memoryFence.h" #define NUM_ASYNCHRONOUS_TICKEES 4 diff --git a/src/common/sqVirtualMachine.c b/src/common/sqVirtualMachine.c index 39262d561c0..ad5f88f56bf 100644 --- a/src/common/sqVirtualMachine.c +++ b/src/common/sqVirtualMachine.c @@ -241,7 +241,6 @@ extern sqInt isYoung(sqInt); void addHighPriorityTickee(void (*ticker)(void), unsigned periodms); void addSynchronousTickee(void (*ticker)(void), unsigned periodms, unsigned roundms); -#if SPURVM /* For now these are here; perhaps they're better in the VM. */ static sqInt interceptFetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer) { @@ -251,7 +250,6 @@ interceptFetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer) return fetchIntegerofObject(fieldIndex, objectPointer); } -#endif sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer); struct VirtualMachine* sqGetInterpreterProxy(void) @@ -281,11 +279,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void) VM->fetchArrayofObject = fetchArrayofObject; VM->fetchClassOf = fetchClassOf; VM->fetchFloatofObject = fetchFloatofObject; -#if SPURVM VM->fetchIntegerofObject = interceptFetchIntegerofObject; -#else - VM->fetchIntegerofObject = fetchIntegerofObject; -#endif VM->fetchPointerofObject = fetchPointerofObject; VM->obsoleteDontUseThisFetchWordofObject = obsoleteDontUseThisFetchWordofObject; VM->firstFixedField = firstFixedField; diff --git a/src/debug.c b/src/debug.c index be1afeaf6ab..a5e2da67f2d 100644 --- a/src/debug.c +++ b/src/debug.c @@ -137,7 +137,7 @@ void getCrashDumpFilenameInto(char *buf) #endif } -char *getVersionInfo(int verbose) +char *getVersionInfo() { #if STACKVM extern char *__interpBuildInfo; @@ -155,27 +155,12 @@ char *getVersionInfo(int verbose) char *info= (char *)malloc(BUFFER_SIZE); info[0]= '\0'; -#if SPURVM -# if BytesPerOop == 8 -# define ObjectMemory " Spur 64-bit" -# else -# define ObjectMemory " Spur" -# endif -#else -# define ObjectMemory -#endif #if defined(NDEBUG) -# define BuildVariant "Production" ObjectMemory +# define BuildVariant "Production" #elif DEBUGVM -# define BuildVariant "Debug" ObjectMemory +# define BuildVariant "Debug" # else -# define BuildVariant "Assert" ObjectMemory -#endif - -#if USE_XSHM -#define USE_XSHM_STRING " XShm" -#else -#define USE_XSHM_STRING "" +# define BuildVariant "Assert" #endif #if ITIMER_HEARTBEAT @@ -184,12 +169,7 @@ char *getVersionInfo(int verbose) # define HBID #endif - if(verbose){ - snprintf(info, BUFFER_SIZE, IMAGE_DIALECT_NAME "VM version:" VM_VERSION "-" VM_BUILD_STRING USE_XSHM_STRING " " COMPILER_VERSION " [" BuildVariant HBID " VM]\nBuilt from: %s\n With:%s\n Revision: " VM_BUILD_SOURCE_STRING, INTERP_BUILD, GetAttributeString(1008)); - }else{ - snprintf(info, BUFFER_SIZE, VM_VERSION "-" VM_BUILD_STRING USE_XSHM_STRING " " COMPILER_VERSION " [" BuildVariant HBID " VM]\n%s\n%s\n" VM_BUILD_SOURCE_STRING, INTERP_BUILD, GetAttributeString(1008)); - } - + snprintf(info, BUFFER_SIZE, VM_BUILD_STRING " " COMPILER_VERSION " [" BuildVariant HBID " VM]\nBuilt from: %s\n With:%s\n Revision: " VM_BUILD_SOURCE_STRING, INTERP_BUILD, GetAttributeString(1008)); return info; } diff --git a/src/osx/aioOSX.c b/src/osx/aioOSX.c index 374466be2cd..ac5a1b7d4e6 100644 --- a/src/osx/aioOSX.c +++ b/src/osx/aioOSX.c @@ -10,9 +10,9 @@ #include "pharovm/debug.h" #include "pharovm/semaphores/platformSemaphore.h" -#include "sqaio.h" -#include "sqMemoryFence.h" -#include "sqaio.h" +#include "aio.h" +#include "memoryFence.h" +#include "aio.h" #include #include diff --git a/src/unix/aio.c b/src/unix/aio.c index f38989b1ecd..0f88c09fec2 100644 --- a/src/unix/aio.c +++ b/src/unix/aio.c @@ -35,8 +35,8 @@ #include "pharovm/debug.h" #include "pharovm/semaphores/platformSemaphore.h" -#include "sqMemoryFence.h" -#include "sqaio.h" +#include "memoryFence.h" +#include "aio.h" #include #include diff --git a/src/unix/debugUnix.c b/src/unix/debugUnix.c index 87b64d7ebae..235bd5b219f 100644 --- a/src/unix/debugUnix.c +++ b/src/unix/debugUnix.c @@ -42,7 +42,7 @@ void printCallStack(); char* GetAttributeString(int idx); void reportStackState(const char *msg, char *date, int printAll, ucontext_t *uap, FILE* output); -char * getVersionInfo(int verbose); +char * getVersionInfo(); void getCrashDumpFilenameInto(char *buf); void dumpPrimTraceLog(); @@ -430,7 +430,7 @@ void reportStackState(const char *msg, char *date, int printAll, ucontext_t *uap #endif fprintf_impl(output,"\n%s%s%s\n\n", msg, date ? " " : "", date ? date : ""); - fprintf_impl(output,"%s\n%s\n\n", GetAttributeString(0), getVersionInfo(1)); + fprintf_impl(output,"%s\n%s\n\n", GetAttributeString(0), getVersionInfo()); #if COGVM /* Do not attempt to report the stack until the VM is initialized!! */ diff --git a/src/utils.c b/src/utils.c index 2266b251ed0..e701af28c19 100644 --- a/src/utils.c +++ b/src/utils.c @@ -21,7 +21,6 @@ #include -char vmName[PATH_MAX]; char _imageName[PATH_MAX]; char vmFullPath[PATH_MAX]; char vmPath[PATH_MAX]; @@ -30,10 +29,6 @@ char vmPath[PATH_MAX]; void fillApplicationDirectory(char* vmPath); #endif -#ifdef _WIN32 -BOOL fIsConsole = 1; -#endif - int isVMRunOnWorkerThread(void); void *os_exports[][3]= @@ -167,30 +162,6 @@ sqInt getAttributeIntoLength(sqInt id, sqInt byteArrayIndex, sqInt length) return 0; } -/** - * Returns the VM Name - */ -EXPORT(char*) getVMName(){ - return vmName; -} - -/** - * Sets the VMName. - * It copies the parameter to internal storage. - */ -void setVMName(const char* name){ -#ifdef _WIN32 - /* - * Unsafe version of deprecated strcpy for compatibility - * - does not check error code - * - does use count as the size of the destination buffer - */ - strcpy_s(vmName, strlen(name), name); -#else - strcpy(vmName, name); -#endif -} - char* getImageName(){ return _imageName; } @@ -262,7 +233,7 @@ sqInt vmPathGetLength(sqInt sqVMPathIndex, sqInt length){ count = strlen(vmPath); count = (length < count) ? length : count; - /* copy the file name into the Squeak string */ + /* copy the file name into the string object */ memcpy(stVMPath, vmPath, count); return count; @@ -275,7 +246,7 @@ sqInt imageNameGetLength(sqInt sqImageNameIndex, sqInt length){ count= strlen(_imageName); count= (length < count) ? length : count; - /* copy the file name into the Squeak string */ + /* copy the file name into the string object */ memcpy(sqImageName, _imageName, count); return count; @@ -450,7 +421,6 @@ sqGetFilenameFromString(char * aCharBuffer, char * aFilenameString, sqInt filena #ifndef bzero - //We have to provide a bzero implementation for windows as the Cog code depends on it. void bzero(void *s, size_t n){ memset(s, 0, n); @@ -511,57 +481,6 @@ osCogStackPageHeadroom() /* Helper to pop up a message box with a message formatted from the */ /* printf() format string and arguments */ /****************************************************************************/ -#ifdef _WIN32 -EXPORT(int) __cdecl sqMessageBox(DWORD dwFlags, const char *titleString, const char* fmt, ...) -{ TCHAR *buf; - va_list args; - DWORD result; - - buf = (TCHAR*) calloc(sizeof(TCHAR), 4096); - va_start(args, fmt); - vsnprintf(buf, 4096-1, fmt, args); - va_end(args); - - result = MessageBox(NULL,buf,titleString,dwFlags|MB_SETFOREGROUND); - free(buf); - return result; -} - -EXPORT(void) printLastError(const TCHAR *prefix) { - LPVOID lpMsgBuf; - DWORD lastError; - - lastError = GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, 0, NULL ); - wprintf(TEXT("%s (%ld) -- %s\n"), prefix, lastError, (unsigned short*)lpMsgBuf); - LocalFree( lpMsgBuf ); -} - -EXPORT(int) __cdecl abortMessage(TCHAR *fmt, ...) -{ TCHAR *buf; - va_list args; - - va_start(args, fmt); - if (fIsConsole) { - vfwprintf(stderr, fmt, args); - exit(-1); - } - buf = (TCHAR*) calloc(sizeof(TCHAR), 4096); - - wvsprintf(buf, fmt, args); - - va_end(args); - - MessageBox(NULL,buf,TEXT(VM_NAME) TEXT("!"),MB_OK | MB_TASKMODAL | MB_SETFOREGROUND); - free(buf); - exit(-1); - return 0; -} - -#endif - EXPORT(char*) getFullPath(char const *relativePath, char* fullPath, int fullPathSize){ #ifdef _WIN32 @@ -651,6 +570,7 @@ EXPORT(const char**) getProcessArgumentVector(){ EXPORT(const char **) getProcessEnvironmentVector(){ return vmProcessEnvironmentVector; } + EXPORT(int) ioGetCurrentWorkingDirectorymaxLength(char * aCString, size_t maxLength){ return vm_path_get_current_working_dir_into(aCString, maxLength) == VM_SUCCESS ? 0 : -1 ; -} +} \ No newline at end of file diff --git a/src/win/aioWin.c b/src/win/aioWin.c index f9c795cbb62..e81b233dea2 100644 --- a/src/win/aioWin.c +++ b/src/win/aioWin.c @@ -1,6 +1,6 @@ #include "winsock2.h" #include "pharovm/pharo.h" -#include "sqaio.h" +#include "aio.h" #include "windows.h" diff --git a/src/win/sqWin32SpurAlloc.c b/src/win/sqWin32SpurAlloc.c index 32d1400e64b..3433c8f4659 100644 --- a/src/win/sqWin32SpurAlloc.c +++ b/src/win/sqWin32SpurAlloc.c @@ -127,12 +127,14 @@ address_space_used(char *address, usqInt bytes) MEMORY_BASIC_INFORMATION info; int addressSpaceUnused; - if (address < minAppAddr || address > maxAppAddr) + if (address < minAppAddr || address > maxAppAddr){ return 1; - if (!VirtualQuery(address, &info, sizeof(info))) - sqMessageBox(MB_OK | MB_ICONSTOP, TEXT("VM Error:"), - TEXT("Unable to VirtualQuery range [%p, %p), Error: %u"), - address, (char *)address + bytes, GetLastError()); + } + if (!VirtualQuery(address, &info, sizeof(info))){ + logError("Unable to VirtualQuery range [%p, %p)", address, (char *)address + bytes); + logErrorFromGetLastError("Unable to VirtualQuery range"); + exit(1); + } addressSpaceUnused = info.BaseAddress == address && info.RegionSize >= bytes @@ -151,11 +153,7 @@ sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto(sqInt size, void *minAddress bytes = roundUpToPage(size); delta = max(pageSize,1024*1024); -# define printProbes 0 -# define printMaps 0 while ((usqIntptr_t)(address + bytes) > (usqIntptr_t)address) { - if (printProbes) - logTrace("probing [%p,%p)\n", address, address + bytes); if (address_space_used(address, bytes)) { address += delta; continue; @@ -167,14 +165,11 @@ sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto(sqInt size, void *minAddress * So accept allocs above minAddress rather than allocs above address */ if (alloc >= (char *)minAddress && alloc <= address + delta) { - if (printMaps) - logWarn("VirtualAlloc [%p,%p) above %p)\n", - address, address+bytes, minAddress); *allocatedSizePointer = bytes; return alloc; } if (!alloc) { - logWarn("Unable to VirtualAlloc committed memory at desired address (%lld bytes requested at %p, above %p)", bytes, address, minAddress); + logError("Unable to VirtualAlloc committed memory at desired address (%lld bytes requested at %p, above %p)", bytes, address, minAddress); logErrorFromGetLastError("Unable to VirtualAlloc committed memory at desired address"); return 0; } @@ -198,10 +193,11 @@ sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto(sqInt size, void *minAddress void sqDeallocateMemorySegmentAtOfSize(void *addr, sqInt sz) { - if (!VirtualFree(addr, SizeForRelease(sz), MEM_RELEASE)) - sqMessageBox(MB_OK | MB_ICONSTOP, TEXT("VM Warning:"), - TEXT("Unable to VirtualFree committed memory (%") TEXT(PRIuSQINT) TEXT(" bytes requested), Error: %ul"), - sz, GetLastError()); + if (!VirtualFree(addr, SizeForRelease(sz), MEM_RELEASE)){ + logError("Unable to VirtualFree committed memory (%"PRIuSQINT" bytes requested)", sz); + logErrorFromGetLastError("Unable to VirtualFree committed memory"); + exit(1); + } } # if COGVM diff --git a/src/win/winDebug.c b/src/win/winDebug.c index 866ca67082e..9fad72c3599 100644 --- a/src/win/winDebug.c +++ b/src/win/winDebug.c @@ -13,7 +13,7 @@ void printAllStacks(); void printCallStack(); char* GetAttributeString(int idx); -char * getVersionInfo(int verbose); +char * getVersionInfo(); void getCrashDumpFilenameInto(char *buf); EXPORT(void) printCrashDebugInformation(LPEXCEPTION_POINTERS exp); @@ -95,7 +95,7 @@ isExceptionAReasonForCrashing(LPEXCEPTION_POINTERS exp) { return 0; switch(exp->ExceptionRecord->ExceptionCode){ - case EXCEPTION_ACCESS_VIOLATION: + case STATUS_ACCESS_VIOLATION: case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: case EXCEPTION_BREAKPOINT: case EXCEPTION_DATATYPE_MISALIGNMENT: @@ -172,7 +172,7 @@ EXPORT(void) printCrashDebugInformation(LPEXCEPTION_POINTERS exp){ char* getExceptionMessage(LPEXCEPTION_POINTERS exp){ switch(exp->ExceptionRecord->ExceptionCode){ - case EXCEPTION_ACCESS_VIOLATION: return (char*)"EXCEPTION_ACCESS_VIOLATION"; + case STATUS_ACCESS_VIOLATION: return (char*)"STATUS_ACCESS_VIOLATION"; case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: return (char*)"EXCEPTION_ARRAY_BOUNDS_EXCEEDED"; case EXCEPTION_BREAKPOINT: return (char*)"EXCEPTION_BREAKPOINT"; case EXCEPTION_DATATYPE_MISALIGNMENT: return (char*)"EXCEPTION_DATATYPE_MISALIGNMENT"; @@ -201,7 +201,7 @@ extern void dumpPrimTraceLog(void); void reportStackState(LPEXCEPTION_POINTERS exp, char* date, FILE* output){ fprintf_impl(output,"\n%s(%ld) at 0x%016llx - %s\n\n", getExceptionMessage(exp), exp->ExceptionRecord->ExceptionCode, (unsigned long long)exp->ExceptionRecord->ExceptionAddress, date); - fprintf_impl(output,"%s\n%s\n\n", GetAttributeString(0), getVersionInfo(1)); + fprintf_impl(output,"%s\n%s\n\n", GetAttributeString(0), getVersionInfo()); fprintf_impl(output,"C stack backtrace & registers:\n"); @@ -237,7 +237,7 @@ void captureStack(PCONTEXT context, STACKFRAME64* frames, int framePointersSize, STACKFRAME64 frame; - ZeroMemory(&frame, sizeof(frame)); + memset(&frame, 0, sizeof(frame)) frame.AddrPC.Mode = AddrModeFlat; frame.AddrFrame.Mode = AddrModeFlat; frame.AddrStack.Mode = AddrModeFlat; @@ -328,7 +328,7 @@ void printSymbolInfo(STACKFRAME64 *frame, FILE* output){ EXPORT(void) printMachineCallStack(PCONTEXT ctx, FILE* output){ STACKFRAME64 frames[NUMBER_OF_STACKS]; - ZeroMemory(frames, sizeof(STACKFRAME64) * NUMBER_OF_STACKS); + memset(frames, 0, sizeof(STACKFRAME64) * NUMBER_OF_STACKS) captureStack(ctx, frames, NUMBER_OF_STACKS, 6);