mirror of
https://github.com/corda/corda.git
synced 2025-01-17 02:09:50 +00:00
don't include embedded boot classpath in libvm.a, only the executable
This commit is contained in:
parent
bb701f309c
commit
35160e46d8
@ -1,25 +0,0 @@
|
||||
#include "stdint.h"
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# define EXPORT __declspec(dllexport)
|
||||
# define SYMBOL(x) binary_classpath_jar_##x
|
||||
#else
|
||||
# define EXPORT __attribute__ ((visibility("default")))
|
||||
# define SYMBOL(x) _binary_classpath_jar_##x
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifndef __APPLE__
|
||||
extern const uint8_t SYMBOL(start)[];
|
||||
extern const uint8_t SYMBOL(size)[];
|
||||
|
||||
EXPORT const uint8_t*
|
||||
vmClasspath(unsigned* size)
|
||||
{
|
||||
*size = reinterpret_cast<uintptr_t>(SYMBOL(size));
|
||||
return SYMBOL(start);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
48
makefile
48
makefile
@ -1,5 +1,7 @@
|
||||
MAKEFLAGS = -s
|
||||
|
||||
name = vm
|
||||
|
||||
build-arch = $(shell uname -m)
|
||||
ifeq ($(build-arch),i586)
|
||||
build-arch = i386
|
||||
@ -135,7 +137,7 @@ generated-code = \
|
||||
$(native-build)/type-initializations.cpp \
|
||||
$(native-build)/type-java-initializations.cpp
|
||||
|
||||
interpreter-depends = \
|
||||
vm-depends = \
|
||||
$(generated-code) \
|
||||
$(src)/allocator.h \
|
||||
$(src)/common.h \
|
||||
@ -151,7 +153,7 @@ interpreter-depends = \
|
||||
$(src)/util.h \
|
||||
$(src)/zone.h
|
||||
|
||||
interpreter-sources = \
|
||||
vm-sources = \
|
||||
$(src)/$(system).cpp \
|
||||
$(src)/finder.cpp \
|
||||
$(src)/machine.cpp \
|
||||
@ -161,25 +163,21 @@ interpreter-sources = \
|
||||
$(src)/builtin.cpp \
|
||||
$(src)/jnienv.cpp
|
||||
|
||||
interpreter-asm-sources = $(src)/$(asm).S
|
||||
vm-asm-sources = $(src)/$(asm).S
|
||||
|
||||
ifeq ($(process),compile)
|
||||
interpreter-depends += \
|
||||
vm-depends += \
|
||||
$(src)/compiler.h \
|
||||
$(src)/vector.h
|
||||
|
||||
interpreter-sources += $(src)/compiler.cpp
|
||||
vm-sources += $(src)/compiler.cpp
|
||||
|
||||
interpreter-asm-sources += $(src)/compile.S
|
||||
vm-asm-sources += $(src)/compile.S
|
||||
endif
|
||||
|
||||
interpreter-cpp-objects = \
|
||||
$(call cpp-objects,$(interpreter-sources),$(src),$(native-build))
|
||||
interpreter-asm-objects = \
|
||||
$(call asm-objects,$(interpreter-asm-sources),$(src),$(native-build))
|
||||
interpreter-objects = \
|
||||
$(interpreter-cpp-objects) \
|
||||
$(interpreter-asm-objects)
|
||||
vm-cpp-objects = $(call cpp-objects,$(vm-sources),$(src),$(native-build))
|
||||
vm-asm-objects = $(call asm-objects,$(vm-asm-sources),$(src),$(native-build))
|
||||
vm-objects = $(vm-cpp-objects) $(vm-asm-objects)
|
||||
|
||||
driver-sources = $(src)/main.cpp
|
||||
|
||||
@ -191,8 +189,8 @@ generator-objects = \
|
||||
$(call cpp-objects,$(generator-sources),$(src),$(native-build))
|
||||
generator = $(native-build)/generator
|
||||
|
||||
archive = $(native-build)/libvm.a
|
||||
interpreter = $(native-build)/vm
|
||||
archive = $(native-build)/lib$(name).a
|
||||
vm = $(native-build)/$(name)
|
||||
|
||||
classpath-sources = $(shell find $(classpath) -name '*.java')
|
||||
classpath-classes = \
|
||||
@ -220,26 +218,26 @@ endif
|
||||
args = $(flags) $(input)
|
||||
|
||||
.PHONY: build
|
||||
build: $(interpreter) $(archive) $(classpath-dep) $(test-dep)
|
||||
build: $(vm) $(archive) $(classpath-dep) $(test-dep)
|
||||
|
||||
$(test-classes): $(classpath-dep)
|
||||
|
||||
.PHONY: run
|
||||
run: build
|
||||
$(interpreter) $(args)
|
||||
$(vm) $(args)
|
||||
|
||||
.PHONY: debug
|
||||
debug: build
|
||||
gdb --args $(interpreter) $(args)
|
||||
gdb --args $(vm) $(args)
|
||||
|
||||
.PHONY: vg
|
||||
vg: build
|
||||
$(vg) $(interpreter) $(args)
|
||||
$(vg) $(vm) $(args)
|
||||
|
||||
.PHONY: test
|
||||
test: build
|
||||
/bin/bash $(test)/test.sh 2>/dev/null \
|
||||
$(interpreter) $(mode) "$(flags)" \
|
||||
$(vm) $(mode) "$(flags)" \
|
||||
$(call class-names,$(test-build),$(test-classes))
|
||||
|
||||
.PHONY: clean
|
||||
@ -287,11 +285,10 @@ define compile-object
|
||||
$(cxx) $(cflags) -c $(<) -o $(@)
|
||||
endef
|
||||
|
||||
$(interpreter-cpp-objects): \
|
||||
$(native-build)/%.o: $(src)/%.cpp $(interpreter-depends)
|
||||
$(vm-cpp-objects): $(native-build)/%.o: $(src)/%.cpp $(vm-depends)
|
||||
$(compile-object)
|
||||
|
||||
$(interpreter-asm-objects): $(native-build)/%-asm.o: $(src)/%.S
|
||||
$(vm-asm-objects): $(native-build)/%-asm.o: $(src)/%.S
|
||||
$(compile-object)
|
||||
|
||||
$(driver-object): $(native-build)/%.o: $(src)/%.cpp
|
||||
@ -319,14 +316,13 @@ $(jni-objects): $(native-build)/%.o: $(classpath)/%.cpp
|
||||
@mkdir -p $(dir $(@))
|
||||
$(cxx) $(jni-cflags) -c $(<) -o $(@)
|
||||
|
||||
$(archive): $(interpreter-objects) $(jni-objects) $(classpath-object)
|
||||
$(archive): $(vm-objects) $(jni-objects)
|
||||
@echo "creating $(@)"
|
||||
rm -rf $(@)
|
||||
$(ar) cru $(@) $(^)
|
||||
$(ranlib) $(@)
|
||||
|
||||
$(interpreter): \
|
||||
$(interpreter-objects) $(jni-objects) $(classpath-object) $(driver-object)
|
||||
$(vm): $(vm-objects) $(jni-objects) $(classpath-object) $(driver-object)
|
||||
@echo "linking $(@)"
|
||||
ifeq ($(platform),windows)
|
||||
$(dlltool) -z $(@).def $(^)
|
||||
|
@ -1968,7 +1968,6 @@ JNI_GetDefaultJavaVMInitArgs(void* args)
|
||||
}
|
||||
|
||||
#define BUILTINS_PROPERTY "vm.builtins"
|
||||
#define BUILTIN_CLASSPATH "[vmClasspath]"
|
||||
|
||||
extern "C" JNIEXPORT jint JNICALL
|
||||
JNI_CreateJavaVM(Machine** m, Thread** t, void* args)
|
||||
@ -1977,13 +1976,7 @@ JNI_CreateJavaVM(Machine** m, Thread** t, void* args)
|
||||
|
||||
System* s = makeSystem();
|
||||
Heap* h = makeHeap(s, a->maxHeapSize);
|
||||
|
||||
unsigned size = sizeof(BUILTIN_CLASSPATH) + 1 + strlen(a->classpath);
|
||||
char classpath[size];
|
||||
snprintf(classpath, size, "%s%c%s",
|
||||
BUILTIN_CLASSPATH, s->pathSeparator(), a->classpath);
|
||||
|
||||
Finder* f = makeFinder(s, classpath);
|
||||
Finder* f = makeFinder(s, a->classpath);
|
||||
Processor* p = makeProcessor(s, h);
|
||||
|
||||
*m = new (h->allocate(sizeof(Machine), false)) Machine(s, h, f, p);
|
||||
|
@ -2657,6 +2657,17 @@ findInTable(Thread* t, object table, object name, object spec,
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s %s not in\n",
|
||||
&byteArrayBody(t, name, 0),
|
||||
&byteArrayBody(t, spec, 0));
|
||||
|
||||
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
||||
object o = arrayBody(t, table, i);
|
||||
fprintf(stderr, "\t%s %s\n",
|
||||
&byteArrayBody(t, getName(t, o), 0),
|
||||
&byteArrayBody(t, getSpec(t, o), 0));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
37
src/main.cpp
37
src/main.cpp
@ -1,6 +1,7 @@
|
||||
#include "stdlib.h"
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "stdint.h"
|
||||
#include "jni.h"
|
||||
|
||||
// since we don't link against libstdc++, we must implement some dummy
|
||||
@ -8,6 +9,34 @@
|
||||
extern "C" void __cxa_pure_virtual(void) { abort(); }
|
||||
void operator delete(void*) { abort(); }
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# define PATH_SEPARATOR ';'
|
||||
# define EXPORT __declspec(dllexport)
|
||||
# define SYMBOL(x) binary_classpath_jar_##x
|
||||
#else
|
||||
# define PATH_SEPARATOR ':'
|
||||
# define EXPORT __attribute__ ((visibility("default")))
|
||||
# define SYMBOL(x) _binary_classpath_jar_##x
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
||||
#ifndef __APPLE__
|
||||
# define BOOT_CLASSPATH "[classpathJar]"
|
||||
|
||||
extern const uint8_t SYMBOL(start)[];
|
||||
extern const uint8_t SYMBOL(size)[];
|
||||
|
||||
EXPORT const uint8_t*
|
||||
classpathJar(unsigned* size)
|
||||
{
|
||||
*size = reinterpret_cast<uintptr_t>(SYMBOL(size));
|
||||
return SYMBOL(start);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#ifdef JNI_VERSION_1_6
|
||||
// todo: use JavaVMInitArgs instead
|
||||
typedef struct JDK1_1InitArgs {
|
||||
@ -76,6 +105,14 @@ main(int ac, const char** av)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOT_CLASSPATH
|
||||
unsigned size = sizeof(BOOT_CLASSPATH) + 1 + strlen(vmArgs.classpath);
|
||||
char classpath[size];
|
||||
snprintf(classpath, size, "%s%c%s",
|
||||
BOOT_CLASSPATH, PATH_SEPARATOR, vmArgs.classpath);
|
||||
vmArgs.classpath = classpath;
|
||||
#endif
|
||||
|
||||
const char* properties[propertyCount + 1];
|
||||
properties[propertyCount] = 0;
|
||||
for (int i = 1; i < ac; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user