mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/win32.h, win32/Makefile.sub, win32/configure.bat,
win32/mkexports.rb, win32/setup.mak, win32/win32.c: import x64-mswin64 port. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
41e9245e85
commit
1aa54c6db6
7 changed files with 83 additions and 28 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed Jun 27 20:46:05 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* include/ruby/win32.h, win32/Makefile.sub, win32/configure.bat,
|
||||
win32/mkexports.rb, win32/setup.mak, win32/win32.c: import
|
||||
x64-mswin64 port.
|
||||
|
||||
Wed Jun 27 20:31:07 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* compile.c (iseq_translate_direct_threaded_code): fix prototype
|
||||
|
|
|
@ -67,6 +67,26 @@ extern "C++" {
|
|||
#endif
|
||||
#include <io.h>
|
||||
#include <malloc.h>
|
||||
#ifdef __MINGW32__
|
||||
# include <stdint.h>
|
||||
#else
|
||||
# if !defined(_INTPTR_T_DEFINED)
|
||||
# ifdef _WIN64
|
||||
typedef __int64 intptr_t;
|
||||
# else
|
||||
typedef int intptr_t;
|
||||
# endif
|
||||
# define _INTPTR_T_DEFINED
|
||||
# endif
|
||||
# if !defined(_UINTPTR_T_DEFINED)
|
||||
# ifdef _WIN64
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
# else
|
||||
typedef unsigned int uintptr_t;
|
||||
# endif
|
||||
# define _UINTPTR_T_DEFINED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
@ -531,8 +551,8 @@ Since this function is very dangerous, ((*NEVER*))
|
|||
* use anything like TRAP_BEG...TRAP_END block structure,
|
||||
in asynchronous_func_t.
|
||||
*/
|
||||
typedef DWORD (*asynchronous_func_t)(DWORD self, int argc, DWORD* argv);
|
||||
DWORD rb_w32_asynchronize(asynchronous_func_t func, DWORD self, int argc, DWORD* argv, DWORD intrval);
|
||||
typedef uintptr_t (*asynchronous_func_t)(uintptr_t self, int argc, uintptr_t* argv);
|
||||
uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc, uintptr_t* argv, uintptr_t intrval);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#if 0
|
||||
|
|
|
@ -255,7 +255,11 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub
|
|||
#define SIZEOF___INT64 8
|
||||
#define _INTEGRAL_MAX_BITS 64
|
||||
#define SIZEOF_OFF_T 8
|
||||
!if "$(ARCH)" == "x64" || "$(ARCH)" == "ia64"
|
||||
#define SIZEOF_VOIDP 8
|
||||
!else
|
||||
#define SIZEOF_VOIDP 4
|
||||
!endif
|
||||
#define SIZEOF_FLOAT 4
|
||||
#define SIZEOF_DOUBLE 8
|
||||
!if $(MSC_VER) >= 1400
|
||||
|
@ -520,7 +524,8 @@ $(LIBRUBY_SO): $(LIBRUBY_A) $(DLDOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
|
|||
$(LDSHARED_2)
|
||||
|
||||
$(RUBYDEF): $(LIBRUBY_A) $(PREP)
|
||||
$(MINIRUBY) $(srcdir)/win32/mkexports.rb -output=$@ $(LIBRUBY_A)
|
||||
$(MINIRUBY) $(srcdir)/win32/mkexports.rb \
|
||||
-output=$@ -arch=$(ARCH) $(LIBRUBY_A)
|
||||
|
||||
{$(srcdir)/win32}.def.lib:
|
||||
$(AR) $(ARFLAGS)$@ -def:$<
|
||||
|
|
|
@ -65,6 +65,11 @@ goto :loop
|
|||
:target
|
||||
echo>> ~tmp~.mak "%2" \
|
||||
echo>>confargs.tmp --target=%2 \
|
||||
if "%2" == "x64-mswin64" goto target2
|
||||
if NOT "%2" == "ia64-mswin64" goto target3
|
||||
:target2
|
||||
echo>> ~tmp~.mak "OS=mswin64" \
|
||||
:target3
|
||||
shift
|
||||
shift
|
||||
goto :loop
|
||||
|
|
|
@ -80,7 +80,7 @@ end
|
|||
|
||||
class Exports::Mswin < Exports
|
||||
def each_export(objs)
|
||||
noprefix = ($arch ||= nil and /^sh/ !~ $arch)
|
||||
noprefix = ($arch ||= nil and /^(sh|i\d86)/ !~ $arch)
|
||||
objs = objs.collect {|s| s.tr('/', '\\')}
|
||||
filetype = nil
|
||||
IO.popen(%w"dumpbin -symbols -exports" + objs) do |f|
|
||||
|
|
|
@ -12,7 +12,9 @@ srcdir = $(WIN32DIR)/..
|
|||
!ifndef prefix
|
||||
prefix = /usr
|
||||
!endif
|
||||
!if "$(OS)" != "mswin64"
|
||||
OS = mswin32
|
||||
!endif
|
||||
BANG = !
|
||||
APPEND = echo>>$(MAKEFILE)
|
||||
!ifdef MAKEFILE
|
||||
|
@ -26,14 +28,18 @@ CC = cl -nologo
|
|||
CPP = $(CC) -EP
|
||||
|
||||
all: -prologue- -generic- -epilogue-
|
||||
i386-$(OS): -prologue- -i386- -epilogue-
|
||||
i486-$(OS): -prologue- -i486- -epilogue-
|
||||
i586-$(OS): -prologue- -i586- -epilogue-
|
||||
i686-$(OS): -prologue- -i686- -epilogue-
|
||||
alpha-$(OS): -prologue- -alpha- -epilogue-
|
||||
i386-mswin32: -prologue- -i386- -epilogue-
|
||||
i486-mswin32: -prologue- -i486- -epilogue-
|
||||
i586-mswin32: -prologue- -i586- -epilogue-
|
||||
i686-mswin32: -prologue- -i686- -epilogue-
|
||||
alpha-mswin32: -prologue- -alpha- -epilogue-
|
||||
x64-mswin64: -prologue64- -x64- -epilogue-
|
||||
ia64-mswin64: -prologue64- -ia64- -epilogue-
|
||||
|
||||
-prologue-: -basic-vars- -system-vars- -version- -program-name-
|
||||
|
||||
-prologue64-: -basic-vars- -system-vars64- -version- -program-name-
|
||||
|
||||
-basic-vars-: nul
|
||||
@type << > $(MAKEFILE)
|
||||
### Makefile for ruby $(OS) ###
|
||||
|
@ -54,9 +60,14 @@ BASERUBY = $(BASERUBY)
|
|||
|
||||
-system-vars-: -osname- -runtime-
|
||||
|
||||
-system-vars64-: -osname64- -runtime-
|
||||
|
||||
-osname-: nul
|
||||
@echo OS = mswin32 >>$(MAKEFILE)
|
||||
|
||||
-osname64-: nul
|
||||
@echo OS = mswin64 >>$(MAKEFILE)
|
||||
|
||||
-runtime-: nul
|
||||
@$(CC) -MD <<rtname.c user32.lib > nul
|
||||
#include <windows.h>
|
||||
|
@ -151,6 +162,10 @@ $(CPU) = $(PROCESSOR_LEVEL)
|
|||
|
||||
-alpha-: nul
|
||||
@$(APPEND) $(ARCH) = alpha
|
||||
-x64-: nul
|
||||
@$(APPEND) $(ARCH) = x64
|
||||
-ia64-: nul
|
||||
@$(APPEND) $(ARCH) = ia64
|
||||
-ix86-: nul
|
||||
@$(APPEND) $(ARCH) = x86
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ static int has_redirection(const char *);
|
|||
static void StartSockets(void);
|
||||
int rb_w32_wait_events(HANDLE *events, int num, DWORD timeout);
|
||||
#if !defined(_WIN32_WCE)
|
||||
static int rb_w32_open_osfhandle(long osfhandle, int flags);
|
||||
static int rb_w32_open_osfhandle(intptr_t osfhandle, int flags);
|
||||
#else
|
||||
#define rb_w32_open_osfhandle(osfhandle, flags) _open_osfhandle(osfhandle, flags)
|
||||
#endif
|
||||
|
@ -243,8 +243,8 @@ GetCurrentThreadHandle(void)
|
|||
} while (0)
|
||||
#define LK_LEN ULONG_MAX
|
||||
|
||||
static VALUE
|
||||
flock_winnt(VALUE self, int argc, VALUE* argv)
|
||||
static uintptr_t
|
||||
flock_winnt(uintptr_t self, int argc, uintptr_t* argv)
|
||||
{
|
||||
OVERLAPPED o;
|
||||
int i = -1;
|
||||
|
@ -280,8 +280,8 @@ flock_winnt(VALUE self, int argc, VALUE* argv)
|
|||
}
|
||||
|
||||
#ifdef WIN95
|
||||
static VALUE
|
||||
flock_win95(VALUE self, int argc, VALUE* argv)
|
||||
static uintptr_t
|
||||
flock_win95(uintptr_t self, int argc, uintptr_t* argv)
|
||||
{
|
||||
int i = -1;
|
||||
const HANDLE fh = (HANDLE)self;
|
||||
|
@ -802,7 +802,7 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe)
|
|||
}
|
||||
|
||||
/* associate handle to file descritor */
|
||||
*pipe = rb_w32_open_osfhandle((long)hDupFile, pipemode);
|
||||
*pipe = rb_w32_open_osfhandle((intptr_t)hDupFile, pipemode);
|
||||
CloseHandle(hOrg);
|
||||
if (*pipe == -1) {
|
||||
CloseHandle(hDupFile);
|
||||
|
@ -1622,9 +1622,9 @@ rb_w32_closedir(DIR *dirp)
|
|||
#endif
|
||||
|
||||
typedef struct {
|
||||
long osfhnd; /* underlying OS file HANDLE */
|
||||
char osfile; /* attributes of file (e.g., open in text mode?) */
|
||||
char pipech; /* one char buffer for handles opened on pipes */
|
||||
intptr_t osfhnd; /* underlying OS file HANDLE */
|
||||
char osfile; /* attributes of file (e.g., open in text mode?) */
|
||||
char pipech; /* one char buffer for handles opened on pipes */
|
||||
#ifdef MSVCRT_THREADS
|
||||
int lockinitflag;
|
||||
CRITICAL_SECTION lock;
|
||||
|
@ -1685,7 +1685,7 @@ set_pioinfo_extra(void)
|
|||
#define FTEXT 0x80 /* file handle is in text mode */
|
||||
|
||||
static int
|
||||
rb_w32_open_osfhandle(long osfhandle, int flags)
|
||||
rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
|
||||
{
|
||||
int fh;
|
||||
char fileflags; /* _osfile flags */
|
||||
|
@ -3651,11 +3651,15 @@ setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
|
|||
*--esp = ctx->Eip;
|
||||
ctx->Esp = (DWORD)esp;
|
||||
ctx->Eip = (DWORD)rb_w32_call_handler;
|
||||
#else
|
||||
#ifndef _WIN32_WCE
|
||||
#elif defined(_M_AMD64)
|
||||
DWORD64 *rsp = (DWORD64 *)ctx->Rsp;
|
||||
*--rsp = (DWORD64)harg;
|
||||
*--rsp = ctx->Rip;
|
||||
ctx->Rsp = (DWORD64)rsp;
|
||||
ctx->Rip = (DWORD64)rb_w32_call_handler;
|
||||
#else !defined(_WIN32_WCE)
|
||||
#error unsupported processor
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3733,10 +3737,10 @@ struct asynchronous_arg_t {
|
|||
int errnum;
|
||||
|
||||
/* input field */
|
||||
VALUE (*func)(VALUE self, int argc, VALUE* argv);
|
||||
VALUE self;
|
||||
uintptr_t (*func)(uintptr_t self, int argc, uintptr_t* argv);
|
||||
uintptr_t self;
|
||||
int argc;
|
||||
VALUE* argv;
|
||||
uintptr_t* argv;
|
||||
};
|
||||
|
||||
static DWORD WINAPI
|
||||
|
@ -3750,9 +3754,9 @@ call_asynchronous(PVOID argp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_w32_asynchronize(asynchronous_func_t func, VALUE self,
|
||||
int argc, VALUE* argv, VALUE intrval)
|
||||
uintptr_t
|
||||
rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self,
|
||||
int argc, uintptr_t* argv, uintptr_t intrval)
|
||||
{
|
||||
DWORD val;
|
||||
BOOL interrupted = FALSE;
|
||||
|
|
Loading…
Reference in a new issue