mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
Merge branch 'master' of oss:/var/local/git/avian into powerpc
This commit is contained in:
commit
8512d6c74c
@ -27,6 +27,8 @@
|
|||||||
# include "winbase.h"
|
# include "winbase.h"
|
||||||
# include "io.h"
|
# include "io.h"
|
||||||
# include "tchar.h"
|
# include "tchar.h"
|
||||||
|
# include "sys/types.h"
|
||||||
|
# include "sys/timeb.h"
|
||||||
# define SO_PREFIX ""
|
# define SO_PREFIX ""
|
||||||
#else
|
#else
|
||||||
# define SO_PREFIX "lib"
|
# define SO_PREFIX "lib"
|
||||||
@ -388,24 +390,9 @@ extern "C" JNIEXPORT jlong JNICALL
|
|||||||
Java_java_lang_System_currentTimeMillis(JNIEnv*, jclass)
|
Java_java_lang_System_currentTimeMillis(JNIEnv*, jclass)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static LARGE_INTEGER frequency;
|
_timeb tb;
|
||||||
static LARGE_INTEGER time;
|
_ftime(&tb);
|
||||||
static bool init = true;
|
return (static_cast<jlong>(tb.time) * 1000) + static_cast<jlong>(tb.millitm);
|
||||||
|
|
||||||
if (init) {
|
|
||||||
QueryPerformanceFrequency(&frequency);
|
|
||||||
|
|
||||||
if (frequency.QuadPart == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
init = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QueryPerformanceCounter(&time);
|
|
||||||
return static_cast<int64_t>
|
|
||||||
(((static_cast<double>(time.QuadPart)) * 1000.0) /
|
|
||||||
(static_cast<double>(frequency.QuadPart)));
|
|
||||||
#else
|
#else
|
||||||
timeval tv = { 0, 0 };
|
timeval tv = { 0, 0 };
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, 0);
|
||||||
|
48
classpath/java-util.cpp
Normal file
48
classpath/java-util.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* Copyright (c) 2008, Avian Contributors
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted, provided
|
||||||
|
that the above copyright notice and this permission notice appear
|
||||||
|
in all copies.
|
||||||
|
|
||||||
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
|
details. */
|
||||||
|
|
||||||
|
#include "time.h"
|
||||||
|
#include "jni.h"
|
||||||
|
#include "jni-util.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void
|
||||||
|
removeNewline(char* s)
|
||||||
|
{
|
||||||
|
for (; s; ++s) {
|
||||||
|
if (*s == '\n') {
|
||||||
|
*s = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jstring JNICALL
|
||||||
|
Java_java_util_Date_toString(JNIEnv* e, jclass c UNUSED, jlong when)
|
||||||
|
{
|
||||||
|
time_t time = when / 1000;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
e->MonitorEnter(c);
|
||||||
|
char* s = ctime(&time);
|
||||||
|
removeNewline(s);
|
||||||
|
jstring r = e->NewStringUTF(s);
|
||||||
|
e->MonitorExit(c);
|
||||||
|
return r;
|
||||||
|
#else
|
||||||
|
char buffer[27];
|
||||||
|
ctime_r(&time, buffer);
|
||||||
|
removeNewline(buffer);
|
||||||
|
return e->NewStringUTF(buffer);
|
||||||
|
#endif
|
||||||
|
}
|
@ -24,4 +24,10 @@ public class Date {
|
|||||||
public long getTime() {
|
public long getTime() {
|
||||||
return when;
|
return when;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return toString(when);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native String toString(long when);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
# define JNIEXPORT __attribute__ ((visibility("default")))
|
# define JNIEXPORT __attribute__ ((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define UNUSED __attribute__((unused))
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
|
2
makefile
2
makefile
@ -1,7 +1,7 @@
|
|||||||
MAKEFLAGS = -s
|
MAKEFLAGS = -s
|
||||||
|
|
||||||
name = avian
|
name = avian
|
||||||
version = 0.1
|
version = 0.1.1
|
||||||
|
|
||||||
build-arch = "$(shell uname -m)"
|
build-arch = "$(shell uname -m)"
|
||||||
ifeq ($(build-arch),"Power Macintosh")
|
ifeq ($(build-arch),"Power Macintosh")
|
||||||
|
@ -1212,7 +1212,7 @@ findInterfaceMethodFromInstance(MyThread* t, object method, object instance)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t
|
intptr_t FORCE_ALIGN
|
||||||
compareDoublesG(uint64_t bi, uint64_t ai)
|
compareDoublesG(uint64_t bi, uint64_t ai)
|
||||||
{
|
{
|
||||||
double a = bitsToDouble(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)
|
compareDoublesL(uint64_t bi, uint64_t ai)
|
||||||
{
|
{
|
||||||
double a = bitsToDouble(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)
|
compareFloatsG(uint32_t bi, uint32_t ai)
|
||||||
{
|
{
|
||||||
float a = bitsToFloat(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)
|
compareFloatsL(uint32_t bi, uint32_t ai)
|
||||||
{
|
{
|
||||||
float a = bitsToFloat(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)
|
addDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) + bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) + bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
subtractDouble(uint64_t b, uint64_t a)
|
subtractDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) - bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) - bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
multiplyDouble(uint64_t b, uint64_t a)
|
multiplyDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) * bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) * bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
divideDouble(uint64_t b, uint64_t a)
|
divideDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(bitsToDouble(a) / bitsToDouble(b));
|
return doubleToBits(bitsToDouble(a) / bitsToDouble(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
moduloDouble(uint64_t b, uint64_t a)
|
moduloDouble(uint64_t b, uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(fmod(bitsToDouble(a), bitsToDouble(b)));
|
return doubleToBits(fmod(bitsToDouble(a), bitsToDouble(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
negateDouble(uint64_t a)
|
negateDouble(uint64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(- bitsToDouble(a));
|
return doubleToBits(- bitsToDouble(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
doubleToFloat(int64_t a)
|
doubleToFloat(int64_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(static_cast<float>(bitsToDouble(a)));
|
return floatToBits(static_cast<float>(bitsToDouble(a)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t FORCE_ALIGN
|
||||||
doubleToInt(int64_t a)
|
doubleToInt(int64_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int32_t>(bitsToDouble(a));
|
return static_cast<int32_t>(bitsToDouble(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t FORCE_ALIGN
|
||||||
doubleToLong(int64_t a)
|
doubleToLong(int64_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int64_t>(bitsToDouble(a));
|
return static_cast<int64_t>(bitsToDouble(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
addFloat(uint32_t b, uint32_t a)
|
addFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) + bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) + bitsToFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
subtractFloat(uint32_t b, uint32_t a)
|
subtractFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) - bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) - bitsToFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
multiplyFloat(uint32_t b, uint32_t a)
|
multiplyFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) * bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) * bitsToFloat(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
divideFloat(uint32_t b, uint32_t a)
|
divideFloat(uint32_t b, uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(bitsToFloat(a) / bitsToFloat(b));
|
return floatToBits(bitsToFloat(a) / bitsToFloat(b));
|
||||||
@ -1364,7 +1364,7 @@ moduloFloat(uint32_t b, uint32_t a)
|
|||||||
return floatToBits(fmod(bitsToFloat(a), bitsToFloat(b)));
|
return floatToBits(fmod(bitsToFloat(a), bitsToFloat(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
negateFloat(uint32_t a)
|
negateFloat(uint32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(- bitsToFloat(a));
|
return floatToBits(- bitsToFloat(a));
|
||||||
@ -1382,43 +1382,43 @@ moduloLong(int64_t b, int64_t a)
|
|||||||
return a % b;
|
return a % b;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
floatToDouble(int32_t a)
|
floatToDouble(int32_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(static_cast<double>(bitsToFloat(a)));
|
return doubleToBits(static_cast<double>(bitsToFloat(a)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t FORCE_ALIGN
|
||||||
floatToInt(int32_t a)
|
floatToInt(int32_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int32_t>(bitsToFloat(a));
|
return static_cast<int32_t>(bitsToFloat(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t
|
int64_t FORCE_ALIGN
|
||||||
floatToLong(int32_t a)
|
floatToLong(int32_t a)
|
||||||
{
|
{
|
||||||
return static_cast<int64_t>(bitsToFloat(a));
|
return static_cast<int64_t>(bitsToFloat(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
intToDouble(int32_t a)
|
intToDouble(int32_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(static_cast<double>(a));
|
return doubleToBits(static_cast<double>(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
intToFloat(int32_t a)
|
intToFloat(int32_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(static_cast<float>(a));
|
return floatToBits(static_cast<float>(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t FORCE_ALIGN
|
||||||
longToDouble(int64_t a)
|
longToDouble(int64_t a)
|
||||||
{
|
{
|
||||||
return doubleToBits(static_cast<double>(a));
|
return doubleToBits(static_cast<double>(a));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t FORCE_ALIGN
|
||||||
longToFloat(int64_t a)
|
longToFloat(int64_t a)
|
||||||
{
|
{
|
||||||
return floatToBits(static_cast<float>(a));
|
return floatToBits(static_cast<float>(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,
|
lookUpAddress(int32_t key, uintptr_t* start, int32_t count,
|
||||||
uintptr_t default_)
|
uintptr_t default_)
|
||||||
{
|
{
|
||||||
|
@ -2221,7 +2221,7 @@ isAssignableFrom(Thread* t, object a, object b)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool FORCE_ALIGN
|
||||||
instanceOf(Thread* t, object class_, object o)
|
instanceOf(Thread* t, object class_, object o)
|
||||||
{
|
{
|
||||||
if (o == 0) {
|
if (o == 0) {
|
||||||
|
@ -1507,7 +1507,7 @@ mark(Thread* t, object o, unsigned offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void FORCE_ALIGN
|
||||||
set(Thread* t, object target, unsigned offset, object value)
|
set(Thread* t, object target, unsigned offset, object value)
|
||||||
{
|
{
|
||||||
cast<object>(target, offset) = value;
|
cast<object>(target, offset) = value;
|
||||||
|
@ -1825,10 +1825,10 @@ longCompareCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
|||||||
|
|
||||||
int64_t v = a->value->value();
|
int64_t v = a->value->value();
|
||||||
|
|
||||||
ResolvedPromise low(v & 0xFFFFFFFF);
|
ResolvedPromise low(v & ~static_cast<uintptr_t>(0));
|
||||||
Assembler::Constant al(&low);
|
Assembler::Constant al(&low);
|
||||||
|
|
||||||
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
ResolvedPromise high((v >> 32) & ~static_cast<uintptr_t>(0));
|
||||||
Assembler::Constant ah(&high);
|
Assembler::Constant ah(&high);
|
||||||
|
|
||||||
Assembler::Register bh(b->high);
|
Assembler::Register bh(b->high);
|
||||||
|
Loading…
Reference in New Issue
Block a user