]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: fix indentation in Joe's changes
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 14 Sep 2009 08:09:03 +0000 (03:09 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 14 Sep 2009 08:09:03 +0000 (03:09 -0500)
vm/cpu-ppc.hpp
vm/cpu-x86.hpp
vm/float_bits.hpp
vm/layouts.hpp
vm/os-freebsd-x86.32.hpp
vm/os-freebsd-x86.64.hpp
vm/os-macosx-ppc.hpp
vm/os-macosx-x86.32.hpp
vm/os-macosx-x86.64.hpp
vm/os-netbsd.hpp
vm/os-windows-nt.cpp

index db02a72959d7557b232a5f92add54363c03f0c5c..2124e03350511e5e4ce14f1b85a5214cf1bfed16 100644 (file)
@@ -67,15 +67,15 @@ inline static unsigned int fpu_status(unsigned int status)
         unsigned int r = 0;
 
         if (status & 0x20000000)
-            r |= FP_TRAP_INVALID_OPERATION;
+               r |= FP_TRAP_INVALID_OPERATION;
         if (status & 0x10000000)
-            r |= FP_TRAP_OVERFLOW;
+               r |= FP_TRAP_OVERFLOW;
         if (status & 0x08000000)
-            r |= FP_TRAP_UNDERFLOW;
+               r |= FP_TRAP_UNDERFLOW;
         if (status & 0x04000000)
-            r |= FP_TRAP_ZERO_DIVIDE;
+               r |= FP_TRAP_ZERO_DIVIDE;
         if (status & 0x02000000)
-            r |= FP_TRAP_INEXACT;
+               r |= FP_TRAP_INEXACT;
 
         return r;
 }
index 7054f907357e1ccc28c1cb369d2df2bc1e95d1b8..4a37a1788969119797271b9586a9056ea992fe40 100644 (file)
@@ -53,17 +53,17 @@ inline static bool tail_call_site_p(cell return_address)
 inline static unsigned int fpu_status(unsigned int status)
 {
         unsigned int r = 0;
-
+       
         if (status & 0x01)
-            r |= FP_TRAP_INVALID_OPERATION;
+               r |= FP_TRAP_INVALID_OPERATION;
         if (status & 0x04)
-            r |= FP_TRAP_ZERO_DIVIDE;
+               r |= FP_TRAP_ZERO_DIVIDE;
         if (status & 0x08)
-            r |= FP_TRAP_OVERFLOW;
+               r |= FP_TRAP_OVERFLOW;
         if (status & 0x10)
-            r |= FP_TRAP_UNDERFLOW;
+               r |= FP_TRAP_UNDERFLOW;
         if (status & 0x20)
-            r |= FP_TRAP_INEXACT;
+               r |= FP_TRAP_INEXACT;
 
         return r;
 }
index 000bd49482b4a291cc0802b6caf66f0d61f56ee1..73a04639ee51c630d508d15bfbe8aedab899e1e7 100644 (file)
@@ -5,8 +5,8 @@ namespace factor
 representations and vice versa */
 
 union double_bits_pun {
-    double x;
-    u64 y;
+       double x;
+       u64 y;
 };
 
 inline static u64 double_bits(double x)
@@ -24,8 +24,8 @@ inline static double bits_double(u64 y)
 }
 
 union float_bits_pun {
-    float x;
-    u32 y;
+       float x;
+       u32 y;
 };
 
 inline static u32 float_bits(float x)
index a14c234aaab6cd1ce158da349a124658d93bad5f..dceb9a208ae3ecb8949c927635141e00e4c1b479 100644 (file)
@@ -70,11 +70,11 @@ inline static cell align8(cell a)
 /* Constants used when floating-point trap exceptions are thrown */
 enum
 {
-        FP_TRAP_INVALID_OPERATION = 1 << 0,
-        FP_TRAP_OVERFLOW          = 1 << 1,
-        FP_TRAP_UNDERFLOW         = 1 << 2,
-        FP_TRAP_ZERO_DIVIDE       = 1 << 3,
-        FP_TRAP_INEXACT           = 1 << 4,
+       FP_TRAP_INVALID_OPERATION = 1 << 0,
+       FP_TRAP_OVERFLOW          = 1 << 1,
+       FP_TRAP_UNDERFLOW         = 1 << 2,
+       FP_TRAP_ZERO_DIVIDE       = 1 << 3,
+       FP_TRAP_INEXACT           = 1 << 4,
 };
 
 inline static bool immediate_p(cell obj)
index 800b343dfd6a0bfbb6c045ee9826536f7d60b801..a0888e1f5bad2144800a4caaa97dddac74846040 100644 (file)
@@ -13,26 +13,33 @@ inline static void *ucontext_stack_pointer(void *uap)
 inline static unsigned int uap_fpu_status(void *uap)
 {
         ucontext_t *ucontext = (ucontext_t *)uap;
-        if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_387) {
-            struct save87 *x87 = (struct save87 *)(&ucontext->uc_mcontext.mc_fpstate);
-            return x87->sv_env.en_sw;
-        } else if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM) {
-            struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
-            return xmm->sv_env.en_sw | xmm->sv_env.en_mxcsr;
-        } else
-            return 0;
+        if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_387)
+       {
+               struct save87 *x87 = (struct save87 *)(&ucontext->uc_mcontext.mc_fpstate);
+               return x87->sv_env.en_sw;
+        }
+       else if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
+       {
+               struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
+               return xmm->sv_env.en_sw | xmm->sv_env.en_mxcsr;
+        }
+       else
+               return 0;
 }
 
 inline static void uap_clear_fpu_status(void *uap)
 {
         ucontext_t *ucontext = (ucontext_t *)uap;
-        if (uap->uc_mcontext.mc_fpformat == _MC_FPFMT_387) {
-            struct save87 *x87 = (struct save87 *)(&ucontext->uc_mcontext.mc_fpstate);
-            x87->sv_env.en_sw = 0;
-        } else if (uap->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM) {
-            struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
-            xmm->sv_env.en_sw = 0;
-            xmm->sv_env.en_mxcsr &= 0xffffffc0;
+        if (uap->uc_mcontext.mc_fpformat == _MC_FPFMT_387)
+       {
+               struct save87 *x87 = (struct save87 *)(&ucontext->uc_mcontext.mc_fpstate);
+               x87->sv_env.en_sw = 0;
+        }
+       else if (uap->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
+       {
+               struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
+               xmm->sv_env.en_sw = 0;
+               xmm->sv_env.en_mxcsr &= 0xffffffc0;
         }
 }
 
index b2dd0961370f57aad3acaab79766a3989b65f2a3..6200a0f5f34be8a7f9710107ce19d30000af9b6b 100644 (file)
@@ -13,20 +13,23 @@ inline static void *ucontext_stack_pointer(void *uap)
 inline static unsigned int uap_fpu_status(void *uap)
 {
         ucontext_t *ucontext = (ucontext_t *)uap;
-        if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM) {
-            struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
-            return xmm->sv_env.en_sw | xmm->sv_env.en_mxcsr;
-        } else
-            return 0;
+        if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
+       {
+               struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
+               return xmm->sv_env.en_sw | xmm->sv_env.en_mxcsr;
+        }
+       else
+               return 0;
 }
 
 inline static void uap_clear_fpu_status(void *uap)
 {
         ucontext_t *ucontext = (ucontext_t *)uap;
-        if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM) {
-            struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
-            xmm->sv_env.en_sw = 0;
-            xmm->sv_env.en_mxcsr &= 0xffffffc0;
+        if (ucontext->uc_mcontext.mc_fpformat == _MC_FPFMT_XMM)
+       {
+               struct savexmm *xmm = (struct savexmm *)(&ucontext->uc_mcontext.mc_fpstate);
+               xmm->sv_env.en_sw = 0;
+               xmm->sv_env.en_mxcsr &= 0xffffffc0;
         }
 }
 
index 31a1e228820fc814aaf0cacbe65250c665d3d775..338e3e812f30b60a92592adb1eb5affbc5008ee6 100644 (file)
@@ -54,27 +54,27 @@ Modified for Factor by Slava Pestov */
 
 inline static unsigned int mach_fpu_status(ppc_float_state_t *float_state)
 {
-    return FPSCR(float_state);
+       return FPSCR(float_state);
 }
 
 inline static unsigned int uap_fpu_status(void *uap)
 {
-    return mach_fpu_status(UAP_FS(uap));
+       return mach_fpu_status(UAP_FS(uap));
 }
 
 inline static cell fix_stack_pointer(cell sp)
 {
-    return sp;
+       return sp;
 }
 
 inline static void mach_clear_fpu_status(ppc_float_state_t *float_state)
 {
-    FPSCR(float_state) &= 0x0007ffff;
+       FPSCR(float_state) &= 0x0007ffff;
 }
 
 inline static void uap_clear_fpu_status(void *uap)
 {
-    mach_clear_fpu_status(UAP_FS(uap));
+       mach_clear_fpu_status(UAP_FS(uap));
 }
 
 }
index 01ad28df4f8e67ea0a7c12a8299d3e228c17e8cc..89906cd9a4f6b765e8dfc9510a6334b219ea1d0a 100644 (file)
@@ -54,14 +54,14 @@ Modified for Factor by Slava Pestov */
 
 inline static unsigned int mach_fpu_status(i386_float_state_t *float_state)
 {
-    unsigned short x87sw;
-    memcpy(&x87sw, &X87SW(float_state), sizeof(x87sw));
-    return MXCSR(float_state) | x87sw;
+       unsigned short x87sw;
+       memcpy(&x87sw, &X87SW(float_state), sizeof(x87sw));
+       return MXCSR(float_state) | x87sw;
 }
 
 inline static unsigned int uap_fpu_status(void *uap)
 {
-    return mach_fpu_status(UAP_FS(uap));
+       return mach_fpu_status(UAP_FS(uap));
 }
 
 inline static cell fix_stack_pointer(cell sp)
@@ -77,7 +77,7 @@ inline static void mach_clear_fpu_status(i386_float_state_t *float_state)
 
 inline static void uap_clear_fpu_status(void *uap)
 {
-    mach_clear_fpu_status(UAP_FS(uap));
+       mach_clear_fpu_status(UAP_FS(uap));
 }
 
 }
index f56ada23fd80687db5fe8e444ac70074d1206833..fd6db4d68cc02a093901c4aaf68650f415c8a001 100644 (file)
@@ -52,30 +52,30 @@ Modified for Factor by Slava Pestov and Daniel Ehrenberg */
 
 inline static unsigned int mach_fpu_status(x86_float_state64_t *float_state)
 {
-    unsigned short x87sw;
-    memcpy(&x87sw, &X87SW(float_state), sizeof(x87sw));
-    return MXCSR(float_state) | x87sw;
+       unsigned short x87sw;
+       memcpy(&x87sw, &X87SW(float_state), sizeof(x87sw));
+       return MXCSR(float_state) | x87sw;
 }
 
 inline static unsigned int uap_fpu_status(void *uap)
 {
-    return mach_fpu_status(UAP_FS(uap));
+       return mach_fpu_status(UAP_FS(uap));
 }
 
 inline static cell fix_stack_pointer(cell sp)
 {
-    return ((sp + 8) & ~15) - 8;
+       return ((sp + 8) & ~15) - 8;
 }
 
 inline static void mach_clear_fpu_status(x86_float_state64_t *float_state)
 {
-    MXCSR(float_state) &= 0xffffffc0;
-    memset(&X87SW(float_state), 0, sizeof(X87SW(float_state)));
+       MXCSR(float_state) &= 0xffffffc0;
+       memset(&X87SW(float_state), 0, sizeof(X87SW(float_state)));
 }
 
 inline static void uap_clear_fpu_status(void *uap)
 {
-    mach_clear_fpu_status(UAP_FS(uap));
+       mach_clear_fpu_status(UAP_FS(uap));
 }
 
 }
index 635361e3e4411f85a6f1872309456cb6b2f414f2..d45b2ac1630eb74de287b6a73cbe66fb5e47c672 100644 (file)
@@ -5,6 +5,4 @@ namespace factor
 
 #define UAP_PROGRAM_COUNTER(uap)    _UC_MACHINE_PC((ucontext_t *)uap)
 
-#define DIRECTORY_P(file) ((file)->d_type == DT_DIR)
-
 }
index c2b4e2af9e668acb98f8d26c6aab3a29298b1794..017a96bb7c0d2ca544724e009b92ce732dbdeb85 100644 (file)
@@ -21,40 +21,39 @@ FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe)
        else
                signal_callstack_top = NULL;
 
-    switch (e->ExceptionCode) {
-    case EXCEPTION_ACCESS_VIOLATION:
+       switch (e->ExceptionCode)
+       {
+       case EXCEPTION_ACCESS_VIOLATION:
                signal_fault_addr = e->ExceptionInformation[1];
                c->EIP = (cell)memory_signal_handler_impl;
-        break;
+       break;
 
-    case EXCEPTION_FLT_DENORMAL_OPERAND:
-    case EXCEPTION_FLT_DIVIDE_BY_ZERO:
-    case EXCEPTION_FLT_INEXACT_RESULT:
-    case EXCEPTION_FLT_INVALID_OPERATION:
-    case EXCEPTION_FLT_OVERFLOW:
-    case EXCEPTION_FLT_STACK_CHECK:
-    case EXCEPTION_FLT_UNDERFLOW:
-        /* XXX MxCsr is not available in CONTEXT structure on x86.32 */
-        signal_fpu_status = c->FloatSave.StatusWord;
-        c->FloatSave.StatusWord = 0;
-        c->EIP = (cell)fp_signal_handler_impl;
-        break;
-
-       /* If the Widcomm bluetooth stack is installed, the BTTray.exe process
-          injects code into running programs. For some reason this results in
-          random SEH exceptions with this (undocumented) exception code being
-          raised. The workaround seems to be ignoring this altogether, since that
-          is what happens if SEH is not enabled. Don't really have any idea what
-          this exception means. */
-    case 0x40010006:
-        break;
-
-    default:
+       case EXCEPTION_FLT_DENORMAL_OPERAND:
+       case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+       case EXCEPTION_FLT_INEXACT_RESULT:
+       case EXCEPTION_FLT_INVALID_OPERATION:
+       case EXCEPTION_FLT_OVERFLOW:
+       case EXCEPTION_FLT_STACK_CHECK:
+       case EXCEPTION_FLT_UNDERFLOW:
+               /* XXX MxCsr is not available in CONTEXT structure on x86.32 */
+               signal_fpu_status = c->FloatSave.StatusWord;
+               c->FloatSave.StatusWord = 0;
+               c->EIP = (cell)fp_signal_handler_impl;
+               break;
+       case 0x40010006:
+               /* If the Widcomm bluetooth stack is installed, the BTTray.exe
+               process injects code into running programs. For some reason this
+               results in random SEH exceptions with this (undocumented)
+               exception code being raised. The workaround seems to be ignoring
+               this altogether, since that is what happens if SEH is not
+               enabled. Don't really have any idea what this exception means. */
+               break;
+       default:
                signal_number = e->ExceptionCode;
                c->EIP = (cell)misc_signal_handler_impl;
-        break;
-    }
-    return EXCEPTION_CONTINUE_EXECUTION;
+               break;
+       }
+       return EXCEPTION_CONTINUE_EXECUTION;
 }
 
 void c_to_factor_toplevel(cell quot)