mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
move Allocator to include, properly namespaced
This commit is contained in:
parent
d95a8a9626
commit
52b23b8a6a
@ -12,11 +12,15 @@
|
|||||||
#define AVIAN_CODEGEN_ARCHITECTURE_H
|
#define AVIAN_CODEGEN_ARCHITECTURE_H
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
class Allocator;
|
|
||||||
class Zone;
|
class Zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace avian {
|
namespace avian {
|
||||||
|
|
||||||
|
namespace util {
|
||||||
|
class Allocator;
|
||||||
|
}
|
||||||
|
|
||||||
namespace codegen {
|
namespace codegen {
|
||||||
|
|
||||||
class Assembler;
|
class Assembler;
|
||||||
@ -125,7 +129,7 @@ virtual void planDestination
|
|||||||
unsigned bSize, const OperandMask& bMask,
|
unsigned bSize, const OperandMask& bMask,
|
||||||
unsigned cSize, OperandMask& cMask) = 0;
|
unsigned cSize, OperandMask& cMask) = 0;
|
||||||
|
|
||||||
virtual Assembler* makeAssembler(vm::Allocator*, vm::Zone*) = 0;
|
virtual Assembler* makeAssembler(util::Allocator*, vm::Zone*) = 0;
|
||||||
|
|
||||||
virtual void acquire() = 0;
|
virtual void acquire() = 0;
|
||||||
virtual void release() = 0;
|
virtual void release() = 0;
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#ifndef AVIAN_CODEGEN_PROMISE_H
|
#ifndef AVIAN_CODEGEN_PROMISE_H
|
||||||
#define AVIAN_CODEGEN_PROMISE_H
|
#define AVIAN_CODEGEN_PROMISE_H
|
||||||
|
|
||||||
#include "avian/allocator.h"
|
#include <avian/util/allocator.h>
|
||||||
|
#include <avian/util/abort.h>
|
||||||
|
#include <avian/system/system.h>
|
||||||
|
|
||||||
namespace avian {
|
namespace avian {
|
||||||
namespace codegen {
|
namespace codegen {
|
||||||
@ -102,8 +104,8 @@ class OffsetPromise: public Promise {
|
|||||||
|
|
||||||
class ListenPromise: public Promise {
|
class ListenPromise: public Promise {
|
||||||
public:
|
public:
|
||||||
ListenPromise(vm::System* s, vm::Allocator* allocator):
|
ListenPromise(vm::System* s, util::Allocator* allocator)
|
||||||
s(s), allocator(allocator), listener(0)
|
: s(s), allocator(allocator), listener(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual int64_t value() {
|
virtual int64_t value() {
|
||||||
@ -122,16 +124,18 @@ class ListenPromise: public Promise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vm::System* s;
|
vm::System* s;
|
||||||
vm::Allocator* allocator;
|
util::Allocator* allocator;
|
||||||
Listener* listener;
|
Listener* listener;
|
||||||
Promise* promise;
|
Promise* promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DelayedPromise: public ListenPromise {
|
class DelayedPromise: public ListenPromise {
|
||||||
public:
|
public:
|
||||||
DelayedPromise(vm::System* s, vm::Allocator* allocator, Promise* basis,
|
DelayedPromise(vm::System* s,
|
||||||
DelayedPromise* next):
|
util::Allocator* allocator,
|
||||||
ListenPromise(s, allocator), basis(basis), next(next)
|
Promise* basis,
|
||||||
|
DelayedPromise* next)
|
||||||
|
: ListenPromise(s, allocator), basis(basis), next(next)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual int64_t value() {
|
virtual int64_t value() {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#define HEAP_H
|
#define HEAP_H
|
||||||
|
|
||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include "avian/allocator.h"
|
#include <avian/util/allocator.h>
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ const unsigned TenureThreshold = 3;
|
|||||||
|
|
||||||
const unsigned FixieTenureThreshold = TenureThreshold + 2;
|
const unsigned FixieTenureThreshold = TenureThreshold + 2;
|
||||||
|
|
||||||
class Heap: public Allocator {
|
class Heap : public avian::util::Allocator {
|
||||||
public:
|
public:
|
||||||
enum CollectionType {
|
enum CollectionType {
|
||||||
MinorCollection,
|
MinorCollection,
|
||||||
@ -65,9 +65,10 @@ class Heap: public Allocator {
|
|||||||
virtual void collect(CollectionType type, unsigned footprint,
|
virtual void collect(CollectionType type, unsigned footprint,
|
||||||
int pendingAllocation) = 0;
|
int pendingAllocation) = 0;
|
||||||
virtual unsigned fixedFootprint(unsigned sizeInWords, bool objectMask) = 0;
|
virtual unsigned fixedFootprint(unsigned sizeInWords, bool objectMask) = 0;
|
||||||
virtual void* allocateFixed(Allocator* allocator, unsigned sizeInWords,
|
virtual void* allocateFixed(avian::util::Allocator* allocator,
|
||||||
|
unsigned sizeInWords,
|
||||||
bool objectMask) = 0;
|
bool objectMask) = 0;
|
||||||
virtual void* allocateImmortalFixed(Allocator* allocator,
|
virtual void* allocateImmortalFixed(avian::util::Allocator* allocator,
|
||||||
unsigned sizeInWords,
|
unsigned sizeInWords,
|
||||||
bool objectMask) = 0;
|
bool objectMask) = 0;
|
||||||
virtual void mark(void* p, unsigned offset, unsigned count) = 0;
|
virtual void mark(void* p, unsigned offset, unsigned count) = 0;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#define SYSTEM_H
|
#define SYSTEM_H
|
||||||
|
|
||||||
#include "avian/common.h"
|
#include "avian/common.h"
|
||||||
#include "avian/allocator.h"
|
#include <avian/util/allocator.h>
|
||||||
#include <avian/util/abort.h>
|
#include <avian/util/abort.h>
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
@ -139,7 +139,7 @@ class System : public avian::util::Aborter {
|
|||||||
virtual Status load(Library**, const char* name) = 0;
|
virtual Status load(Library**, const char* name) = 0;
|
||||||
virtual char pathSeparator() = 0;
|
virtual char pathSeparator() = 0;
|
||||||
virtual char fileSeparator() = 0;
|
virtual char fileSeparator() = 0;
|
||||||
virtual const char* toAbsolutePath(Allocator* allocator,
|
virtual const char* toAbsolutePath(avian::util::Allocator* allocator,
|
||||||
const char* name) = 0;
|
const char* name) = 0;
|
||||||
virtual int64_t now() = 0;
|
virtual int64_t now() = 0;
|
||||||
virtual void yield() = 0;
|
virtual void yield() = 0;
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
#ifndef AVIAN_UTIL_ABORT_H
|
#ifndef AVIAN_UTIL_ABORT_H
|
||||||
#define AVIAN_UTIL_ABORT_H
|
#define AVIAN_UTIL_ABORT_H
|
||||||
|
|
||||||
|
// TODO: remove reference back into the source directory!
|
||||||
|
// Note: this is needed for UNLIKELY
|
||||||
|
#include <avian/common.h>
|
||||||
|
|
||||||
namespace avian {
|
namespace avian {
|
||||||
namespace util {
|
namespace util {
|
||||||
|
|
||||||
|
34
include/avian/util/allocator.h
Normal file
34
include/avian/util/allocator.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/* Copyright (c) 2008-2013, 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. */
|
||||||
|
|
||||||
|
#ifndef AVIAN_UTIL_ALLOCATOR_H
|
||||||
|
#define AVIAN_UTIL_ALLOCATOR_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
namespace avian {
|
||||||
|
namespace util {
|
||||||
|
|
||||||
|
class Allocator {
|
||||||
|
public:
|
||||||
|
virtual void* tryAllocate(unsigned size) = 0;
|
||||||
|
virtual void* allocate(unsigned size) = 0;
|
||||||
|
virtual void free(const void* p, unsigned size) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace util
|
||||||
|
} // namespace avian
|
||||||
|
|
||||||
|
inline void* operator new(size_t size, avian::util::Allocator* allocator)
|
||||||
|
{
|
||||||
|
return allocator->allocate(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // AVIAN_UTIL_ALLOCATOR_H
|
@ -11,6 +11,11 @@
|
|||||||
#ifndef AVIAN_UTIL_LIST_H
|
#ifndef AVIAN_UTIL_LIST_H
|
||||||
#define AVIAN_UTIL_LIST_H
|
#define AVIAN_UTIL_LIST_H
|
||||||
|
|
||||||
|
#include "allocator.h"
|
||||||
|
|
||||||
|
namespace avian {
|
||||||
|
namespace util {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class List {
|
class List {
|
||||||
public:
|
public:
|
||||||
@ -32,4 +37,7 @@ public:
|
|||||||
List<T>* next;
|
List<T>* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AVIAN_UTIL_LIST_H
|
} // namespace util
|
||||||
|
} // namespace avian
|
||||||
|
|
||||||
|
#endif // AVIAN_UTIL_LIST_H
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "avian/target.h"
|
#include "avian/target.h"
|
||||||
|
|
||||||
#include <avian/util/math.h>
|
#include <avian/util/math.h>
|
||||||
|
#include <avian/util/allocator.h>
|
||||||
|
|
||||||
#undef max
|
#undef max
|
||||||
#undef min
|
#undef min
|
||||||
@ -23,13 +24,13 @@ namespace vm {
|
|||||||
|
|
||||||
class Vector {
|
class Vector {
|
||||||
public:
|
public:
|
||||||
Vector(System* s, Allocator* allocator, unsigned minimumCapacity):
|
Vector(System* s, avian::util::Allocator* allocator, unsigned minimumCapacity)
|
||||||
s(s),
|
: s(s),
|
||||||
allocator(allocator),
|
allocator(allocator),
|
||||||
data(0),
|
data(0),
|
||||||
position(0),
|
position(0),
|
||||||
capacity(0),
|
capacity(0),
|
||||||
minimumCapacity(minimumCapacity)
|
minimumCapacity(minimumCapacity)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~Vector() {
|
~Vector() {
|
||||||
@ -157,7 +158,7 @@ class Vector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
System* s;
|
System* s;
|
||||||
Allocator* allocator;
|
avian::util::Allocator* allocator;
|
||||||
uint8_t* data;
|
uint8_t* data;
|
||||||
unsigned position;
|
unsigned position;
|
||||||
unsigned capacity;
|
unsigned capacity;
|
||||||
|
@ -8,22 +8,18 @@
|
|||||||
There is NO WARRANTY for this software. See license.txt for
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
#ifndef ALLOCATOR_H
|
#ifndef APPEND_H
|
||||||
#define ALLOCATOR_H
|
#define APPEND_H
|
||||||
|
|
||||||
#include "avian/common.h"
|
#include <avian/common.h>
|
||||||
|
#include <avian/util/allocator.h>
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
class Allocator {
|
inline const char* append(avian::util::Allocator* allocator,
|
||||||
public:
|
const char* a,
|
||||||
virtual void* tryAllocate(unsigned size) = 0;
|
const char* b,
|
||||||
virtual void* allocate(unsigned size) = 0;
|
const char* c)
|
||||||
virtual void free(const void* p, unsigned size) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline const char*
|
|
||||||
append(Allocator* allocator, const char* a, const char* b, const char* c)
|
|
||||||
{
|
{
|
||||||
unsigned al = strlen(a);
|
unsigned al = strlen(a);
|
||||||
unsigned bl = strlen(b);
|
unsigned bl = strlen(b);
|
||||||
@ -35,8 +31,9 @@ append(Allocator* allocator, const char* a, const char* b, const char* c)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char*
|
inline const char* append(avian::util::Allocator* allocator,
|
||||||
append(Allocator* allocator, const char* a, const char* b)
|
const char* a,
|
||||||
|
const char* b)
|
||||||
{
|
{
|
||||||
unsigned al = strlen(a);
|
unsigned al = strlen(a);
|
||||||
unsigned bl = strlen(b);
|
unsigned bl = strlen(b);
|
||||||
@ -46,8 +43,7 @@ append(Allocator* allocator, const char* a, const char* b)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char*
|
inline const char* copy(avian::util::Allocator* allocator, const char* a)
|
||||||
copy(Allocator* allocator, const char* a)
|
|
||||||
{
|
{
|
||||||
unsigned al = strlen(a);
|
unsigned al = strlen(a);
|
||||||
char* p = static_cast<char*>(allocator->allocate(al + 1));
|
char* p = static_cast<char*>(allocator->allocate(al + 1));
|
||||||
@ -55,10 +51,6 @@ copy(Allocator* allocator, const char* a)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
inline void* operator new (size_t size, vm::Allocator* allocator) {
|
#endif // APPEND_H
|
||||||
return allocator->allocate(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif//ALLOCATOR_H
|
|
@ -13,7 +13,12 @@
|
|||||||
|
|
||||||
#include "avian/common.h"
|
#include "avian/common.h"
|
||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include "avian/allocator.h"
|
|
||||||
|
namespace avian {
|
||||||
|
namespace util {
|
||||||
|
class Allocator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
@ -174,12 +179,15 @@ class Finder {
|
|||||||
virtual void dispose() = 0;
|
virtual void dispose() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
AVIAN_EXPORT Finder*
|
AVIAN_EXPORT Finder* makeFinder(System* s,
|
||||||
makeFinder(System* s, Allocator* a, const char* path, const char* bootLibrary);
|
avian::util::Allocator* a,
|
||||||
|
const char* path,
|
||||||
|
const char* bootLibrary);
|
||||||
|
|
||||||
Finder*
|
Finder* makeFinder(System* s,
|
||||||
makeFinder(System* s, Allocator* a, const uint8_t* jarData,
|
avian::util::Allocator* a,
|
||||||
unsigned jarLength);
|
const uint8_t* jarData,
|
||||||
|
unsigned jarLength);
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "avian/lzma.h"
|
#include "avian/lzma.h"
|
||||||
#include "C/Types.h"
|
#include "C/Types.h"
|
||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include "avian/allocator.h"
|
#include "avian/util/allocator.h"
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
|
@ -12,17 +12,26 @@
|
|||||||
#define LZMA_H
|
#define LZMA_H
|
||||||
|
|
||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include "avian/allocator.h"
|
|
||||||
|
namespace avian {
|
||||||
|
namespace util {
|
||||||
|
class Allocator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
uint8_t*
|
uint8_t* decodeLZMA(System* s,
|
||||||
decodeLZMA(System* s, Allocator* a, uint8_t* in, unsigned inSize,
|
avian::util::Allocator* a,
|
||||||
unsigned* outSize);
|
uint8_t* in,
|
||||||
|
unsigned inSize,
|
||||||
|
unsigned* outSize);
|
||||||
|
|
||||||
uint8_t*
|
uint8_t* encodeLZMA(System* s,
|
||||||
encodeLZMA(System* s, Allocator* a, uint8_t* in, unsigned inSize,
|
avian::util::Allocator* a,
|
||||||
unsigned* outSize);
|
uint8_t* in,
|
||||||
|
unsigned inSize,
|
||||||
|
unsigned* outSize);
|
||||||
|
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "avian/common.h"
|
#include "avian/common.h"
|
||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include <avian/heap/heap.h>
|
#include <avian/heap/heap.h>
|
||||||
|
#include <avian/util/allocator.h>
|
||||||
#include "bootimage.h"
|
#include "bootimage.h"
|
||||||
#include "avian/heapwalk.h"
|
#include "avian/heapwalk.h"
|
||||||
#include "avian/zone.h"
|
#include "avian/zone.h"
|
||||||
@ -209,7 +210,7 @@ class Processor {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Processor* makeProcessor(System* system,
|
Processor* makeProcessor(System* system,
|
||||||
Allocator* allocator,
|
avian::util::Allocator* allocator,
|
||||||
const char* crashDumpDirectory,
|
const char* crashDumpDirectory,
|
||||||
bool useNativeFeatures);
|
bool useNativeFeatures);
|
||||||
|
|
||||||
|
@ -12,13 +12,12 @@
|
|||||||
#define ZONE_H
|
#define ZONE_H
|
||||||
|
|
||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include "avian/allocator.h"
|
#include <avian/util/allocator.h>
|
||||||
|
|
||||||
#include <avian/util/math.h>
|
#include <avian/util/math.h>
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
|
||||||
class Zone: public Allocator {
|
class Zone : public avian::util::Allocator {
|
||||||
public:
|
public:
|
||||||
class Segment {
|
class Segment {
|
||||||
public:
|
public:
|
||||||
|
@ -38,14 +38,14 @@ namespace isa {
|
|||||||
// HARDWARE FLAGS
|
// HARDWARE FLAGS
|
||||||
bool vfpSupported() {
|
bool vfpSupported() {
|
||||||
// TODO: Use at runtime detection
|
// TODO: Use at runtime detection
|
||||||
#if defined(__ARM_PCS_VFP)
|
#if defined(__ARM_PCS_VFP)
|
||||||
// armhf
|
// armhf
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
// armel
|
// armel
|
||||||
// TODO: allow VFP use for -mfloat-abi=softfp armel builds.
|
// TODO: allow VFP use for -mfloat-abi=softfp armel builds.
|
||||||
// GCC -mfloat-abi=softfp flag allows use of VFP while remaining compatible
|
// GCC -mfloat-abi=softfp flag allows use of VFP while remaining compatible
|
||||||
// with soft-float code.
|
// with soft-float code.
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -793,7 +793,7 @@ class MyAssembler: public Assembler {
|
|||||||
assert(&con, b.size == c.size);
|
assert(&con, b.size == c.size);
|
||||||
assert(&con, b.type == lir::RegisterOperand);
|
assert(&con, b.type == lir::RegisterOperand);
|
||||||
assert(&con, c.type == lir::RegisterOperand);
|
assert(&con, c.type == lir::RegisterOperand);
|
||||||
|
|
||||||
arch_->con.ternaryOperations[index(&(arch_->con), op, a.type)]
|
arch_->con.ternaryOperations[index(&(arch_->con), op, a.type)]
|
||||||
(&con, b.size, a.operand, b.operand, c.operand);
|
(&con, b.size, a.operand, b.operand, c.operand);
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,21 @@ namespace avian {
|
|||||||
namespace codegen {
|
namespace codegen {
|
||||||
namespace arm {
|
namespace arm {
|
||||||
|
|
||||||
Context::Context(vm::System* s, vm::Allocator* a, vm::Zone* zone):
|
Context::Context(vm::System* s, util::Allocator* a, vm::Zone* zone)
|
||||||
s(s), zone(zone), client(0), code(s, a, 1024), tasks(0), result(0),
|
: s(s),
|
||||||
firstBlock(new(zone) MyBlock(this, 0)),
|
zone(zone),
|
||||||
lastBlock(firstBlock), poolOffsetHead(0), poolOffsetTail(0),
|
client(0),
|
||||||
constantPool(0), constantPoolCount(0)
|
code(s, a, 1024),
|
||||||
{ }
|
tasks(0),
|
||||||
|
result(0),
|
||||||
|
firstBlock(new (zone) MyBlock(this, 0)),
|
||||||
|
lastBlock(firstBlock),
|
||||||
|
poolOffsetHead(0),
|
||||||
|
poolOffsetTail(0),
|
||||||
|
constantPool(0),
|
||||||
|
constantPoolCount(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace arm
|
} // namespace arm
|
||||||
} // namespace codegen
|
} // namespace codegen
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
class System;
|
class System;
|
||||||
class Allocator;
|
|
||||||
class Zone;
|
class Zone;
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
@ -25,6 +24,7 @@ namespace avian {
|
|||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
class Aborter;
|
class Aborter;
|
||||||
|
class Allocator;
|
||||||
} // namespace util
|
} // namespace util
|
||||||
|
|
||||||
namespace codegen {
|
namespace codegen {
|
||||||
@ -37,7 +37,7 @@ class ConstantPoolEntry;
|
|||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
public:
|
public:
|
||||||
Context(vm::System* s, vm::Allocator* a, vm::Zone* zone);
|
Context(vm::System* s, util::Allocator* a, vm::Zone* zone);
|
||||||
|
|
||||||
vm::System* s;
|
vm::System* s;
|
||||||
vm::Zone* zone;
|
vm::Zone* zone;
|
||||||
|
@ -586,7 +586,7 @@ class MyArchitecture: public Architecture {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Assembler* makeAssembler(Allocator* allocator, Zone* zone);
|
virtual Assembler* makeAssembler(util::Allocator* allocator, Zone* zone);
|
||||||
|
|
||||||
virtual void acquire() {
|
virtual void acquire() {
|
||||||
++ referenceCount;
|
++ referenceCount;
|
||||||
@ -604,8 +604,8 @@ class MyArchitecture: public Architecture {
|
|||||||
|
|
||||||
class MyAssembler: public Assembler {
|
class MyAssembler: public Assembler {
|
||||||
public:
|
public:
|
||||||
MyAssembler(System* s, Allocator* a, Zone* zone, MyArchitecture* arch):
|
MyAssembler(System* s, util::Allocator* a, Zone* zone, MyArchitecture* arch)
|
||||||
c(s, a, zone), arch_(arch)
|
: c(s, a, zone), arch_(arch)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual void setClient(Client* client) {
|
virtual void setClient(Client* client) {
|
||||||
@ -992,7 +992,8 @@ class MyAssembler: public Assembler {
|
|||||||
MyArchitecture* arch_;
|
MyArchitecture* arch_;
|
||||||
};
|
};
|
||||||
|
|
||||||
Assembler* MyArchitecture::makeAssembler(Allocator* allocator, Zone* zone) {
|
Assembler* MyArchitecture::makeAssembler(util::Allocator* allocator, Zone* zone)
|
||||||
|
{
|
||||||
return new(zone) MyAssembler(this->c.s, allocator, zone, this);
|
return new(zone) MyAssembler(this->c.s, allocator, zone, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,13 +16,21 @@ namespace avian {
|
|||||||
namespace codegen {
|
namespace codegen {
|
||||||
namespace powerpc {
|
namespace powerpc {
|
||||||
|
|
||||||
|
Context::Context(vm::System* s, util::Allocator* a, vm::Zone* zone)
|
||||||
Context::Context(vm::System* s, vm::Allocator* a, vm::Zone* zone):
|
: s(s),
|
||||||
s(s), zone(zone), client(0), code(s, a, 1024), tasks(0), result(0),
|
zone(zone),
|
||||||
firstBlock(new(zone) MyBlock(this, 0)),
|
client(0),
|
||||||
lastBlock(firstBlock), jumpOffsetHead(0), jumpOffsetTail(0),
|
code(s, a, 1024),
|
||||||
constantPool(0), constantPoolCount(0)
|
tasks(0),
|
||||||
{ }
|
result(0),
|
||||||
|
firstBlock(new (zone) MyBlock(this, 0)),
|
||||||
|
lastBlock(firstBlock),
|
||||||
|
jumpOffsetHead(0),
|
||||||
|
jumpOffsetTail(0),
|
||||||
|
constantPool(0),
|
||||||
|
constantPoolCount(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace powerpc
|
} // namespace powerpc
|
||||||
} // namespace codegen
|
} // namespace codegen
|
||||||
|
@ -20,12 +20,16 @@
|
|||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
class System;
|
class System;
|
||||||
class Allocator;
|
|
||||||
class Zone;
|
class Zone;
|
||||||
} // namespace vm
|
} // namespace vm
|
||||||
|
|
||||||
|
|
||||||
namespace avian {
|
namespace avian {
|
||||||
|
|
||||||
|
namespace util {
|
||||||
|
class Allocator;
|
||||||
|
}
|
||||||
|
|
||||||
namespace codegen {
|
namespace codegen {
|
||||||
namespace powerpc {
|
namespace powerpc {
|
||||||
|
|
||||||
@ -36,7 +40,7 @@ class MyBlock;
|
|||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
public:
|
public:
|
||||||
Context(vm::System* s, vm::Allocator* a, vm::Zone* zone);
|
Context(vm::System* s, util::Allocator* a, vm::Zone* zone);
|
||||||
|
|
||||||
vm::System* s;
|
vm::System* s;
|
||||||
vm::Zone* zone;
|
vm::Zone* zone;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "avian/target.h"
|
#include "avian/target.h"
|
||||||
#include "avian/alloc-vector.h"
|
#include "avian/alloc-vector.h"
|
||||||
#include "avian/common.h"
|
#include "avian/common.h"
|
||||||
#include "avian/allocator.h"
|
#include "avian/util/allocator.h"
|
||||||
#include "avian/zone.h"
|
#include "avian/zone.h"
|
||||||
|
|
||||||
#include <avian/util/runtime-array.h>
|
#include <avian/util/runtime-array.h>
|
||||||
@ -790,7 +790,7 @@ class MyArchitecture: public Architecture {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Assembler* makeAssembler(Allocator* allocator, Zone* zone);
|
virtual Assembler* makeAssembler(util::Allocator* allocator, Zone* zone);
|
||||||
|
|
||||||
virtual void acquire() {
|
virtual void acquire() {
|
||||||
++ referenceCount;
|
++ referenceCount;
|
||||||
@ -809,8 +809,8 @@ class MyArchitecture: public Architecture {
|
|||||||
|
|
||||||
class MyAssembler: public Assembler {
|
class MyAssembler: public Assembler {
|
||||||
public:
|
public:
|
||||||
MyAssembler(System* s, Allocator* a, Zone* zone, MyArchitecture* arch):
|
MyAssembler(System* s, util::Allocator* a, Zone* zone, MyArchitecture* arch)
|
||||||
c(s, a, zone, &(arch->c)), arch_(arch)
|
: c(s, a, zone, &(arch->c)), arch_(arch)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual void setClient(Client* client) {
|
virtual void setClient(Client* client) {
|
||||||
@ -1142,7 +1142,8 @@ class MyAssembler: public Assembler {
|
|||||||
MyArchitecture* arch_;
|
MyArchitecture* arch_;
|
||||||
};
|
};
|
||||||
|
|
||||||
Assembler* MyArchitecture::makeAssembler(Allocator* allocator, Zone* zone) {
|
Assembler* MyArchitecture::makeAssembler(util::Allocator* allocator, Zone* zone)
|
||||||
|
{
|
||||||
return
|
return
|
||||||
new(zone) MyAssembler(c.s, allocator, zone, this);
|
new(zone) MyAssembler(c.s, allocator, zone, this);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
There is NO WARRANTY for this software. See license.txt for
|
There is NO WARRANTY for this software. See license.txt for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "avian/allocator.h"
|
#include "avian/util/allocator.h"
|
||||||
#include "avian/zone.h"
|
#include "avian/zone.h"
|
||||||
|
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
@ -22,11 +22,21 @@ ArchitectureContext::ArchitectureContext(vm::System* s, bool useNativeFeatures):
|
|||||||
s(s), useNativeFeatures(useNativeFeatures)
|
s(s), useNativeFeatures(useNativeFeatures)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Context::Context(vm::System* s, vm::Allocator* a, vm::Zone* zone, ArchitectureContext* ac):
|
Context::Context(vm::System* s,
|
||||||
s(s), zone(zone), client(0), code(s, a, 1024), tasks(0), result(0),
|
util::Allocator* a,
|
||||||
firstBlock(new(zone) MyBlock(0)),
|
vm::Zone* zone,
|
||||||
lastBlock(firstBlock), ac(ac)
|
ArchitectureContext* ac)
|
||||||
{ }
|
: s(s),
|
||||||
|
zone(zone),
|
||||||
|
client(0),
|
||||||
|
code(s, a, 1024),
|
||||||
|
tasks(0),
|
||||||
|
result(0),
|
||||||
|
firstBlock(new (zone) MyBlock(0)),
|
||||||
|
lastBlock(firstBlock),
|
||||||
|
ac(ac)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace x86
|
} // namespace x86
|
||||||
} // namespace codegen
|
} // namespace codegen
|
||||||
|
@ -75,7 +75,10 @@ class ArchitectureContext {
|
|||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
public:
|
public:
|
||||||
Context(vm::System* s, vm::Allocator* a, vm::Zone* zone, ArchitectureContext* ac);
|
Context(vm::System* s,
|
||||||
|
util::Allocator* a,
|
||||||
|
vm::Zone* zone,
|
||||||
|
ArchitectureContext* ac);
|
||||||
|
|
||||||
vm::System* s;
|
vm::System* s;
|
||||||
vm::Zone* zone;
|
vm::Zone* zone;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "avian/allocator.h"
|
#include "avian/util/allocator.h"
|
||||||
#include "avian/alloc-vector.h"
|
#include "avian/alloc-vector.h"
|
||||||
#include "avian/common.h"
|
#include "avian/common.h"
|
||||||
#include "avian/zone.h"
|
#include "avian/zone.h"
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "avian/target.h"
|
#include "avian/target.h"
|
||||||
#include "avian/alloc-vector.h"
|
#include "avian/alloc-vector.h"
|
||||||
#include "avian/allocator.h"
|
#include "avian/util/allocator.h"
|
||||||
#include "avian/zone.h"
|
#include "avian/zone.h"
|
||||||
|
|
||||||
#include <avian/util/abort.h>
|
#include <avian/util/abort.h>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "avian/zlib-custom.h"
|
#include "avian/zlib-custom.h"
|
||||||
#include "avian/finder.h"
|
#include "avian/finder.h"
|
||||||
#include "avian/lzma.h"
|
#include "avian/lzma.h"
|
||||||
|
#include "avian/append.h"
|
||||||
|
|
||||||
using namespace vm;
|
using namespace vm;
|
||||||
using namespace avian::util;
|
using namespace avian::util;
|
||||||
|
@ -61,7 +61,7 @@ mainClass(const char* jar)
|
|||||||
|
|
||||||
System* system = makeSystem();
|
System* system = makeSystem();
|
||||||
|
|
||||||
class MyAllocator: public Allocator {
|
class MyAllocator : public avian::util::Allocator {
|
||||||
public:
|
public:
|
||||||
MyAllocator(System* s): s(s) { }
|
MyAllocator(System* s): s(s) { }
|
||||||
|
|
||||||
|
@ -48,7 +48,9 @@
|
|||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include "avian/arch.h"
|
|
||||||
|
#include <avian/arch.h>
|
||||||
|
#include <avian/append.h>
|
||||||
|
|
||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include <avian/system/signal.h>
|
#include <avian/system/signal.h>
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <avian/system/system.h>
|
#include <avian/system/system.h>
|
||||||
#include <avian/system/signal.h>
|
#include <avian/system/signal.h>
|
||||||
#include <avian/util/runtime-array.h>
|
#include <avian/util/runtime-array.h>
|
||||||
|
#include <avian/append.h>
|
||||||
|
|
||||||
#if defined(WINAPI_FAMILY)
|
#if defined(WINAPI_FAMILY)
|
||||||
|
|
||||||
@ -842,7 +843,9 @@ class MySystem: public System {
|
|||||||
return SO_SUFFIX;
|
return SO_SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* toAbsolutePath(Allocator* allocator, const char* name) {
|
virtual const char* toAbsolutePath(avian::util::Allocator* allocator,
|
||||||
|
const char* name)
|
||||||
|
{
|
||||||
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
if (strncmp(name, "//", 2) == 0
|
if (strncmp(name, "//", 2) == 0
|
||||||
or strncmp(name, "\\\\", 2) == 0
|
or strncmp(name, "\\\\", 2) == 0
|
||||||
|
@ -38,6 +38,7 @@ void operator delete(void*) { abort(); }
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using namespace avian::tools;
|
using namespace avian::tools;
|
||||||
|
using namespace avian::util;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
writeObject(uint8_t* data, size_t size, OutputStream* out, const char* startName,
|
writeObject(uint8_t* data, size_t size, OutputStream* out, const char* startName,
|
||||||
|
@ -1943,7 +1943,7 @@ main(int ac, char** av)
|
|||||||
|
|
||||||
System* system = makeSystem();
|
System* system = makeSystem();
|
||||||
|
|
||||||
class MyAllocator: public Allocator {
|
class MyAllocator : public avian::util::Allocator {
|
||||||
public:
|
public:
|
||||||
MyAllocator(System* s): s(s) { }
|
MyAllocator(System* s): s(s) { }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user