[VM] [WIN32] Notes on file handling
Ross Boylan
RossBoylan at stanfordalumni.org
Tue Feb 19 21:45:25 UTC 2002
Here are some things I've noticed while poking around building the Win32
VM. It seems several different models for file handling are competing; I
think it would be good to reduce their number.
The gcc and MSVC builds do different things with files. GCC says
-DWIN32_FILE_SUPPORT -DNO_STD_FILE_SUPPORT
while the MS .dsp file says
/D "WIN32_FILE_SUPPORT"
only. Both also define the WIN32 macro.
As a result, the cross-platform sqFilePluginBasicPrims.c, which says it is
ignored for WIN32, is actually used by MS builds (apparently--I haven't got
anything to build yet!). I note that file has a bunch of calls to things
with Mac in the name, and I wonder if it's really OK to use cross-platform.
These basic file operations use the standard fseek and ftell. For MS,
these are 32 bit. However, I believe the following code in
win32/vm/sqPlatformSpecific.h will convert to 64 bit:
#if defined(_MSC_VER)
#include <io.h>
#define squeakFileOffsetType __int64
#define ftell(stream) _telli64(_fileno(stream))
#define fseek(stream, offset, origin) \
_lseeki64(_fileno(stream), offset, origin)
#else
#define squeakFileOffsetType int
#endif
However, there is also a file win32/plugins/FilePlugin/sqWin32FilePrims.c
that defines the basic file operations using Win32 calls like
SetFilePointer. These calls can potentially do 64 bit access, although
they do so in an awkward way (you pass in the low and high bits separately)
and the upper bits are not currently used. Further, some Win32 systems
(e.g. Win95) do not support 64 bit addressing. I see no note of OS limits
on _telli64 and friends, but they may have the same problem.
That same file also defines special handling for image file operations.
As I said, one thought I had is, at least for MSVC, to go with the more
vanilla implementations used by other OS's.
I do not know what the performance implications are of 64 bit vs 32 bit
file access, nor of using the Win32 specific calls vs the generic
seek/tell, but there probably are some. Because of the possible
performance hit from 64 bit access, and because of OS limitations, it may
be desirable to generate VMs with and without this option.
Comments?
P.S. How and to whom should I submit source code changes? And is there a
way to test a VM after its built to see if it's solid?
More information about the Squeak-dev
mailing list
|