mirror of
https://github.com/corda/corda.git
synced 2025-01-01 02:36:44 +00:00
allow codegen targets (Architectures and Assemblers) to co-exist
The primary motivation behind this is to allow all the different Assemblers to be built at once, on a single machine. This should dramatically reduce the time required to make sure that a particular change doesn't break the build for one of the not-so-common architectures (arm, powerpc) Simply pass "codegen-targets=all" to make to compile all src/codegen/<arch>/assembler.cpp. Note that while these architectures are built, they will not be fully- functional. Certain stuff is assumed to be the same across the entire build (such as TargetBytesPerWord), but this isn't the case anymore.
This commit is contained in:
parent
68776e5d73
commit
f7b49ddb06
18
makefile
18
makefile
@ -25,6 +25,8 @@ bootimage-platform = \
|
||||
$(subst cygwin,windows,$(subst mingw32,windows,$(build-platform)))
|
||||
platform = $(bootimage-platform)
|
||||
|
||||
codegen-targets = native
|
||||
|
||||
mode = fast
|
||||
process = compile
|
||||
|
||||
@ -49,6 +51,9 @@ endif
|
||||
ifeq ($(continuations),true)
|
||||
options := $(options)-continuations
|
||||
endif
|
||||
ifeq ($(codegen-targets),all)
|
||||
options := $(options)-all
|
||||
endif
|
||||
|
||||
root := $(shell (cd .. && pwd))
|
||||
build = build/$(platform)-$(arch)$(options)
|
||||
@ -659,7 +664,18 @@ embed-objects = $(call cpp-objects,$(embed-sources),$(src),$(build-embed))
|
||||
ifeq ($(process),compile)
|
||||
vm-sources += \
|
||||
$(src)/codegen/compiler.cpp \
|
||||
$(src)/codegen/$(target-asm)/assembler.cpp
|
||||
$(src)/codegen/targets.cpp
|
||||
|
||||
ifeq ($(codegen-targets),native)
|
||||
vm-sources += \
|
||||
$(src)/codegen/$(target-asm)/assembler.cpp
|
||||
endif
|
||||
ifeq ($(codegen-targets),all)
|
||||
vm-sources += \
|
||||
$(src)/codegen/x86/assembler.cpp \
|
||||
$(src)/codegen/arm/assembler.cpp \
|
||||
$(src)/codegen/powerpc/assembler.cpp
|
||||
endif
|
||||
|
||||
vm-asm-sources += $(src)/compile-$(asm).S
|
||||
endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "assembler.h"
|
||||
#include "codegen/assembler.h"
|
||||
#include "alloc-vector.h"
|
||||
|
||||
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
|
||||
@ -2500,6 +2500,8 @@ class MyArchitecture: public Assembler::Architecture {
|
||||
}
|
||||
}
|
||||
|
||||
virtual Assembler* makeAssembler(Allocator* allocator, Zone* zone);
|
||||
|
||||
virtual void acquire() {
|
||||
++ referenceCount;
|
||||
}
|
||||
@ -2896,22 +2898,20 @@ class MyAssembler: public Assembler {
|
||||
MyArchitecture* arch_;
|
||||
};
|
||||
|
||||
Assembler* MyArchitecture::makeAssembler(Allocator* allocator, Zone* zone) {
|
||||
return new(zone) MyAssembler(this->con.s, allocator, zone, this);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace vm {
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
||||
Assembler::Architecture*
|
||||
makeArchitecture(System* system, bool)
|
||||
makeArchitectureArm(System* system, bool)
|
||||
{
|
||||
return new (allocate(system, sizeof(MyArchitecture))) MyArchitecture(system);
|
||||
}
|
||||
|
||||
Assembler*
|
||||
makeAssembler(System* system, Allocator* allocator, Zone* zone,
|
||||
Assembler::Architecture* architecture)
|
||||
{
|
||||
return new(zone) MyAssembler(system, allocator, zone,
|
||||
static_cast<MyArchitecture*>(architecture));
|
||||
}
|
||||
|
||||
} // namespace vm
|
||||
} // namespace codegen
|
||||
} // namespace avian
|
||||
|
@ -408,7 +408,9 @@ class Assembler {
|
||||
(TernaryOperation op,
|
||||
unsigned aSize, uint8_t aTypeMask, uint64_t aRegisterMask,
|
||||
unsigned bSize, uint8_t bTypeMask, uint64_t bRegisterMask,
|
||||
unsigned cSize, uint8_t* cTypeMask, uint64_t* cRegisterMask) = 0;
|
||||
unsigned cSize, uint8_t* cTypeMask, uint64_t* cRegisterMask) = 0;
|
||||
|
||||
virtual Assembler* makeAssembler(Allocator*, Zone*) = 0;
|
||||
|
||||
virtual void acquire() = 0;
|
||||
virtual void release() = 0;
|
||||
@ -466,13 +468,6 @@ class Assembler {
|
||||
virtual void dispose() = 0;
|
||||
};
|
||||
|
||||
Assembler::Architecture*
|
||||
makeArchitecture(System* system, bool useNativeFeatures);
|
||||
|
||||
Assembler*
|
||||
makeAssembler(System* system, Allocator* allocator, Zone* zone,
|
||||
Assembler::Architecture* architecture);
|
||||
|
||||
} // namespace vm
|
||||
|
||||
#endif//ASSEMBLER_H
|
||||
|
@ -8,7 +8,7 @@
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
#include "assembler.h"
|
||||
#include "codegen/assembler.h"
|
||||
#include "alloc-vector.h"
|
||||
|
||||
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
|
||||
@ -2446,6 +2446,8 @@ class MyArchitecture: public Assembler::Architecture {
|
||||
}
|
||||
}
|
||||
|
||||
virtual Assembler* makeAssembler(Allocator* allocator, Zone* zone);
|
||||
|
||||
virtual void acquire() {
|
||||
++ referenceCount;
|
||||
}
|
||||
@ -2858,23 +2860,20 @@ class MyAssembler: public Assembler {
|
||||
MyArchitecture* arch_;
|
||||
};
|
||||
|
||||
Assembler* MyArchitecture::makeAssembler(Allocator* allocator, Zone* zone) {
|
||||
return new(zone) MyAssembler(this->c.s, allocator, zone, this);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace vm {
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
||||
Assembler::Architecture*
|
||||
makeArchitecture(System* system, bool)
|
||||
makeArchitecturePowerpc(System* system, bool)
|
||||
{
|
||||
return new (allocate(system, sizeof(MyArchitecture))) MyArchitecture(system);
|
||||
}
|
||||
|
||||
Assembler*
|
||||
makeAssembler(System* system, Allocator* allocator, Zone* zone,
|
||||
Assembler::Architecture* architecture)
|
||||
{
|
||||
return
|
||||
new(zone) MyAssembler(system, allocator, zone,
|
||||
static_cast<MyArchitecture*>(architecture));
|
||||
}
|
||||
|
||||
} // namespace vm
|
||||
} // namespace codegen
|
||||
} // namespace avian
|
||||
|
37
src/codegen/targets.cpp
Normal file
37
src/codegen/targets.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
/* 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. */
|
||||
|
||||
#include "codegen/targets.h"
|
||||
#include "environment.h"
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
||||
vm::Assembler::Architecture* makeArchitectureNative(vm::System* system, bool useNativeFeatures UNUSED) {
|
||||
#ifndef AVIAN_TARGET_ARCH
|
||||
#error "Must specify native target!"
|
||||
#endif
|
||||
|
||||
#if AVIAN_TARGET_ARCH == AVIAN_ARCH_UNKNOWN
|
||||
system->abort();
|
||||
return 0;
|
||||
#elif (AVIAN_TARGET_ARCH == AVIAN_ARCH_X86) || (AVIAN_TARGET_ARCH == AVIAN_ARCH_X86_64)
|
||||
return makeArchitectureX86(system, useNativeFeatures);
|
||||
#elif AVIAN_TARGET_ARCH == AVIAN_ARCH_ARM
|
||||
return makeArchitectureArm(system, useNativeFeatures);
|
||||
#elif AVIAN_TARGET_ARCH == AVIAN_ARCH_POWERPC
|
||||
return makeArchitecturePowerpc(system, useNativeFeatures);
|
||||
#else
|
||||
#error "Unsupported codegen target"
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace codegen
|
||||
} // namespace avian
|
28
src/codegen/targets.h
Normal file
28
src/codegen/targets.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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_CODEGEN_TARGETS_H
|
||||
#define AVIAN_CODEGEN_TARGETS_H
|
||||
|
||||
#include "codegen/assembler.h"
|
||||
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
||||
vm::Assembler::Architecture* makeArchitectureNative(vm::System* system, bool useNativeFeatures);
|
||||
|
||||
vm::Assembler::Architecture* makeArchitectureX86(vm::System* system, bool useNativeFeatures);
|
||||
vm::Assembler::Architecture* makeArchitectureArm(vm::System* system, bool useNativeFeatures);
|
||||
vm::Assembler::Architecture* makeArchitecturePowerpc(vm::System* system, bool useNativeFeatures);
|
||||
|
||||
} // namespace codegen
|
||||
} // namespace avian
|
||||
|
||||
#endif // AVIAN_CODEGEN_TARGETS_H
|
@ -3387,6 +3387,8 @@ class MyArchitecture: public Assembler::Architecture {
|
||||
}
|
||||
}
|
||||
|
||||
virtual Assembler* makeAssembler(Allocator* allocator, Zone* zone);
|
||||
|
||||
virtual void acquire() {
|
||||
++ referenceCount;
|
||||
}
|
||||
@ -3732,26 +3734,23 @@ class MyAssembler: public Assembler {
|
||||
MyArchitecture* arch_;
|
||||
};
|
||||
|
||||
Assembler* MyArchitecture::makeAssembler(Allocator* allocator, Zone* zone) {
|
||||
return
|
||||
new(zone) MyAssembler(c.s, allocator, zone, this);
|
||||
}
|
||||
|
||||
} // namespace local
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace vm {
|
||||
namespace avian {
|
||||
namespace codegen {
|
||||
|
||||
Assembler::Architecture*
|
||||
makeArchitecture(System* system, bool useNativeFeatures)
|
||||
Assembler::Architecture* makeArchitectureX86(System* system, bool useNativeFeatures)
|
||||
{
|
||||
return new (allocate(system, sizeof(local::MyArchitecture)))
|
||||
local::MyArchitecture(system, useNativeFeatures);
|
||||
}
|
||||
|
||||
Assembler*
|
||||
makeAssembler(System* system, Allocator* allocator, Zone* zone,
|
||||
Assembler::Architecture* architecture)
|
||||
{
|
||||
return
|
||||
new(zone) local::MyAssembler(system, allocator, zone,
|
||||
static_cast<local::MyArchitecture*>(architecture));
|
||||
}
|
||||
|
||||
} // namespace vm
|
||||
} // namespace codegen
|
||||
} // namespace avian
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "target.h"
|
||||
#include "codegen/assembler.h"
|
||||
#include "codegen/compiler.h"
|
||||
#include "codegen/targets.h"
|
||||
#include "arch.h"
|
||||
|
||||
#include "util/runtime-array.h"
|
||||
@ -264,7 +265,7 @@ class MyThread: public Thread {
|
||||
reference(0),
|
||||
arch(parent
|
||||
? parent->arch
|
||||
: makeArchitecture(m->system, useNativeFeatures)),
|
||||
: avian::codegen::makeArchitectureNative(m->system, useNativeFeatures)),
|
||||
transition(0),
|
||||
traceContext(0),
|
||||
stackLimit(0),
|
||||
@ -1225,7 +1226,7 @@ class Context {
|
||||
Context(MyThread* t, BootContext* bootContext, object method):
|
||||
thread(t),
|
||||
zone(t->m->system, t->m->heap, InitialZoneCapacityInBytes),
|
||||
assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)),
|
||||
assembler(t->arch->makeAssembler(t->m->heap, &zone)),
|
||||
client(t),
|
||||
compiler(makeCompiler(t->m->system, assembler, &zone, &client)),
|
||||
method(method),
|
||||
@ -1251,7 +1252,7 @@ class Context {
|
||||
Context(MyThread* t):
|
||||
thread(t),
|
||||
zone(t->m->system, t->m->heap, InitialZoneCapacityInBytes),
|
||||
assembler(makeAssembler(t->m->system, t->m->heap, &zone, t->arch)),
|
||||
assembler(t->arch->makeAssembler(t->m->heap, &zone)),
|
||||
client(t),
|
||||
compiler(0),
|
||||
method(0),
|
||||
|
Loading…
Reference in New Issue
Block a user