Fix hard-float on Raspberry Pi, small cleanups.
This commit is contained in:
@@ -138,7 +138,7 @@ libffiDir.raspberrypi = libffi-3.2.1-2-raspberrypi
|
|||||||
linkerKonanFlags.raspberrypi = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread
|
linkerKonanFlags.raspberrypi = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread
|
||||||
# targetSysroot-relative.
|
# targetSysroot-relative.
|
||||||
libGcc.raspberrypi = lib/gcc/arm-linux-gnueabihf/4.8.3
|
libGcc.raspberrypi = lib/gcc/arm-linux-gnueabihf/4.8.3
|
||||||
llvmLtoFlags.raspberrypi =
|
llvmLtoFlags.raspberrypi = -float-abi=hard -mcpu=arm1136jf-s
|
||||||
llvmLtoOptFlags.raspberrypi = -O3 -function-sections
|
llvmLtoOptFlags.raspberrypi = -O3 -function-sections
|
||||||
llvmLtoNooptFlags.raspberrypi = -O1
|
llvmLtoNooptFlags.raspberrypi = -O1
|
||||||
dynamicLinker.raspberrypi = /lib/ld-linux-armhf.so.3
|
dynamicLinker.raspberrypi = /lib/ld-linux-armhf.so.3
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ void Kotlin_objc_release(void* ptr) {
|
|||||||
|
|
||||||
void* Kotlin_objc_lookUpClass(const char* name) {
|
void* Kotlin_objc_lookUpClass(const char* name) {
|
||||||
RuntimeAssert(false, "Objective-C interop is disabled");
|
RuntimeAssert(false, "Objective-C interop is disabled");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "cbigint.h"
|
#include "cbigint.h"
|
||||||
|
#include "../Exceptions.h"
|
||||||
#include "../KString.h"
|
#include "../KString.h"
|
||||||
#include "../Natives.h"
|
#include "../Natives.h"
|
||||||
#include "../Exceptions.h"
|
|
||||||
#include "../utf8.h"
|
#include "../utf8.h"
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX)
|
#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX)
|
||||||
#define USE_LL
|
#define USE_LL
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "cbigint.h"
|
#include "cbigint.h"
|
||||||
|
#include "../Exceptions.h"
|
||||||
#include "../KString.h"
|
#include "../KString.h"
|
||||||
#include "../Natives.h"
|
#include "../Natives.h"
|
||||||
#include "../Exceptions.h"
|
|
||||||
#include "../utf8.h"
|
#include "../utf8.h"
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(ZOS) || defined(AIX)
|
#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(ZOS) || defined(AIX)
|
||||||
#define USE_LL
|
#define USE_LL
|
||||||
@@ -39,13 +39,7 @@
|
|||||||
|
|
||||||
#define DEFAULT_WIDTH MAX_ACCURACY_WIDTH
|
#define DEFAULT_WIDTH MAX_ACCURACY_WIDTH
|
||||||
|
|
||||||
extern "C" {
|
extern "C" KFloat Konan_int_bits_to_float(KInt x) {
|
||||||
KFloat Konan_FloatingPointParser_parseFloatImpl (KString s, KInt e);
|
|
||||||
|
|
||||||
KFloat Konan_int_bits_to_float(KInt x);
|
|
||||||
}
|
|
||||||
|
|
||||||
KFloat Konan_int_bits_to_float(KInt x) {
|
|
||||||
union {
|
union {
|
||||||
int32_t x;
|
int32_t x;
|
||||||
float f;
|
float f;
|
||||||
@@ -73,6 +67,7 @@ static const U_32 tens[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define tenToTheE(e) (*((KFloat *) (tens + (e))))
|
#define tenToTheE(e) (*((KFloat *) (tens + (e))))
|
||||||
|
|
||||||
#define LOG5_OF_TWO_TO_THE_N 11
|
#define LOG5_OF_TWO_TO_THE_N 11
|
||||||
|
|
||||||
#define sizeOfTenToTheE(e) (((e) / 19) + 1)
|
#define sizeOfTenToTheE(e) (((e) / 19) + 1)
|
||||||
@@ -124,9 +119,7 @@ static const U_32 tens[] = {
|
|||||||
#define allocateU64(x, n) if (!((x) = (U_64*) konan::calloc(1, (n) * sizeof(U_64)))) goto OutOfMemory;
|
#define allocateU64(x, n) if (!((x) = (U_64*) konan::calloc(1, (n) * sizeof(U_64)))) goto OutOfMemory;
|
||||||
#define release(r) if ((r)) konan::free((r));
|
#define release(r) if ((r)) konan::free((r));
|
||||||
|
|
||||||
KFloat
|
KFloat createFloat(const char *s, KInt e) {
|
||||||
createFloat (const char *s, KInt e)
|
|
||||||
{
|
|
||||||
/* assumes s is a null terminated string with at least one
|
/* assumes s is a null terminated string with at least one
|
||||||
* character in it */
|
* character in it */
|
||||||
U_64 def[DEFAULT_WIDTH];
|
U_64 def[DEFAULT_WIDTH];
|
||||||
@@ -328,7 +321,7 @@ createFloat1 (U_64 * f, IDATA length, KInt e)
|
|||||||
if (e <= -309 || FLOAT_TO_INTBITS (result) == 0)
|
if (e <= -309 || FLOAT_TO_INTBITS (result) == 0)
|
||||||
FLOAT_TO_INTBITS (result) = MINIMUM_INTBITS;
|
FLOAT_TO_INTBITS (result) = MINIMUM_INTBITS;
|
||||||
|
|
||||||
return floatAlgorithm (f, length, e, (KFloat) result);
|
return floatAlgorithm (f, length, e, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
@@ -544,27 +537,24 @@ OutOfMemory:
|
|||||||
#pragma optimize("",on) /*restore optimizations */
|
#pragma optimize("",on) /*restore optimizations */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
KFloat
|
extern "C" KFloat
|
||||||
Konan_FloatingPointParser_parseFloatImpl (KString s, KInt e)
|
Konan_FloatingPointParser_parseFloatImpl(KString s, KInt e)
|
||||||
{
|
{
|
||||||
const KChar* utf16 = CharArrayAddressOfElementAt(s, 0);
|
const KChar* utf16 = CharArrayAddressOfElementAt(s, 0);
|
||||||
KStdString utf8;
|
KStdString utf8;
|
||||||
utf8::unchecked::utf16to8(utf16, utf16 + s->count_, back_inserter(utf8));
|
utf8::unchecked::utf16to8(utf16, utf16 + s->count_, back_inserter(utf8));
|
||||||
const char *str = utf8.c_str();
|
const char *str = utf8.c_str();
|
||||||
auto flt = createFloat (str, e);
|
auto flt = createFloat(str, e);
|
||||||
|
|
||||||
if (((I_32) FLOAT_TO_INTBITS (flt)) >= 0)
|
if (((I_32) FLOAT_TO_INTBITS (flt)) >= 0) {
|
||||||
{
|
return flt;
|
||||||
return flt;
|
} else if (((I_32) FLOAT_TO_INTBITS (flt)) == (I_32) - 1) {
|
||||||
}
|
/* NumberFormatException */
|
||||||
else if (((I_32) FLOAT_TO_INTBITS (flt)) == (I_32) - 1)
|
ThrowNumberFormatException();
|
||||||
{ /* NumberFormatException */
|
} else {
|
||||||
ThrowNumberFormatException();
|
/* OutOfMemoryError */
|
||||||
}
|
ThrowOutOfMemoryError();
|
||||||
else
|
}
|
||||||
{ /* OutOfMemoryError */
|
|
||||||
ThrowOutOfMemoryError();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.0;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user