Merge branch 'master' of https://github.com/ReadyTalk/avian into avian-droid-2

This commit is contained in:
Ilya Mizus 2014-03-19 00:17:22 +04:00
commit ffc439ad23
4 changed files with 0 additions and 198 deletions

View File

@ -163,29 +163,6 @@ class Memory: public Operand {
unsigned scale; unsigned scale;
}; };
class Instr {
public:
enum Opcode {
#define LIR_OP_0(x) OP_##x,
#define LIR_OP_1(x) OP_##x,
#define LIR_OP_2(x) OP_##x,
#define LIR_OP_3(x) OP_##x,
#include "lir-ops.inc.cpp"
#undef LIR_OP_0
#undef LIR_OP_1
#undef LIR_OP_2
#undef LIR_OP_3
};
static const char* opcodeName(Opcode op);
static Opcode opcodeFromNullary(Operation op);
static Opcode opcodeFromUnary(UnaryOperation op);
static Opcode opcodeFromBinary(BinaryOperation op);
static Opcode opcodeFromTernary(TernaryOperation op);
};
} // namespace lir } // namespace lir
} // namespace codegen } // namespace codegen
} // namespace avian } // namespace avian

View File

@ -1157,8 +1157,6 @@ all-assembler-sources = \
native-assembler-sources = $($(target-asm)-assembler-sources) native-assembler-sources = $($(target-asm)-assembler-sources)
audit-codegen-sources = $(wildcard $(src)/tools/audit-codegen/*.cpp)
all-codegen-target-sources = \ all-codegen-target-sources = \
$(compiler-sources) \ $(compiler-sources) \
$(native-assembler-sources) $(native-assembler-sources)
@ -1324,7 +1322,6 @@ dynamic-library = $(build)/$(so-prefix)jvm$(so-suffix)
executable-dynamic = $(build)/$(name)-dynamic$(exe-suffix) executable-dynamic = $(build)/$(name)-dynamic$(exe-suffix)
unittest-executable = $(build)/$(name)-unittest${exe-suffix} unittest-executable = $(build)/$(name)-unittest${exe-suffix}
audit-codegen-executable = $(build)/audit-codegen${exe-suffix}
ifneq ($(classpath),avian) ifneq ($(classpath),avian)
# Assembler, ConstantPool, and Stream are not technically needed for a # Assembler, ConstantPool, and Stream are not technically needed for a
@ -1488,14 +1485,6 @@ endif
jdk-test: $(test-dep) $(build)/classpath.jar $(build)/jdk-run-tests.sh $(build)/test.sh jdk-test: $(test-dep) $(build)/classpath.jar $(build)/jdk-run-tests.sh $(build)/test.sh
/bin/sh $(build)/jdk-run-tests.sh /bin/sh $(build)/jdk-run-tests.sh
PHONY: audit-baseline
audit-baseline: $(audit-codegen-executable)
$(<) -output $(build)/codegen-audit-output/baseline.o -format macho
PHONY: audit
audit: $(audit-codegen-executable)
$(<) -output $(build)/codegen-audit-output/baseline.o -format macho
.PHONY: tarball .PHONY: tarball
tarball: tarball:
@echo "creating build/avian-$(version).tar.bz2" @echo "creating build/avian-$(version).tar.bz2"
@ -1667,9 +1656,6 @@ endif
$(unittest-objects): $(build)/unittest/%.o: $(unittest)/%.cpp $(vm-depends) $(unittest-depends) $(unittest-objects): $(build)/unittest/%.o: $(unittest)/%.cpp $(vm-depends) $(unittest-depends)
$(compile-unittest-object) $(compile-unittest-object)
$(build)/tools/audit-codegen/main.o: $(build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
$(test-cpp-objects): $(test-build)/%.o: $(test)/%.cpp $(vm-depends) $(test-cpp-objects): $(test-build)/%.o: $(test)/%.cpp $(vm-depends)
$(compile-object) $(compile-object)
@ -1854,13 +1840,6 @@ ifeq ($(process),interpret)
unittest-executable-objects += $(all-codegen-target-objects) unittest-executable-objects += $(all-codegen-target-objects)
endif endif
audit-codegen-objects = $(call cpp-objects,$(audit-codegen-sources),$(src),$(build))
audit-codegen-executable-objects = $(audit-codegen-objects) $(vm-objects) $(build)/util/arg-parser.o
.PHONY: print
print:
@echo $(audit-codegen-objects)
# apparently, make does poorly with ifs inside of defines, and indented defines. # apparently, make does poorly with ifs inside of defines, and indented defines.
# I suggest re-indenting the following before making edits (and unindenting afterwards): # I suggest re-indenting the following before making edits (and unindenting afterwards):
ifneq ($(platform),windows) ifneq ($(platform),windows)
@ -1900,9 +1879,6 @@ $(executable): $(executable-objects)
$(unittest-executable): $(unittest-executable-objects) $(unittest-executable): $(unittest-executable-objects)
$(link-executable) $(link-executable)
$(audit-codegen-executable): $(audit-codegen-executable-objects)
$(link-executable)
$(bootimage-generator): $(bootimage-generator-objects) $(vm-objects) $(bootimage-generator): $(bootimage-generator-objects) $(vm-objects)
echo building $(bootimage-generator) arch=$(build-arch) platform=$(bootimage-platform) echo building $(bootimage-generator) arch=$(build-arch) platform=$(bootimage-platform)
$(MAKE) mode=$(mode) \ $(MAKE) mode=$(mode) \

View File

@ -1,35 +0,0 @@
/* 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. */
#include "lir.h"
namespace {
const char* lirOpcodeNames[] = {
#define LIR_OP_0(x) #x
#define LIR_OP_1(x) #x
#define LIR_OP_2(x) #x
#define LIR_OP_3(x) #x
#include "lir-ops.inc.cpp"
#undef LIR_OP_0
#undef LIR_OP_1
#undef LIR_OP_2
#undef LIR_OP_3
};
}
namespace vm {
const char* LirInstr::opcodeName(Opcode op) {
return lirOpcodeNames[op];
}
}

View File

@ -1,116 +0,0 @@
/* 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. */
#include <avian/system/system.h>
#include <avian/util/arg-parser.h>
#include <avian/codegen/lir.h>
#include <avian/codegen/assembler.h>
#include <avian/codegen/targets.h>
#include <avian/codegen/registers.h>
#include <avian/heap/heap.h>
// since we aren't linking against libstdc++, we must implement this
// ourselves:
extern "C" void __cxa_pure_virtual(void) { abort(); }
using namespace vm;
using namespace avian::codegen;
using namespace avian::util;
class BasicEnv {
public:
System* s;
Heap* heap;
Architecture* arch;
BasicEnv():
s(makeSystem()),
heap(makeHeap(s, 32 * 1024)),
arch(makeArchitectureNative(s, true))
{
arch->acquire();
}
~BasicEnv() {
arch->release();
s->dispose();
}
};
class Asm {
public:
Zone zone;
Assembler* a;
Asm(BasicEnv& env):
zone(env.s, env.heap, 8192),
a(env.arch->makeAssembler(env.heap, &zone))
{ }
~Asm() {
a->dispose();
}
};
void generateCode(BasicEnv& env) {
Asm a(env);
for(RegisterIterator it(env.arch->registerFile()->generalRegisters); it.hasNext(); ) {
int r = it.next();
lir::Register reg(r);
a.a->apply(lir::Add,
OperandInfo(4, lir::RegisterOperand, &reg),
OperandInfo(4, lir::RegisterOperand, &reg),
OperandInfo(4, lir::RegisterOperand, &reg));
}
unsigned length = a.a->endBlock(false)->resolve(0, 0);
printf("length: %d\n", length);
uint8_t* data = static_cast<uint8_t*>(env.s->tryAllocate(length));
a.a->setDestination(data);
a.a->write();
for(unsigned i = 0; i < length; i++) {
printf("%02x ", data[i]);
}
printf("\n");
env.s->free(data);
}
class Arguments {
public:
const char* output;
const char* outputFormat;
Arguments(int argc, char** argv) {
ArgParser parser;
Arg out(parser, true, "output", "<output object file>");
Arg format(parser, true, "format", "<format of output object file>");
if(!parser.parse(argc, argv)) {
exit(1);
}
output = out.value;
outputFormat = format.value;
// TODO: sanitize format values
}
};
int main(int argc, char** argv) {
Arguments args(argc, argv);
BasicEnv env;
generateCode(env);
return 0;
}