From 2bfe6f0d1363f87b9d2216b510615539d32c14d3 Mon Sep 17 00:00:00 2001 From: Eric Scharff Date: Mon, 16 Jun 2008 10:55:29 -0600 Subject: [PATCH] Ensure we align the stack before any time we might enter a C function from generated code --- src/compile.cpp | 54 ++++++++++++++++++++++++------------------------- src/machine.cpp | 2 +- src/machine.h | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/compile.cpp b/src/compile.cpp index ec3c1d9235..364046dd84 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -28,7 +28,7 @@ vmCall(); namespace { const bool Verbose = false; -const bool DebugNatives = false; +const bool DebugNatives = true; const bool DebugCallTable = false; const bool DebugMethodTree = false; const bool DebugFrameMaps = false; @@ -1212,7 +1212,7 @@ findInterfaceMethodFromInstance(MyThread* t, object method, object instance) } } -intptr_t +intptr_t FORCE_ALIGN compareDoublesG(uint64_t bi, uint64_t ai) { double a = bitsToDouble(ai); @@ -1229,7 +1229,7 @@ compareDoublesG(uint64_t bi, uint64_t ai) } } -intptr_t +intptr_t FORCE_ALIGN compareDoublesL(uint64_t bi, uint64_t ai) { double a = bitsToDouble(ai); @@ -1246,7 +1246,7 @@ compareDoublesL(uint64_t bi, uint64_t ai) } } -intptr_t +intptr_t FORCE_ALIGN compareFloatsG(uint32_t bi, uint32_t ai) { float a = bitsToFloat(ai); @@ -1263,7 +1263,7 @@ compareFloatsG(uint32_t bi, uint32_t ai) } } -intptr_t +intptr_t FORCE_ALIGN compareFloatsL(uint32_t bi, uint32_t ai) { float a = bitsToFloat(ai); @@ -1280,79 +1280,79 @@ compareFloatsL(uint32_t bi, uint32_t ai) } } -uint64_t +uint64_t FORCE_ALIGN addDouble(uint64_t b, uint64_t a) { return doubleToBits(bitsToDouble(a) + bitsToDouble(b)); } -uint64_t +uint64_t FORCE_ALIGN subtractDouble(uint64_t b, uint64_t a) { return doubleToBits(bitsToDouble(a) - bitsToDouble(b)); } -uint64_t +uint64_t FORCE_ALIGN multiplyDouble(uint64_t b, uint64_t a) { return doubleToBits(bitsToDouble(a) * bitsToDouble(b)); } -uint64_t +uint64_t FORCE_ALIGN divideDouble(uint64_t b, uint64_t a) { return doubleToBits(bitsToDouble(a) / bitsToDouble(b)); } -uint64_t +uint64_t FORCE_ALIGN moduloDouble(uint64_t b, uint64_t a) { return doubleToBits(fmod(bitsToDouble(a), bitsToDouble(b))); } -uint64_t +uint64_t FORCE_ALIGN negateDouble(uint64_t a) { return doubleToBits(- bitsToDouble(a)); } -uint32_t +uint32_t FORCE_ALIGN doubleToFloat(int64_t a) { return floatToBits(static_cast(bitsToDouble(a))); } -int32_t +int32_t FORCE_ALIGN doubleToInt(int64_t a) { return static_cast(bitsToDouble(a)); } -int64_t +int64_t FORCE_ALIGN doubleToLong(int64_t a) { return static_cast(bitsToDouble(a)); } -uint32_t +uint32_t FORCE_ALIGN addFloat(uint32_t b, uint32_t a) { return floatToBits(bitsToFloat(a) + bitsToFloat(b)); } -uint32_t +uint32_t FORCE_ALIGN subtractFloat(uint32_t b, uint32_t a) { return floatToBits(bitsToFloat(a) - bitsToFloat(b)); } -uint32_t +uint32_t FORCE_ALIGN multiplyFloat(uint32_t b, uint32_t a) { return floatToBits(bitsToFloat(a) * bitsToFloat(b)); } -uint32_t +uint32_t FORCE_ALIGN divideFloat(uint32_t b, uint32_t a) { return floatToBits(bitsToFloat(a) / bitsToFloat(b)); @@ -1364,7 +1364,7 @@ moduloFloat(uint32_t b, uint32_t a) return floatToBits(fmod(bitsToFloat(a), bitsToFloat(b))); } -uint32_t +uint32_t FORCE_ALIGN negateFloat(uint32_t a) { return floatToBits(- bitsToFloat(a)); @@ -1382,43 +1382,43 @@ moduloLong(int64_t b, int64_t a) return a % b; } -uint64_t +uint64_t FORCE_ALIGN floatToDouble(int32_t a) { return doubleToBits(static_cast(bitsToFloat(a))); } -int32_t +int32_t FORCE_ALIGN floatToInt(int32_t a) { return static_cast(bitsToFloat(a)); } -int64_t +int64_t FORCE_ALIGN floatToLong(int32_t a) { return static_cast(bitsToFloat(a)); } -uint64_t +uint64_t FORCE_ALIGN intToDouble(int32_t a) { return doubleToBits(static_cast(a)); } -uint32_t +uint32_t FORCE_ALIGN intToFloat(int32_t a) { return floatToBits(static_cast(a)); } -uint64_t +uint64_t FORCE_ALIGN longToDouble(int64_t a) { return doubleToBits(static_cast(a)); } -uint32_t +uint32_t FORCE_ALIGN longToFloat(int64_t a) { return floatToBits(static_cast(a)); @@ -1449,7 +1449,7 @@ makeBlankArray(MyThread* t, object (*constructor)(Thread*, uintptr_t, bool), } } -uintptr_t +uintptr_t FORCE_ALIGN lookUpAddress(int32_t key, uintptr_t* start, int32_t count, uintptr_t default_) { diff --git a/src/machine.cpp b/src/machine.cpp index 5391af5e86..dbbcde9880 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -2221,7 +2221,7 @@ isAssignableFrom(Thread* t, object a, object b) return false; } -bool +bool FORCE_ALIGN instanceOf(Thread* t, object class_, object o) { if (o == 0) { diff --git a/src/machine.h b/src/machine.h index fbf152d4ab..81a6617956 100644 --- a/src/machine.h +++ b/src/machine.h @@ -1491,7 +1491,7 @@ mark(Thread* t, object o, unsigned offset) } } -inline void +inline void FORCE_ALIGN set(Thread* t, object target, unsigned offset, object value) { cast(target, offset) = value;