Replaced TODO comments with messages ; More correct AVIAN_AOT_ONLY usage

This commit is contained in:
Alexey Pelykh 2013-01-28 20:51:35 +02:00
parent c5adad9dce
commit a78959a480
8 changed files with 72 additions and 50 deletions

View File

@ -80,8 +80,8 @@ namespace {
snprintf(errStr, 9, "%d", (int) err);
return errStr;
//TODO:
// The better way to do this, if I could figure out how to convert LPTSTR to char*
#pragma message("TODO")
// The better way to do this, if I could figure out how to convert LPTSTR to char*
//char* errStr;
//LPTSTR s;
//if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
@ -390,7 +390,7 @@ Locale getLocale() {
return Locale(lang, reg);
#else
//TODO: CultureInfo.CurrentCulture
#pragma message("TODO: CultureInfo.CurrentCulture")
return Locale("en", "US");
#endif
}
@ -596,8 +596,7 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
GetTempPath(MAX_PATH, buffer);
r = e->NewStringUTF(buffer);
# else
//TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/
//Windows.Storage.ApplicationData.Current.TemporaryFolder
#pragma message("TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/ Windows.Storage.ApplicationData.Current.TemporaryFolder")
r = 0;
# endif
} else if (strcmp(chars, "user.dir") == 0) {
@ -606,8 +605,7 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
GetCurrentDirectory(MAX_PATH, buffer);
r = e->NewStringUTF(buffer);
# else
//TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/
//Windows.ApplicationModel.Package.Current.InstalledLocation
#pragma message("TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/ Windows.ApplicationModel.Package.Current.InstalledLocation")
r = 0;
# endif
} else if (strcmp(chars, "user.home") == 0) {
@ -621,8 +619,7 @@ Java_java_lang_System_getProperty(JNIEnv* e, jclass, jstring name,
r = 0;
}
# else
//TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/
//Windows.Storage.KnownFolders.DocumentsLibrary;
#pragma message("TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/ Windows.Storage.KnownFolders.DocumentsLibrary")
r = 0;
# endif
# else

View File

@ -642,6 +642,7 @@ ifeq ($(platform),wp8)
use-lto = false
supports_avian_executable = false
process = compile
aot_only = true
ifneq ($(process),compile)
options := -$(process)
endif

View File

@ -18,7 +18,7 @@
using namespace vm;
namespace {
namespace local {
namespace isa {
// SYSTEM REGISTERS
@ -252,7 +252,7 @@ class MyBlock: public Assembler::Block {
this->start = start;
this->next = static_cast<MyBlock*>(next);
::resolve(this);
local::resolve(this);
return start + size + padding(this, size);
}
@ -2150,7 +2150,7 @@ class MyArchitecture: public Assembler::Architecture {
}
virtual unsigned argumentFootprint(unsigned footprint) {
return ::argumentFootprint(footprint);
return local::argumentFootprint(footprint);
}
virtual bool argumentAlignment() {
@ -2239,7 +2239,7 @@ class MyArchitecture: public Assembler::Architecture {
unsigned targetParameterFootprint, void** ip,
void** stack)
{
::nextFrame(&con, static_cast<uint32_t*>(start), size, footprint, link,
local::nextFrame(&con, static_cast<uint32_t*>(start), size, footprint, link,
mostRecent, targetParameterFootprint, ip, stack);
}
@ -2550,11 +2550,12 @@ class MyAssembler: public Assembler {
}
virtual void pushFrame(unsigned argumentCount, ...) {
struct {
struct Argument {
unsigned size;
OperandType type;
Operand* operand;
} arguments[argumentCount];
};
Argument* arguments = new Argument[argumentCount];
va_list a; va_start(a, argumentCount);
unsigned footprint = 0;
@ -2589,6 +2590,9 @@ class MyAssembler: public Assembler {
offset += ceiling(arguments[i].size, TargetBytesPerWord);
}
}
delete[] arguments;
arguments = 0;
}
virtual void allocateFrame(unsigned footprint) {
@ -2798,7 +2802,7 @@ class MyAssembler: public Assembler {
bool jump = needJump(b);
if (jump) {
write4
(dst + dstOffset, ::b((poolSize + TargetBytesPerWord - 8) >> 2));
(dst + dstOffset, isa::b((poolSize + TargetBytesPerWord - 8) >> 2));
}
dstOffset += poolSize + (jump ? TargetBytesPerWord : 0);
@ -2832,7 +2836,7 @@ class MyAssembler: public Assembler {
}
virtual Promise* offset(bool forTrace) {
return ::offset(&con, forTrace);
return local::offset(&con, forTrace);
}
virtual Block* endBlock(bool startNew) {
@ -2903,15 +2907,15 @@ namespace vm {
Assembler::Architecture*
makeArchitecture(System* system, bool)
{
return new (allocate(system, sizeof(MyArchitecture))) MyArchitecture(system);
return new (allocate(system, sizeof(local::MyArchitecture))) local::MyArchitecture(system);
}
Assembler*
makeAssembler(System* system, Allocator* allocator, Zone* zone,
Assembler::Architecture* architecture)
{
return new(zone) MyAssembler(system, allocator, zone,
static_cast<MyArchitecture*>(architecture));
return new(zone) local::MyAssembler(system, allocator, zone,
static_cast<local::MyArchitecture*>(architecture));
}
} // namespace vm

View File

@ -1,3 +1,15 @@
; Copyright (c) 2008-2011, 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.
;
; ORIGIN: https://github.com/gkvas/avian/tree/wince
AREA text, CODE, ARM
EXPORT vmNativeCall [FUNC]

View File

@ -7389,8 +7389,9 @@ finish(MyThread* t, FixedAllocator* allocator, Context* context)
{
trap();
}
#if !defined(AVIAN_AOT_ONLY)
syncInstructionCache(start, codeSize);
#endif
}
void
@ -9152,7 +9153,9 @@ class MyProcessor: public Processor {
virtual void dispose() {
if (codeAllocator.base) {
#if !defined(AVIAN_AOT_ONLY)
s->freeExecutable(codeAllocator.base, codeAllocator.capacity);
#endif
}
compilationHandlers->dispose(allocator);
@ -9313,11 +9316,13 @@ class MyProcessor: public Processor {
}
virtual void boot(Thread* t, BootImage* image, uint8_t* code) {
#if !defined(AVIAN_AOT_ONLY)
if (codeAllocator.base == 0) {
codeAllocator.base = static_cast<uint8_t*>
(s->tryAllocateExecutable(ExecutableAreaSizeInBytes));
codeAllocator.capacity = ExecutableAreaSizeInBytes;
}
#endif
if (image and code) {
local::boot(static_cast<MyThread*>(t), image, code);

View File

@ -97,13 +97,11 @@ class System {
virtual void disposeAll() = 0;
};
#if !defined(AVIAN_AOT_ONLY)
class SignalHandler {
public:
virtual bool handleSignal(void** ip, void** frame, void** stack,
void** thread) = 0;
};
#endif
class MonitorResource {
public:
@ -132,12 +130,10 @@ class System {
virtual Status make(Mutex**) = 0;
virtual Status make(Monitor**) = 0;
virtual Status make(Local**) = 0;
#if !defined(AVIAN_AOT_ONLY)
virtual Status handleSegFault(SignalHandler* handler) = 0;
virtual Status handleDivideByZero(SignalHandler* handler) = 0;
virtual Status visit(Thread* thread, Thread* target,
ThreadVisitor* visitor) = 0;
#endif
virtual uint64_t call(void* function, uintptr_t* arguments, uint8_t* types,
unsigned count, unsigned size,
unsigned returnType) = 0;

View File

@ -114,17 +114,15 @@ class MutexResource {
HANDLE m;
};
#if !defined(AVIAN_AOT_ONLY)
const unsigned SegFaultIndex = 0;
const unsigned DivideByZeroIndex = 1;
const unsigned HandlerCount = 2;
#endif
class MySystem;
MySystem* system;
#if !defined(AVIAN_AOT_ONLY)
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
LONG CALLBACK
handleException(LPEXCEPTION_POINTERS e);
#endif
@ -628,7 +626,7 @@ class MySystem: public System {
};
MySystem(const char* crashDumpDirectory):
#if !defined(AVIAN_AOT_ONLY)
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
oldHandler(0),
#endif
crashDumpDirectory(crashDumpDirectory)
@ -636,14 +634,12 @@ class MySystem: public System {
expect(this, system == 0);
system = this;
#if !defined(AVIAN_AOT_ONLY)
memset(handlers, 0, sizeof(handlers));
#endif
mutex = CreateMutex(0, false, 0);
assert(this, mutex);
}
#if !defined(AVIAN_AOT_ONLY)
bool findHandler() {
for (unsigned i = 0; i < HandlerCount; ++i) {
if (handlers[i]) return true;
@ -651,31 +647,38 @@ class MySystem: public System {
return false;
}
//TODO: http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.application.unhandledexception(v=vs.105).aspx
int registerHandler(System::SignalHandler* handler, int index) {
if (handler) {
handlers[index] = handler;
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
if (oldHandler == 0) {
#ifdef ARCH_x86_32
# ifdef ARCH_x86_32
oldHandler = SetUnhandledExceptionFilter(handleException);
#elif defined ARCH_x86_64
# elif defined ARCH_x86_64
AddVectoredExceptionHandler(1, handleException);
oldHandler = reinterpret_cast<LPTOP_LEVEL_EXCEPTION_FILTER>(1);
#endif
# endif
}
#else
#pragma message("TODO: http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.application.unhandledexception(v=vs.105).aspx")
#endif
return 0;
} else if (handlers[index]) {
handlers[index] = 0;
if (not findHandler()) {
#ifdef ARCH_x86_32
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# ifdef ARCH_x86_32
SetUnhandledExceptionFilter(oldHandler);
oldHandler = 0;
#elif defined ARCH_x86_64
# elif defined ARCH_x86_64
// do nothing, handlers are never "unregistered" anyway
#endif
# endif
#else
#pragma message("TODO: http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.application.unhandledexception(v=vs.105).aspx")
#endif
}
return 0;
@ -683,7 +686,7 @@ class MySystem: public System {
return 1;
}
}
#endif
virtual void* tryAllocate(unsigned sizeInBytes) {
return malloc(sizeInBytes);
}
@ -742,7 +745,6 @@ class MySystem: public System {
return 0;
}
#if !defined(AVIAN_AOT_ONLY)
virtual Status handleSegFault(SignalHandler* handler) {
return registerHandler(handler, SegFaultIndex);
}
@ -754,6 +756,7 @@ class MySystem: public System {
virtual Status visit(System::Thread* st UNUSED, System::Thread* sTarget,
ThreadVisitor* visitor)
{
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
assert(this, st != sTarget);
Thread* target = static_cast<Thread*>(sTarget);
@ -769,15 +772,15 @@ class MySystem: public System {
rv = GetThreadContext(target->thread, &context);
if (rv) {
#ifdef ARCH_x86_32
# ifdef ARCH_x86_32
visitor->visit(reinterpret_cast<void*>(context.Eip),
reinterpret_cast<void*>(context.Ebp),
reinterpret_cast<void*>(context.Esp));
#elif defined ARCH_x86_64
# elif defined ARCH_x86_64
visitor->visit(reinterpret_cast<void*>(context.Rip),
reinterpret_cast<void*>(context.Rbp),
reinterpret_cast<void*>(context.Rsp));
#endif
# endif
success = true;
}
@ -786,8 +789,11 @@ class MySystem: public System {
}
return (success ? 0 : 1);
}
#else
#pragma message("TODO: http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.windows.application.unhandledexception(v=vs.105).aspx")
return false;
#endif
}
virtual uint64_t call(void* function, uintptr_t* arguments, uint8_t* types,
unsigned count, unsigned size, unsigned returnType)
@ -917,8 +923,7 @@ class MySystem: public System {
return append(allocator, buffer, "\\", name);
}
#else
//TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/
//Windows.ApplicationModel.Package.Current.InstalledLocation
#pragma message("TODO:http://lunarfrog.com/blog/2012/05/21/winrt-folders-access/ Windows.ApplicationModel.Package.Current.InstalledLocation")
return name;
#endif
}
@ -1017,14 +1022,14 @@ class MySystem: public System {
}
HANDLE mutex;
#if !defined(AVIAN_AOT_ONLY)
SignalHandler* handlers[HandlerCount];
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
LPTOP_LEVEL_EXCEPTION_FILTER oldHandler;
#endif
const char* crashDumpDirectory;
};
#if !defined(AVIAN_AOT_ONLY)
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#pragma pack(push,4)
struct MINIDUMP_EXCEPTION_INFORMATION {

View File

@ -8,6 +8,8 @@ comment #
There is NO WARRANTY for this software. See license.txt for
details.
ORIGIN: https://github.com/gkvas/avian/tree/wince
#
.586