mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
Merge branch 'master' into wip
Conflicts: src/codegen/compiler/event.cpp src/codegen/x86/assembler.cpp src/common.h
This commit is contained in:
commit
1f0833252d
@ -15,7 +15,7 @@
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
#undef JNIEXPORT
|
||||
|
||||
|
@ -11,6 +11,9 @@
|
||||
#ifndef AVIAN_UTIL_ABORT_H
|
||||
#define AVIAN_UTIL_ABORT_H
|
||||
|
||||
namespace avian {
|
||||
namespace util {
|
||||
|
||||
class Aborter {
|
||||
public:
|
||||
virtual void NO_RETURN abort() = 0;
|
||||
@ -37,5 +40,8 @@ inline void assert(T t, bool v) {
|
||||
expect(t, v);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace util
|
||||
} // namespace avian
|
||||
|
||||
#endif // AVIAN_UTIL_ABORT_H
|
||||
#endif // AVIAN_UTIL_ABORT_H
|
53
include/avian/util/math.h
Normal file
53
include/avian/util/math.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* Copyright (c) 2008-2012, 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_MATH_H
|
||||
#define AVIAN_UTIL_MATH_H
|
||||
|
||||
namespace avian {
|
||||
namespace util {
|
||||
|
||||
inline unsigned max(unsigned a, unsigned b) {
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
||||
inline unsigned min(unsigned a, unsigned b) {
|
||||
return (a < b ? a : b);
|
||||
}
|
||||
|
||||
inline unsigned avg(unsigned a, unsigned b) {
|
||||
return (a + b) / 2;
|
||||
}
|
||||
|
||||
inline unsigned ceilingDivide(unsigned n, unsigned d) {
|
||||
return (n + d - 1) / d;
|
||||
}
|
||||
|
||||
inline bool powerOfTwo(unsigned n) {
|
||||
for (; n > 2; n >>= 1) if (n & 1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline unsigned nextPowerOfTwo(unsigned n) {
|
||||
unsigned r = 1;
|
||||
while (r < n) r <<= 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
inline unsigned log(unsigned n) {
|
||||
unsigned r = 0;
|
||||
for (unsigned i = 1; i < n; ++r) i <<= 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace avian
|
||||
|
||||
#endif // AVIAN_UTIL_MATH_H
|
@ -14,8 +14,8 @@
|
||||
#include "system.h"
|
||||
#include "zone.h"
|
||||
|
||||
#include "codegen/lir.h"
|
||||
#include "codegen/promise.h"
|
||||
#include <avian/vm/codegen/lir.h>
|
||||
#include <avian/vm/codegen/promise.h>
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
@ -11,7 +11,7 @@
|
||||
#ifndef AVIAN_CODEGEN_TARGETS_H
|
||||
#define AVIAN_CODEGEN_TARGETS_H
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
29
makefile
29
makefile
@ -214,7 +214,7 @@ warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self \
|
||||
target-cflags = -DTARGET_BYTES_PER_WORD=$(pointer-size)
|
||||
|
||||
common-cflags = $(warnings) -fno-rtti -fno-exceptions -I$(classpath-src) \
|
||||
"-I$(JAVA_HOME)/include" -idirafter $(src) -I$(build) $(classpath-cflags) \
|
||||
"-I$(JAVA_HOME)/include" -idirafter $(src) -I$(build) -Iinclude $(classpath-cflags) \
|
||||
-D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \
|
||||
-DAVIAN_INFO="\"$(info)\"" \
|
||||
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
|
||||
@ -232,7 +232,7 @@ endif
|
||||
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
||||
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
|
||||
|
||||
converter-cflags = -D__STDC_CONSTANT_MACROS -Isrc/binaryToObject -Isrc/ \
|
||||
converter-cflags = -D__STDC_CONSTANT_MACROS -Iinclude/ -Isrc/ \
|
||||
-fno-rtti -fno-exceptions \
|
||||
-DAVIAN_TARGET_ARCH=AVIAN_ARCH_UNKNOWN \
|
||||
-DAVIAN_TARGET_FORMAT=AVIAN_FORMAT_UNKNOWN \
|
||||
@ -1133,18 +1133,20 @@ generator-lzma-objects = \
|
||||
$(call generator-c-objects,$(lzma-decode-sources),$(lzma)/C,$(build))
|
||||
generator = $(build)/generator
|
||||
|
||||
converter-depends = \
|
||||
$(src)/binaryToObject/tools.h \
|
||||
$(src)/binaryToObject/endianness.h
|
||||
all-depends = $(shell find include -name '*.h')
|
||||
|
||||
converter-sources = \
|
||||
$(src)/binaryToObject/tools.cpp \
|
||||
$(src)/binaryToObject/elf.cpp \
|
||||
$(src)/binaryToObject/mach-o.cpp \
|
||||
$(src)/binaryToObject/pe.cpp
|
||||
object-writer-depends = $(shell find $(src)/tools/object-writer -name '*.h')
|
||||
object-writer-sources = $(shell find $(src)/tools/object-writer -name '*.cpp')
|
||||
object-writer-objects = $(call cpp-objects,$(object-writer-sources),$(src),$(build))
|
||||
|
||||
converter-tool-sources = \
|
||||
$(src)/binaryToObject/main.cpp
|
||||
binary-to-object-depends = $(shell find $(src)/tools/binary-to-object/ -name '*.h')
|
||||
binary-to-object-sources = $(shell find $(src)/tools/binary-to-object/ -name '*.cpp')
|
||||
binary-to-object-objects = $(call cpp-objects,$(binary-to-object-sources),$(src),$(build))
|
||||
|
||||
converter-sources = $(object-writer-sources)
|
||||
|
||||
converter-tool-depends = $(binary-to-object-depends) $(all-depends)
|
||||
converter-tool-sources = $(binary-to-object-sources)
|
||||
|
||||
converter-objects = $(call cpp-objects,$(converter-sources),$(src),$(build))
|
||||
converter-tool-objects = $(call cpp-objects,$(converter-tool-sources),$(src),$(build))
|
||||
@ -1517,11 +1519,12 @@ $(boot-object): $(boot-source)
|
||||
$(boot-javahome-object): $(src)/boot-javahome.cpp
|
||||
$(compile-object)
|
||||
|
||||
$(converter-objects) $(converter-tool-objects): $(build)/binaryToObject/%.o: $(src)/binaryToObject/%.cpp $(converter-depends)
|
||||
$(object-writer-objects) $(binary-to-object-objects): $(build)/%.o: $(src)/%.cpp $(binary-to-object-depends) $(object-writer-depends) $(all-depends)
|
||||
@mkdir -p $(dir $(@))
|
||||
$(build-cxx) $(converter-cflags) -c $(<) -o $(@)
|
||||
|
||||
$(converter): $(converter-objects) $(converter-tool-objects)
|
||||
@mkdir -p $(dir $(@))
|
||||
$(build-cc) $(^) -g -o $(@)
|
||||
|
||||
$(lzma-encoder-objects): $(build)/lzma/%.o: $(src)/lzma/%.cpp
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "system.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <avian/util/math.h>
|
||||
|
||||
namespace vm {
|
||||
|
||||
class Vector {
|
||||
@ -51,8 +53,8 @@ class Vector {
|
||||
if (position + space > capacity) {
|
||||
assert(s, minimumCapacity >= 0);
|
||||
|
||||
unsigned newCapacity = max
|
||||
(position + space, max(minimumCapacity, capacity * 2));
|
||||
unsigned newCapacity = avian::util::max
|
||||
(position + space, avian::util::max(minimumCapacity, capacity * 2));
|
||||
uint8_t* newData = static_cast<uint8_t*>
|
||||
(allocator->allocate(newCapacity));
|
||||
if (data) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "common.h"
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include "libkern/OSAtomic.h"
|
||||
|
@ -9,13 +9,13 @@ const unsigned NAME(BootHeapOffset) = 1 << (NAME(BootShift) + 1);
|
||||
inline unsigned
|
||||
LABEL(codeMapSize)(unsigned codeSize)
|
||||
{
|
||||
return ceilingDivide(codeSize, TargetBitsPerWord) * TargetBytesPerWord;
|
||||
return avian::util::ceilingDivide(codeSize, TargetBitsPerWord) * TargetBytesPerWord;
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
LABEL(heapMapSize)(unsigned heapSize)
|
||||
{
|
||||
return ceilingDivide(heapSize, TargetBitsPerWord * TargetBytesPerWord)
|
||||
return avian::util::ceilingDivide(heapSize, TargetBitsPerWord * TargetBytesPerWord)
|
||||
* TargetBytesPerWord;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "heap/heap.h"
|
||||
#include <avian/vm/heap/heap.h>
|
||||
#include "heapwalk.h"
|
||||
#include "common.h"
|
||||
#include "machine.h"
|
||||
@ -17,7 +17,7 @@
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/promise.h"
|
||||
#include "target.h"
|
||||
#include "binaryToObject/tools.h"
|
||||
#include <avian/tools/object-writer/tools.h>
|
||||
#include "lzma.h"
|
||||
|
||||
#include "util/arg-parser.h"
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "target.h"
|
||||
#include "machine.h"
|
||||
|
||||
#include <avian/util/math.h>
|
||||
|
||||
namespace vm {
|
||||
|
||||
class BootImage {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "processor.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
using namespace vm;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "classpath-common.h"
|
||||
#include "process.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
using namespace vm;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "tokenizer.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
namespace vm {
|
||||
|
||||
|
@ -8,13 +8,13 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/registers.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include <avian/vm/codegen/registers.h>
|
||||
|
||||
#include "alloc-vector.h"
|
||||
#include "util/abort.h"
|
||||
#include <avian/util/abort.h>
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
|
||||
#define CAST2(x) reinterpret_cast<BinaryOperationType>(x)
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
using namespace vm;
|
||||
using namespace avian::codegen;
|
||||
using namespace avian::util;
|
||||
|
||||
namespace local {
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
#include "target.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
#include "codegen/compiler.h"
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/promise.h"
|
||||
#include <avian/vm/codegen/compiler.h>
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include <avian/vm/codegen/promise.h>
|
||||
|
||||
#include "codegen/compiler/regalloc.h"
|
||||
#include "codegen/compiler/context.h"
|
||||
|
@ -11,10 +11,12 @@
|
||||
#ifndef AVIAN_CODEGEN_COMPILER_CONTEXT_H
|
||||
#define AVIAN_CODEGEN_COMPILER_CONTEXT_H
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/compiler.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include <avian/vm/codegen/compiler.h>
|
||||
|
||||
#include "codegen/compiler/regalloc.h"
|
||||
#include "regalloc.h"
|
||||
|
||||
using namespace avian::util;
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
@ -9,7 +9,8 @@
|
||||
details. */
|
||||
|
||||
#include "target.h"
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
#include <avian/util/math.h>
|
||||
|
||||
#include "codegen/compiler/context.h"
|
||||
#include "codegen/compiler/event.h"
|
||||
@ -20,6 +21,8 @@
|
||||
#include "codegen/compiler/frame.h"
|
||||
#include "codegen/compiler/ir.h"
|
||||
|
||||
using namespace avian::util;
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
namespace compiler {
|
||||
@ -917,11 +920,11 @@ appendCombine(Context* c, lir::TernaryOperation type,
|
||||
intptr_t handler = c->client->getThunk
|
||||
(type, firstSize, resultSize, &threadParameter);
|
||||
|
||||
unsigned stackSize = vm::ceilingDivide(secondSize, vm::TargetBytesPerWord)
|
||||
+ vm::ceilingDivide(firstSize, vm::TargetBytesPerWord);
|
||||
unsigned stackSize = ceilingDivide(secondSize, vm::TargetBytesPerWord)
|
||||
+ ceilingDivide(firstSize, vm::TargetBytesPerWord);
|
||||
|
||||
compiler::push(c, vm::ceilingDivide(secondSize, vm::TargetBytesPerWord), secondValue);
|
||||
compiler::push(c, vm::ceilingDivide(firstSize, vm::TargetBytesPerWord), firstValue);
|
||||
compiler::push(c, ceilingDivide(secondSize, vm::TargetBytesPerWord), secondValue);
|
||||
compiler::push(c, ceilingDivide(firstSize, vm::TargetBytesPerWord), firstValue);
|
||||
|
||||
if (threadParameter) {
|
||||
++ stackSize;
|
||||
@ -1041,7 +1044,7 @@ appendTranslate(Context* c, lir::BinaryOperation type, unsigned firstSize,
|
||||
if (thunk) {
|
||||
Stack* oldStack = c->stack;
|
||||
|
||||
compiler::push(c, vm::ceilingDivide(firstSize, vm::TargetBytesPerWord), firstValue);
|
||||
compiler::push(c, ceilingDivide(firstSize, vm::TargetBytesPerWord), firstValue);
|
||||
|
||||
Stack* argumentStack = c->stack;
|
||||
c->stack = oldStack;
|
||||
@ -1051,7 +1054,7 @@ appendTranslate(Context* c, lir::BinaryOperation type, unsigned firstSize,
|
||||
(c, lir::ValueGeneral, constantSite
|
||||
(c, c->client->getThunk(type, firstSize, resultSize))),
|
||||
0, 0, resultValue, resultSize, argumentStack,
|
||||
vm::ceilingDivide(firstSize, vm::TargetBytesPerWord), 0);
|
||||
ceilingDivide(firstSize, vm::TargetBytesPerWord), 0);
|
||||
} else {
|
||||
append(c, new(c->zone)
|
||||
TranslateEvent
|
||||
@ -1398,8 +1401,8 @@ appendBranch(Context* c, lir::TernaryOperation type, unsigned size, Value* first
|
||||
|
||||
assert(c, not threadParameter);
|
||||
|
||||
compiler::push(c, vm::ceilingDivide(size, vm::TargetBytesPerWord), secondValue);
|
||||
compiler::push(c, vm::ceilingDivide(size, vm::TargetBytesPerWord), firstValue);
|
||||
compiler::push(c, ceilingDivide(size, vm::TargetBytesPerWord), secondValue);
|
||||
compiler::push(c, ceilingDivide(size, vm::TargetBytesPerWord), firstValue);
|
||||
|
||||
Stack* argumentStack = c->stack;
|
||||
c->stack = oldStack;
|
||||
@ -1408,7 +1411,7 @@ appendBranch(Context* c, lir::TernaryOperation type, unsigned size, Value* first
|
||||
appendCall
|
||||
(c, value
|
||||
(c, lir::ValueGeneral, constantSite(c, handler)), 0, 0, result, 4,
|
||||
argumentStack, vm::ceilingDivide(size, vm::TargetBytesPerWord) * 2, 0);
|
||||
argumentStack, ceilingDivide(size, vm::TargetBytesPerWord) * 2, 0);
|
||||
|
||||
appendBranch(c, thunkBranch(c, type), 4, value
|
||||
(c, lir::ValueGeneral, constantSite(c, static_cast<int64_t>(0))),
|
||||
|
@ -13,15 +13,20 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "codegen/lir.h"
|
||||
#include "codegen/registers.h"
|
||||
|
||||
class Aborter;
|
||||
#include <avian/vm/codegen/lir.h>
|
||||
#include <avian/vm/codegen/registers.h>
|
||||
|
||||
namespace avian {
|
||||
|
||||
namespace util {
|
||||
class Aborter;
|
||||
} // namespace util
|
||||
|
||||
namespace codegen {
|
||||
namespace compiler {
|
||||
|
||||
using namespace avian::util;
|
||||
|
||||
class Context;
|
||||
class Value;
|
||||
class SiteMask;
|
||||
|
@ -11,9 +11,8 @@
|
||||
#ifndef AVIAN_CODEGEN_COMPILER_VALUE_H
|
||||
#define AVIAN_CODEGEN_COMPILER_VALUE_H
|
||||
|
||||
#include "codegen/lir.h"
|
||||
|
||||
#include "codegen/compiler.h"
|
||||
#include <avian/vm/codegen/lir.h>
|
||||
#include <avian/vm/codegen/compiler.h>
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
@ -8,11 +8,11 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/registers.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include <avian/vm/codegen/registers.h>
|
||||
|
||||
#include "alloc-vector.h"
|
||||
#include "util/abort.h"
|
||||
#include <avian/util/abort.h>
|
||||
|
||||
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
|
||||
#define CAST2(x) reinterpret_cast<BinaryOperationType>(x)
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
using namespace vm;
|
||||
using namespace avian::codegen;
|
||||
using namespace avian::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "codegen/registers.h"
|
||||
#include <avian/vm/codegen/registers.h>
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
@ -8,7 +8,8 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "codegen/targets.h"
|
||||
#include <avian/vm/codegen/targets.h>
|
||||
|
||||
#include "environment.h"
|
||||
|
||||
namespace avian {
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "target.h"
|
||||
#include "alloc-vector.h"
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/registers.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include <avian/vm/codegen/registers.h>
|
||||
|
||||
#include "codegen/x86/context.h"
|
||||
#include "codegen/x86/block.h"
|
||||
@ -25,14 +25,15 @@
|
||||
#include "codegen/x86/detect.h"
|
||||
#include "codegen/x86/multimethod.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include "util/abort.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
#include <avian/util/abort.h>
|
||||
|
||||
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
|
||||
#define CAST2(x) reinterpret_cast<BinaryOperationType>(x)
|
||||
#define CAST_BRANCH(x) reinterpret_cast<BranchOperationType>(x)
|
||||
|
||||
using namespace vm;
|
||||
using namespace avian::util;
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef AVIAN_CODEGEN_ASSEMBLER_X86_BLOCK_H
|
||||
#define AVIAN_CODEGEN_ASSEMBLER_X86_BLOCK_H
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
@ -15,12 +15,10 @@
|
||||
#define CAST2(x) reinterpret_cast<BinaryOperationType>(x)
|
||||
#define CAST_BRANCH(x) reinterpret_cast<BranchOperationType>(x)
|
||||
|
||||
#include "codegen/lir.h"
|
||||
#include "codegen/assembler.h"
|
||||
#include <avian/vm/codegen/lir.h>
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include "alloc-vector.h"
|
||||
|
||||
class Aborter;
|
||||
|
||||
namespace vm {
|
||||
class System;
|
||||
class Allocator;
|
||||
@ -28,6 +26,11 @@ class Zone;
|
||||
} // namespace vm
|
||||
|
||||
namespace avian {
|
||||
|
||||
namespace util {
|
||||
class Aborter;
|
||||
} // namespace util
|
||||
|
||||
namespace codegen {
|
||||
namespace x86 {
|
||||
|
||||
@ -80,11 +83,11 @@ class Context {
|
||||
ArchitectureContext* ac;
|
||||
};
|
||||
|
||||
inline Aborter* getAborter(Context* c) {
|
||||
inline avian::util::Aborter* getAborter(Context* c) {
|
||||
return c->s;
|
||||
}
|
||||
|
||||
inline Aborter* getAborter(ArchitectureContext* c) {
|
||||
inline avian::util::Aborter* getAborter(ArchitectureContext* c) {
|
||||
return c->s;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef AVIAN_CODEGEN_ASSEMBLER_X86_DETECT_H
|
||||
#define AVIAN_CODEGEN_ASSEMBLER_X86_DETECT_H
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "codegen/x86/registers.h"
|
||||
#include "codegen/x86/fixup.h"
|
||||
|
||||
using namespace avian::util;
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
namespace x86 {
|
||||
@ -70,7 +72,7 @@ void modrm(Context* c, uint8_t mod, lir::Register* a, lir::Register* b) {
|
||||
}
|
||||
|
||||
void sib(Context* c, unsigned scale, int index, int base) {
|
||||
c->code.append((vm::log(scale) << 6) | (regCode(index) << 3) | regCode(base));
|
||||
c->code.append((util::log(scale) << 6) | (regCode(index) << 3) | regCode(base));
|
||||
}
|
||||
|
||||
void modrmSib(Context* c, int width, int a, int scale, int index, int base) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef AVIAN_CODEGEN_ASSEMBLER_X86_ENCODE_H
|
||||
#define AVIAN_CODEGEN_ASSEMBLER_X86_ENCODE_H
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include "codegen/x86/registers.h"
|
||||
|
||||
namespace avian {
|
||||
|
@ -8,7 +8,8 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
|
||||
#include "codegen/x86/context.h"
|
||||
#include "codegen/x86/fixup.h"
|
||||
#include "codegen/x86/padding.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "codegen/lir.h"
|
||||
#include <avian/vm/codegen/lir.h>
|
||||
|
||||
#include "codegen/x86/context.h"
|
||||
#include "codegen/x86/multimethod.h"
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "codegen/x86/padding.h"
|
||||
#include "codegen/x86/fixup.h"
|
||||
|
||||
using namespace avian::util;
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
namespace x86 {
|
||||
|
@ -8,7 +8,8 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
|
||||
#include "codegen/x86/context.h"
|
||||
#include "codegen/x86/fixup.h"
|
||||
#include "codegen/x86/padding.h"
|
||||
|
48
src/common.h
48
src/common.h
@ -296,24 +296,6 @@ const uintptr_t PointerMask
|
||||
|
||||
const unsigned LikelyPageSizeInBytes = 4 * 1024;
|
||||
|
||||
inline unsigned
|
||||
max(unsigned a, unsigned b)
|
||||
{
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
min(unsigned a, unsigned b)
|
||||
{
|
||||
return (a < b ? a : b);
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
avg(unsigned a, unsigned b)
|
||||
{
|
||||
return (a + b) / 2;
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
pad(unsigned n, unsigned alignment)
|
||||
{
|
||||
@ -338,27 +320,6 @@ padWord(uintptr_t n)
|
||||
return padWord(n, BytesPerWord);
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
ceilingDivide(unsigned n, unsigned d)
|
||||
{
|
||||
return (n + d - 1) / d;
|
||||
}
|
||||
|
||||
inline bool
|
||||
powerOfTwo(unsigned n)
|
||||
{
|
||||
for (; n > 2; n >>= 1) if (n & 1) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
nextPowerOfTwo(unsigned n)
|
||||
{
|
||||
unsigned r = 1;
|
||||
while (r < n) r <<= 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
inline bool fitsInInt8(int64_t v) {
|
||||
return v == static_cast<int8_t>(v);
|
||||
}
|
||||
@ -370,15 +331,6 @@ inline bool fitsInInt16(int64_t v) {
|
||||
inline bool fitsInInt32(int64_t v) {
|
||||
return v == static_cast<int32_t>(v);
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
log(unsigned n)
|
||||
{
|
||||
unsigned r = 0;
|
||||
for (unsigned i = 1; i < n; ++r) i <<= 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline unsigned
|
||||
wordOf(unsigned i)
|
||||
|
@ -13,12 +13,13 @@
|
||||
#include "alloc-vector.h"
|
||||
#include "process.h"
|
||||
#include "target.h"
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/compiler.h"
|
||||
#include "codegen/targets.h"
|
||||
#include "arch.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include <avian/vm/codegen/compiler.h>
|
||||
#include <avian/vm/codegen/targets.h>
|
||||
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
using namespace vm;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "finder.h"
|
||||
#include "lzma.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
using namespace vm;
|
||||
|
||||
|
@ -8,12 +8,15 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "heap/heap.h"
|
||||
#include <avian/vm/heap/heap.h>
|
||||
#include "system.h"
|
||||
#include "common.h"
|
||||
#include "arch.h"
|
||||
|
||||
#include <avian/util/math.h>
|
||||
|
||||
using namespace vm;
|
||||
using namespace avian::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "process.h"
|
||||
#include "arch.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
using namespace vm;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "processor.h"
|
||||
#include "constants.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
using namespace vm;
|
||||
|
||||
|
@ -17,7 +17,8 @@
|
||||
#include "arch.h"
|
||||
#include "lzma.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
#include <avian/util/math.h>
|
||||
|
||||
#if defined(PLATFORM_WINDOWS)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
@ -25,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
using namespace vm;
|
||||
using namespace avian::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -13,12 +13,14 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "system.h"
|
||||
#include "heap/heap.h"
|
||||
#include <avian/vm/heap/heap.h>
|
||||
#include "finder.h"
|
||||
#include "processor.h"
|
||||
#include "constants.h"
|
||||
#include "arch.h"
|
||||
|
||||
using namespace avian::util;
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
# define JNICALL __stdcall
|
||||
#else
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "system.h"
|
||||
#include "finder.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
#if (defined __MINGW32__) || (defined _MSC_VER)
|
||||
# define PATH_SEPARATOR ';'
|
||||
|
@ -51,10 +51,13 @@
|
||||
#include "arch.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <avian/util/math.h>
|
||||
|
||||
|
||||
#define ACQUIRE(x) MutexResource MAKE_NAME(mutexResource_) (x)
|
||||
|
||||
using namespace vm;
|
||||
using namespace avian::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "process.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
using namespace vm;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "system.h"
|
||||
#include "heap/heap.h"
|
||||
#include <avian/vm/heap/heap.h>
|
||||
#include "bootimage.h"
|
||||
#include "heapwalk.h"
|
||||
#include "zone.h"
|
||||
|
@ -13,11 +13,11 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "allocator.h"
|
||||
#include "util/abort.h"
|
||||
#include <avian/util/abort.h>
|
||||
|
||||
namespace vm {
|
||||
|
||||
class System : public Aborter {
|
||||
class System : public avian::util::Aborter {
|
||||
public:
|
||||
typedef intptr_t Status;
|
||||
|
||||
@ -165,7 +165,7 @@ allocate(System* s, unsigned size)
|
||||
#define ACQUIRE_MONITOR(t, m) \
|
||||
System::MonitorResource MAKE_NAME(monitorResource_) (t, m)
|
||||
|
||||
inline Aborter* getAborter(System* s) {
|
||||
inline avian::util::Aborter* getAborter(System* s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "tools.h"
|
||||
#include <avian/tools/object-writer/tools.h>
|
||||
|
||||
extern "C"
|
||||
void __cxa_pure_virtual() {
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "endianness.h"
|
||||
|
||||
#include "tools.h"
|
||||
#include <avian/tools/object-writer/tools.h>
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "endianness.h"
|
||||
|
||||
#include "tools.h"
|
||||
#include <avian/tools/object-writer/tools.h>
|
||||
|
||||
#define MH_MAGIC_64 0xfeedfacf
|
||||
#define MH_MAGIC 0xfeedface
|
@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tools.h"
|
||||
#include <avian/tools/object-writer/tools.h>
|
||||
|
||||
namespace {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tools.h"
|
||||
#include <avian/tools/object-writer/tools.h>
|
||||
|
||||
namespace avian {
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "arch.h"
|
||||
#include "system.h"
|
||||
#include "util/runtime-array.h"
|
||||
#include <avian/util/runtime-array.h>
|
||||
|
||||
#if defined(WINAPI_FAMILY)
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "system.h"
|
||||
#include "allocator.h"
|
||||
|
||||
#include <avian/util/math.h>
|
||||
|
||||
namespace vm {
|
||||
|
||||
class Zone: public Allocator {
|
||||
@ -59,8 +61,8 @@ class Zone: public Allocator {
|
||||
bool tryEnsure(unsigned space) {
|
||||
if (segment == 0 or segment->position + space > segment->size) {
|
||||
unsigned size = padToPage
|
||||
(max
|
||||
(space, max
|
||||
(avian::util::max
|
||||
(space, avian::util::max
|
||||
(minimumFootprint, segment == 0 ? 0 : segment->size * 2))
|
||||
+ sizeof(Segment));
|
||||
|
||||
|
@ -11,13 +11,13 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "heap/heap.h"
|
||||
#include <avian/vm/heap/heap.h>
|
||||
#include "system.h"
|
||||
#include "target.h"
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/targets.h"
|
||||
#include "codegen/lir.h"
|
||||
#include <avian/vm/codegen/assembler.h>
|
||||
#include <avian/vm/codegen/targets.h>
|
||||
#include <avian/vm/codegen/lir.h>
|
||||
|
||||
#include "test-harness.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user