mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
remove unused 'audit-codegen' tool
This commit is contained in:
parent
c37b13301a
commit
a368dc0625
24
makefile
24
makefile
@ -1155,8 +1155,6 @@ all-assembler-sources = \
|
||||
|
||||
native-assembler-sources = $($(target-asm)-assembler-sources)
|
||||
|
||||
audit-codegen-sources = $(wildcard $(src)/tools/audit-codegen/*.cpp)
|
||||
|
||||
all-codegen-target-sources = \
|
||||
$(compiler-sources) \
|
||||
$(native-assembler-sources)
|
||||
@ -1322,7 +1320,6 @@ dynamic-library = $(build)/$(so-prefix)jvm$(so-suffix)
|
||||
executable-dynamic = $(build)/$(name)-dynamic$(exe-suffix)
|
||||
|
||||
unittest-executable = $(build)/$(name)-unittest${exe-suffix}
|
||||
audit-codegen-executable = $(build)/audit-codegen${exe-suffix}
|
||||
|
||||
ifneq ($(classpath),avian)
|
||||
# Assembler, ConstantPool, and Stream are not technically needed for a
|
||||
@ -1486,14 +1483,6 @@ endif
|
||||
jdk-test: $(test-dep) $(build)/classpath.jar $(build)/jdk-run-tests.sh $(build)/test.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
|
||||
tarball:
|
||||
@echo "creating build/avian-$(version).tar.bz2"
|
||||
@ -1658,9 +1647,6 @@ endif
|
||||
$(unittest-objects): $(build)/unittest/%.o: $(unittest)/%.cpp $(vm-depends) $(unittest-depends)
|
||||
$(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)
|
||||
$(compile-object)
|
||||
|
||||
@ -1845,13 +1831,6 @@ ifeq ($(process),interpret)
|
||||
unittest-executable-objects += $(all-codegen-target-objects)
|
||||
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.
|
||||
# I suggest re-indenting the following before making edits (and unindenting afterwards):
|
||||
ifneq ($(platform),windows)
|
||||
@ -1891,9 +1870,6 @@ $(executable): $(executable-objects)
|
||||
$(unittest-executable): $(unittest-executable-objects)
|
||||
$(link-executable)
|
||||
|
||||
$(audit-codegen-executable): $(audit-codegen-executable-objects)
|
||||
$(link-executable)
|
||||
|
||||
$(bootimage-generator): $(bootimage-generator-objects) $(vm-objects)
|
||||
echo building $(bootimage-generator) arch=$(build-arch) platform=$(bootimage-platform)
|
||||
$(MAKE) mode=$(mode) \
|
||||
|
@ -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, ®),
|
||||
OperandInfo(4, lir::RegisterOperand, ®),
|
||||
OperandInfo(4, lir::RegisterOperand, ®));
|
||||
}
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user