You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2008/03/03 13:02:25 UTC
svn commit: r633052 - in /harmony/enhanced/drlvm/trunk/vm:
include/open/platform_types.h include/open/types.h
vmcore/include/vm_core_types.h
Author: gshimansky
Date: Mon Mar 3 04:02:24 2008
New Revision: 633052
URL: http://svn.apache.org/viewvc?rev=633052&view=rev
Log:
Applied patch 0004 from HARMONY-5504
[drlvm][port] Restructure DRLVM's sources to extract most of platform dependent code into portlib
Patch moves declaraction of platform dependent Registers structure to platform dependent header
of the interface.
Added:
harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h (with props)
Modified:
harmony/enhanced/drlvm/trunk/vm/include/open/types.h
harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_core_types.h
Added: harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h?rev=633052&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h Mon Mar 3 04:02:24 2008
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _PLATFORM_TYPES_H_
+#define _PLATFORM_TYPES_H_
+
+#include "common.h"
+
+#define MAX_UINT32 0xffffffff
+/**
+ * DLL stuff
+ */
+#if defined(PLATFORM_POSIX) || (defined(USE_STATIC_GC) && defined(BUILDING_GC))
+
+#define VMEXPORT
+#define VMIMPORT
+#define JITEXPORT
+#define EMEXPORT
+
+#else // !PLATFORM_POSIX
+
+#if defined(BUILDING_VM) && !defined(STATIC_BUILD)
+#define VMEXPORT __declspec(dllexport)
+#define JITEXPORT __declspec(dllimport)
+#define EMEXPORT __declspec(dllimport)
+#define VMIMPORT __declspec(dllimport)
+#else // !BUILDING_VM
+#define VMEXPORT __declspec(dllimport)
+#define JITEXPORT __declspec(dllexport)
+#define EMEXPORT __declspec(dllexport)
+#define VMIMPORT __declspec(dllexport)
+#endif // !BUILDING_VM
+
+#endif // !PLATFORM_POSIX
+
+/**
+ * Various Numeric Types
+ */
+
+// Boolean, uint8, int8, uint16, int16, uint32, int32, uint64, int64,
+// POINTER_SIZE_INT
+
+// We can't use bool in non-C++ code
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+typedef unsigned Boolean;
+
+typedef unsigned char Byte;
+
+//::For long long int, add the LL
+#ifndef __WORDSIZE // exclude remark #193: zero used for undefined preprocessing identifier
+#define __WORDSIZE 0
+#endif
+# if __WORDSIZE == 64 || defined(WIN32)
+# define __INT64_C(c) c ## L
+# define __UINT64_C(c) c ## UL
+# else
+# define __INT64_C(c) c ## LL
+# define __UINT64_C(c) c ## ULL
+# endif
+
+#ifdef PLATFORM_POSIX
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+typedef unsigned int uint32;
+typedef unsigned long long uint64;
+
+typedef signed char int8;
+typedef signed short int16;
+typedef signed int int32;
+typedef signed long long int64;
+
+#else //!PLATFORM_POSIX
+
+#ifndef __INSURE__
+// these give Insure++ problems:
+typedef unsigned __int8 uint8;
+typedef unsigned __int16 uint16;
+typedef unsigned __int32 uint32;
+typedef signed __int8 int8;
+typedef signed __int16 int16;
+#else
+// so use these definitions instead with Insure++:
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+typedef unsigned int uint32;
+typedef signed char int8;
+typedef signed short int16;
+#endif
+typedef unsigned __int64 uint64;
+typedef signed __int64 int64;
+#if (_MSC_VER != 1100 || !defined _WINSOCK2API_)
+#ifndef __INSURE__
+// this gives Insure++ problems:
+typedef signed __int32 int32;
+#else
+// so use this definition instead with Insure++:
+typedef signed int int32;
+#endif // __INSURE__
+#endif
+
+#endif //!PLATFORM_POSIX
+
+/**
+ * printf format specifier for 64-bit integers
+ */
+#ifdef _WIN32
+#define FMT64 "I64"
+#else
+#define FMT64 "ll"
+#endif
+
+
+/**
+ * The integer datatypes on the platform that can hold a pointer.
+ */
+#ifdef POINTER64
+#define POINTER_SIZE_INT uint64
+#define POINTER_SIZE_SINT int64
+#ifdef PLATFORM_NT
+#define PI_FMT "I64"
+#else
+#define PI_FMT "ll"
+#endif
+#define W_PI_FMT "016"PI_FMT"x"
+#else
+#define POINTER_SIZE_INT uint32
+#define POINTER_SIZE_SINT int32
+#define PI_FMT ""
+#define W_PI_FMT "08"PI_FMT"x"
+#endif // POINTER64
+
+
+/**
+ * The register context structure
+ */
+#ifdef _IPF_
+
+struct Registers {
+
+ uint64 gr[32];
+ uint64 fp[128];
+ uint64 br[8];
+ uint64 preds;
+ uint64 nats;
+ uint64 pfs;
+ uint64 *bsp;
+ uint64 ip;
+
+#ifdef __cplusplus
+ void reset_ip() { ip = 0; }
+ void* get_ip() { return (void*)ip; }
+ void set_ip(void* src_ip) { ip = (uint64)src_ip; }
+ void* get_sp() { return (void*)bsp; }
+ void set_sp(void* src_sp) { }
+#endif
+}; //Registers
+
+#else // !_IPF_
+
+#ifdef _EM64T_
+
+struct Registers {
+ uint64 rsp;
+ uint64 rbp;
+ uint64 rip;
+ // callee-saved
+ uint64 rbx;
+ uint64 r12;
+ uint64 r13;
+ uint64 r14;
+ uint64 r15;
+ // scratched
+ uint64 rax;
+ uint64 rcx;
+ uint64 rdx;
+ uint64 rsi;
+ uint64 rdi;
+ uint64 r8;
+ uint64 r9;
+ uint64 r10;
+ uint64 r11;
+
+ uint32 eflags;
+
+#ifdef __cplusplus
+ void reset_ip() { rip = 0; }
+ void* get_ip() { return (void*)rip; }
+ void set_ip(void* src_ip) { rip = (uint64)src_ip; }
+ void* get_sp() { return (void*)rsp; }
+ void set_sp(void* src_sp) { rsp = (uint64)src_sp; }
+#endif
+}; //Registers
+
+#else // ! _EM64T_
+
+struct Registers {
+ uint32 eax;
+ uint32 ebx;
+ uint32 ecx;
+ uint32 edx;
+ uint32 edi;
+ uint32 esi;
+ uint32 ebp;
+ uint32 esp;
+ uint32 eip;
+ uint32 eflags;
+
+#ifdef __cplusplus
+ void reset_ip() { eip = 0; }
+ void* get_ip() { return (void*)eip; }
+ void set_ip(void* src_ip) { eip = (uint32)src_ip; }
+ void* get_sp() { return (void*)esp; }
+ void set_sp(void* src_sp) { esp = (uint32)src_sp; }
+#endif
+}; //Registers
+
+#endif // _EM64T_
+
+#endif //!_IPF_
+
+
+#endif //!_PLATFORM_TYPES_H_
Propchange: harmony/enhanced/drlvm/trunk/vm/include/open/platform_types.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/include/open/types.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/types.h?rev=633052&r1=633051&r2=633052&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/types.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/types.h Mon Mar 3 04:02:24 2008
@@ -18,135 +18,8 @@
#ifndef _VM_TYPES_H_
#define _VM_TYPES_H_
-#include "common.h"
+#include "platform_types.h"
-#define MAX_UINT32 0xffffffff
-/**
- * DLL stuff
- */
-#if defined(PLATFORM_POSIX) || (defined(USE_STATIC_GC) && defined(BUILDING_GC))
-
-#define VMEXPORT
-#define VMIMPORT
-#define JITEXPORT
-#define EMEXPORT
-
-#else // !PLATFORM_POSIX
-
-#if defined(BUILDING_VM) && !defined(STATIC_BUILD)
-#define VMEXPORT __declspec(dllexport)
-#define JITEXPORT __declspec(dllimport)
-#define EMEXPORT __declspec(dllimport)
-#define VMIMPORT __declspec(dllimport)
-#else // !BUILDING_VM
-#define VMEXPORT __declspec(dllimport)
-#define JITEXPORT __declspec(dllexport)
-#define EMEXPORT __declspec(dllexport)
-#define VMIMPORT __declspec(dllexport)
-#endif // !BUILDING_VM
-
-#endif // !PLATFORM_POSIX
-
-/**
- * Various Numeric Types
- */
-
-// Boolean, uint8, int8, uint16, int16, uint32, int32, uint64, int64,
-// POINTER_SIZE_INT
-
-// We can't use bool in non-C++ code
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-typedef unsigned Boolean;
-
-typedef unsigned char Byte;
-
-//::For long long int, add the LL
-#ifndef __WORDSIZE // exclude remark #193: zero used for undefined preprocessing identifier
-#define __WORDSIZE 0
-#endif
-# if __WORDSIZE == 64 || defined(WIN32)
-# define __INT64_C(c) c ## L
-# define __UINT64_C(c) c ## UL
-# else
-# define __INT64_C(c) c ## LL
-# define __UINT64_C(c) c ## ULL
-# endif
-
-#ifdef PLATFORM_POSIX
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef unsigned long long uint64;
-
-typedef signed char int8;
-typedef signed short int16;
-typedef signed int int32;
-typedef signed long long int64;
-
-#else //!PLATFORM_POSIX
-
-#ifndef __INSURE__
-// these give Insure++ problems:
-typedef unsigned __int8 uint8;
-typedef unsigned __int16 uint16;
-typedef unsigned __int32 uint32;
-typedef signed __int8 int8;
-typedef signed __int16 int16;
-#else
-// so use these definitions instead with Insure++:
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef signed char int8;
-typedef signed short int16;
-#endif
-typedef unsigned __int64 uint64;
-typedef signed __int64 int64;
-#if (_MSC_VER != 1100 || !defined _WINSOCK2API_)
-#ifndef __INSURE__
-// this gives Insure++ problems:
-typedef signed __int32 int32;
-#else
-// so use this definition instead with Insure++:
-typedef signed int int32;
-#endif // __INSURE__
-#endif
-
-#endif //!PLATFORM_POSIX
-
-/**
- * printf format specifier for 64-bit integers
- */
-#ifdef _WIN32
-#define FMT64 "I64"
-#else
-#define FMT64 "ll"
-#endif
-
-
-/**
- * The integer datatypes on the platform that can hold a pointer.
- */
-#ifdef POINTER64
-#define POINTER_SIZE_INT uint64
-#define POINTER_SIZE_SINT int64
-#ifdef PLATFORM_NT
-#define PI_FMT "I64"
-#else
-#define PI_FMT "ll"
-#endif
-#define W_PI_FMT "016"PI_FMT"x"
-#else
-#define POINTER_SIZE_INT uint32
-#define POINTER_SIZE_SINT int32
-#define PI_FMT ""
-#define W_PI_FMT "08"PI_FMT"x"
-#endif // POINTER64
/**
* <code>VM_Data_Type</code>
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_core_types.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_core_types.h?rev=633052&r1=633051&r2=633052&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_core_types.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_core_types.h Mon Mar 3 04:02:24 2008
@@ -54,85 +54,5 @@
typedef void (*GenericFunctionPointer)();
typedef LilCodeStub* (*NativeStubOverride)(LilCodeStub*, Method_Handle);
-// Architectural Registers
-
-#ifdef _IPF_
-
-struct Registers {
-
- uint64 gr[32];
- uint64 fp[128];
- uint64 br[8];
- uint64 preds;
- uint64 nats;
- uint64 pfs;
- uint64 *bsp;
- uint64 ip;
-
- void reset_ip() { ip = 0; }
- void* get_ip() { return (void*)ip; }
- void set_ip(void* src_ip) { ip = (uint64)src_ip; }
- void* get_sp() { return (void*)bsp; }
- void set_sp(void* src_sp) { }
-}; //Registers
-
-#else // !_IPF_
-
-#ifdef _EM64T_
-
-struct Registers {
- uint64 rsp;
- uint64 rbp;
- uint64 rip;
- // callee-saved
- uint64 rbx;
- uint64 r12;
- uint64 r13;
- uint64 r14;
- uint64 r15;
- // scratched
- uint64 rax;
- uint64 rcx;
- uint64 rdx;
- uint64 rsi;
- uint64 rdi;
- uint64 r8;
- uint64 r9;
- uint64 r10;
- uint64 r11;
-
- uint32 eflags;
-
- void reset_ip() { rip = 0; }
- void* get_ip() { return (void*)rip; }
- void set_ip(void* src_ip) { rip = (uint64)src_ip; }
- void* get_sp() { return (void*)rsp; }
- void set_sp(void* src_sp) { rsp = (uint64)src_sp; }
-}; //Registers
-
-#else // ! _EM64T_
-
-struct Registers {
- uint32 eax;
- uint32 ebx;
- uint32 ecx;
- uint32 edx;
- uint32 edi;
- uint32 esi;
- uint32 ebp;
- uint32 esp;
- uint32 eip;
- uint32 eflags;
-
- void reset_ip() { eip = 0; }
- void* get_ip() { return (void*)eip; }
- void set_ip(void* src_ip) { eip = (uint32)src_ip; }
- void* get_sp() { return (void*)esp; }
- void set_sp(void* src_sp) { esp = (uint32)src_sp; }
-}; //Registers
-
-#endif // _EM64T_
-
-#endif //!_IPF_
#endif //!_VM_CORE_TYPES_H_