mirror of
https://github.com/corda/corda.git
synced 2025-01-28 23:24:29 +00:00
various performance tweaks and bugfixes
This commit is contained in:
parent
747e7b0371
commit
59638543c7
@ -15,7 +15,7 @@ public class SystemClassLoader extends ClassLoader {
|
|||||||
protected URL findResource(String name) {
|
protected URL findResource(String name) {
|
||||||
if (resourceExists(name)) {
|
if (resourceExists(name)) {
|
||||||
try {
|
try {
|
||||||
return new URL("resource://" + name);
|
return new URL("resource:" + name);
|
||||||
} catch (MalformedURLException ignored) { }
|
} catch (MalformedURLException ignored) { }
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -23,6 +23,10 @@ public final class URL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return handler.toExternalForm(this);
|
||||||
|
}
|
||||||
|
|
||||||
public String getProtocol() {
|
public String getProtocol() {
|
||||||
return protocol;
|
return protocol;
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,9 @@ public abstract class URLStreamHandler {
|
|||||||
|
|
||||||
protected String toExternalForm(URL url) {
|
protected String toExternalForm(URL url) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(url.getProtocol()).append("://");
|
sb.append(url.getProtocol()).append(":");
|
||||||
if (url.getHost() != null) {
|
if (url.getHost() != null) {
|
||||||
sb.append(url.getHost());
|
sb.append("//").append(url.getHost());
|
||||||
if (url.getPort() >= 0) {
|
if (url.getPort() >= 0) {
|
||||||
sb.append(":").append(url.getPort());
|
sb.append(":").append(url.getPort());
|
||||||
}
|
}
|
||||||
|
55
makefile
55
makefile
@ -1,4 +1,4 @@
|
|||||||
MAKEFLAGS = -s
|
#MAKEFLAGS = -s
|
||||||
|
|
||||||
arch = $(shell uname -m)
|
arch = $(shell uname -m)
|
||||||
ifeq ($(arch),i586)
|
ifeq ($(arch),i586)
|
||||||
@ -15,7 +15,7 @@ cls = build/classes
|
|||||||
src = src
|
src = src
|
||||||
classpath = classpath
|
classpath = classpath
|
||||||
test = test
|
test = test
|
||||||
jscheme = /tmp/jscheme
|
jscheme = $(HOME)/p/jscheme-7.2/src
|
||||||
|
|
||||||
input = $(cls)/References.class
|
input = $(cls)/References.class
|
||||||
|
|
||||||
@ -23,7 +23,10 @@ cxx = g++
|
|||||||
cc = gcc
|
cc = gcc
|
||||||
vg = nice valgrind --leak-check=full --num-callers=32 --db-attach=yes \
|
vg = nice valgrind --leak-check=full --num-callers=32 --db-attach=yes \
|
||||||
--freelist-vol=100000000
|
--freelist-vol=100000000
|
||||||
|
db = gdb --args
|
||||||
javac = javac
|
javac = javac
|
||||||
|
strip = :
|
||||||
|
show-size = :
|
||||||
|
|
||||||
warnings = -Wall -Wextra -Werror -Wold-style-cast -Wunused-parameter \
|
warnings = -Wall -Wextra -Werror -Wold-style-cast -Wunused-parameter \
|
||||||
-Winit-self -Wconversion
|
-Winit-self -Wconversion
|
||||||
@ -46,11 +49,9 @@ ifeq ($(mode),stress-major)
|
|||||||
cflags += -O0 -g3 -DVM_STRESS -DVM_STRESS_MAJOR
|
cflags += -O0 -g3 -DVM_STRESS -DVM_STRESS_MAJOR
|
||||||
endif
|
endif
|
||||||
ifeq ($(mode),fast)
|
ifeq ($(mode),fast)
|
||||||
cflags += -Os -DNDEBUG -DMONOLITHIC
|
cflags += -O3 -DNDEBUG
|
||||||
endif
|
#strip = strip
|
||||||
ifeq ($(mode),profile)
|
#show-size = ls -l
|
||||||
cflags += -Os -pg -DNDEBUG -DMONOLITHIC
|
|
||||||
lflags += -pg
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(bld)/%.o,$(x)))
|
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(bld)/%.o,$(x)))
|
||||||
@ -136,6 +137,8 @@ class-names = $(foreach x,$(1),$(call class-name,$(x)))
|
|||||||
flags = -cp $(cls)
|
flags = -cp $(cls)
|
||||||
args = $(flags) $(call class-name,$(input))
|
args = $(flags) $(call class-name,$(input))
|
||||||
|
|
||||||
|
jscheme-command = jscheme/REPL build/make.scm -main commandMain ""
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(executable)
|
build: $(executable)
|
||||||
|
|
||||||
@ -145,43 +148,41 @@ $(input): $(classpath-objects)
|
|||||||
run: $(executable) $(input)
|
run: $(executable) $(input)
|
||||||
LD_LIBRARY_PATH=$(bld) $(<) $(args)
|
LD_LIBRARY_PATH=$(bld) $(<) $(args)
|
||||||
|
|
||||||
.PHONY: run-jscheme
|
|
||||||
run-jscheme: $(executable) $(input)
|
|
||||||
LD_LIBRARY_PATH=$(bld) $(<) -cp $(cls):$(jscheme) jscheme/REPL
|
|
||||||
|
|
||||||
.PHONY: debug
|
.PHONY: debug
|
||||||
debug: $(executable) $(input)
|
debug: $(executable) $(input)
|
||||||
LD_LIBRARY_PATH=$(bld) gdb --args $(<) $(args)
|
LD_LIBRARY_PATH=$(bld) gdb --args $(<) $(args)
|
||||||
|
|
||||||
.PHONY: debug-jscheme
|
|
||||||
debug-jscheme: $(executable) $(input)
|
|
||||||
LD_LIBRARY_PATH=$(bld) gdb --args $(<) -cp $(cls):$(jscheme) \
|
|
||||||
jscheme/REPL
|
|
||||||
|
|
||||||
.PHONY: vg
|
.PHONY: vg
|
||||||
vg: $(executable) $(input)
|
vg: $(executable) $(input)
|
||||||
LD_LIBRARY_PATH=$(bld) $(vg) $(<) $(args)
|
LD_LIBRARY_PATH=$(bld) $(vg) $(<) $(args)
|
||||||
|
|
||||||
.PHONY: vg-jscheme
|
|
||||||
vg-jscheme: $(executable) $(input)
|
|
||||||
LD_LIBRARY_PATH=$(bld) $(vg) $(<) -cp $(cls):$(jscheme) \
|
|
||||||
jscheme/REPL
|
|
||||||
|
|
||||||
.PHONY: profile-jscheme
|
|
||||||
profile-jscheme: $(executable) $(input)
|
|
||||||
echo '(+ 5 6)' | LD_LIBRARY_PATH=$(bld) $(<) -cp $(cls):$(jscheme) \
|
|
||||||
jscheme/REPL
|
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: $(executable) $(classpath-objects) $(test-classes)
|
test: $(executable) $(classpath-objects) $(test-classes)
|
||||||
LD_LIBRARY_PATH=$(bld) /bin/bash $(test)/test.sh \
|
LD_LIBRARY_PATH=$(bld) /bin/bash $(test)/test.sh \
|
||||||
$(<) $(mode) "$(flags)" $(call class-names,$(test-classes))
|
$(<) $(mode) "$(flags)" $(call class-names,$(test-classes))
|
||||||
|
|
||||||
|
.PHONY: run-jscheme
|
||||||
|
run-jscheme: $(executable) $(input)
|
||||||
|
LD_LIBRARY_PATH=$(bld) $(<) -cp $(cls):$(jscheme) $(jscheme-command)
|
||||||
|
|
||||||
|
.PHONY: debug-jscheme
|
||||||
|
debug-jscheme: $(executable) $(input)
|
||||||
|
LD_LIBRARY_PATH=$(bld) $(db) $(<) -cp $(cls):$(jscheme) $(jscheme-command)
|
||||||
|
|
||||||
|
.PHONY: vg-jscheme
|
||||||
|
vg-jscheme: $(executable) $(input)
|
||||||
|
LD_LIBRARY_PATH=$(bld) $(vg) $(<) -cp $(cls):$(jscheme) $(jscheme-command)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@echo "removing build"
|
@echo "removing build"
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
||||||
|
.PHONY: clean-native
|
||||||
|
clean-native:
|
||||||
|
@echo "removing $(bld)"
|
||||||
|
rm -rf $(bld)
|
||||||
|
|
||||||
gen-arg = $(shell echo $(1) | sed -e 's:$(bld)/type-\(.*\)\.cpp:\1:')
|
gen-arg = $(shell echo $(1) | sed -e 's:$(bld)/type-\(.*\)\.cpp:\1:')
|
||||||
$(generated-code): %.cpp: $(src)/types.def $(generator-executable)
|
$(generated-code): %.cpp: $(src)/types.def $(generator-executable)
|
||||||
@echo "generating $(@)"
|
@echo "generating $(@)"
|
||||||
@ -232,6 +233,8 @@ $(jni-library): $(jni-objects)
|
|||||||
$(executable): $(interpreter-objects) $(stdcpp-objects)
|
$(executable): $(interpreter-objects) $(stdcpp-objects)
|
||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
$(cc) $(lflags) $(^) -o $(@)
|
$(cc) $(lflags) $(^) -o $(@)
|
||||||
|
$(strip) --strip-all $(@)
|
||||||
|
$(show-size) $(@)
|
||||||
|
|
||||||
.PHONY: generator
|
.PHONY: generator
|
||||||
generator: $(generator-executable)
|
generator: $(generator-executable)
|
||||||
|
@ -618,8 +618,10 @@ populateBuiltinMap(Thread* t, object map)
|
|||||||
reinterpret_cast<void*>(::Runtime_loadLibrary) },
|
reinterpret_cast<void*>(::Runtime_loadLibrary) },
|
||||||
{ "Java_java_lang_Runtime_gc",
|
{ "Java_java_lang_Runtime_gc",
|
||||||
reinterpret_cast<void*>(::Runtime_gc) },
|
reinterpret_cast<void*>(::Runtime_gc) },
|
||||||
{ "Java_java_lang_Runtiime_exit",
|
{ "Java_java_lang_Runtime_exit",
|
||||||
reinterpret_cast<void*>(::Runtime_exit) },
|
reinterpret_cast<void*>(::Runtime_exit) },
|
||||||
|
{ "Java_java_lang_Runtime_freeMemory",
|
||||||
|
reinterpret_cast<void*>(::Runtime_freeMemory) },
|
||||||
|
|
||||||
{ "Java_java_lang_String_intern",
|
{ "Java_java_lang_String_intern",
|
||||||
reinterpret_cast<void*>(::String_intern) },
|
reinterpret_cast<void*>(::String_intern) },
|
||||||
@ -689,9 +691,9 @@ populateBuiltinMap(Thread* t, object map)
|
|||||||
|
|
||||||
{ "Java_java_net_URL_00024ResourceInputStream_open",
|
{ "Java_java_net_URL_00024ResourceInputStream_open",
|
||||||
reinterpret_cast<void*>(::ResourceInputStream_open) },
|
reinterpret_cast<void*>(::ResourceInputStream_open) },
|
||||||
{ "Java_java_net_URL_00024ResourceInputStream_read_JI",
|
{ "Java_java_net_URL_00024ResourceInputStream_read__JI",
|
||||||
reinterpret_cast<void*>(::ResourceInputStream_read) },
|
reinterpret_cast<void*>(::ResourceInputStream_read) },
|
||||||
{ "Java_java_net_URL_00024ResourceInputStream_read_JI_3BII",
|
{ "Java_java_net_URL_00024ResourceInputStream_read__JI_3BII",
|
||||||
reinterpret_cast<void*>(::ResourceInputStream_read2) },
|
reinterpret_cast<void*>(::ResourceInputStream_read2) },
|
||||||
{ "Java_java_net_URL_00024ResourceInputStream_close",
|
{ "Java_java_net_URL_00024ResourceInputStream_close",
|
||||||
reinterpret_cast<void*>(::ResourceInputStream_close) },
|
reinterpret_cast<void*>(::ResourceInputStream_close) },
|
||||||
|
11
src/common.h
11
src/common.h
@ -10,11 +10,12 @@
|
|||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
# define LD "%d"
|
# define LD "d"
|
||||||
# define LLD "%lld"
|
# define LLD "lld"
|
||||||
#elif defined __x86_64__
|
#elif defined __x86_64__
|
||||||
# define LD "%ld"
|
# define LD "ld"
|
||||||
# define LLD "%ld"
|
# define LLD "ld"
|
||||||
|
# define LLD "ld"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NO_RETURN __attribute__((noreturn))
|
#define NO_RETURN __attribute__((noreturn))
|
||||||
@ -26,6 +27,8 @@
|
|||||||
#define MACRO_MakeNameXY(FX, LINE) MACRO_XY(FX, LINE)
|
#define MACRO_MakeNameXY(FX, LINE) MACRO_XY(FX, LINE)
|
||||||
#define MAKE_NAME(FX) MACRO_MakeNameXY(FX, __LINE__)
|
#define MAKE_NAME(FX) MACRO_MakeNameXY(FX, __LINE__)
|
||||||
|
|
||||||
|
#define UNUSED __attribute__((unused))
|
||||||
|
|
||||||
inline void* operator new(size_t, void* p) throw() { return p; }
|
inline void* operator new(size_t, void* p) throw() { return p; }
|
||||||
|
|
||||||
namespace vm {
|
namespace vm {
|
||||||
|
43
src/heap.cpp
43
src/heap.cpp
@ -21,7 +21,9 @@ const bool Debug = false;
|
|||||||
class Context;
|
class Context;
|
||||||
|
|
||||||
void NO_RETURN abort(Context*);
|
void NO_RETURN abort(Context*);
|
||||||
|
#ifndef NDEBUG
|
||||||
void assert(Context*, bool);
|
void assert(Context*, bool);
|
||||||
|
#endif
|
||||||
|
|
||||||
System* system(Context*);
|
System* system(Context*);
|
||||||
|
|
||||||
@ -410,7 +412,11 @@ class Context {
|
|||||||
tenureFootprint(0),
|
tenureFootprint(0),
|
||||||
gen1padding(0),
|
gen1padding(0),
|
||||||
gen2padding(0),
|
gen2padding(0),
|
||||||
mode(Heap::MinorCollection)
|
mode(Heap::MinorCollection),
|
||||||
|
|
||||||
|
lastCollectionTime(system->now()),
|
||||||
|
totalCollectionTime(0),
|
||||||
|
totalTime(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
@ -446,6 +452,10 @@ class Context {
|
|||||||
unsigned gen2padding;
|
unsigned gen2padding;
|
||||||
|
|
||||||
Heap::CollectionType mode;
|
Heap::CollectionType mode;
|
||||||
|
|
||||||
|
int64_t lastCollectionTime;
|
||||||
|
int64_t totalCollectionTime;
|
||||||
|
int64_t totalTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline System*
|
inline System*
|
||||||
@ -476,11 +486,13 @@ abort(Context* c)
|
|||||||
abort(c->system);
|
abort(c->system);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
inline void
|
inline void
|
||||||
assert(Context* c, bool v)
|
assert(Context* c, bool v)
|
||||||
{
|
{
|
||||||
assert(c->system, v);
|
assert(c->system, v);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
initNextGen1(Context* c, unsigned footprint)
|
initNextGen1(Context* c, unsigned footprint)
|
||||||
@ -540,21 +552,21 @@ wasCollected(Context* c, object o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline object
|
inline object
|
||||||
follow(Context* c, object o)
|
follow(Context* c UNUSED, object o)
|
||||||
{
|
{
|
||||||
assert(c, wasCollected(c, o));
|
assert(c, wasCollected(c, o));
|
||||||
return cast<object>(o, 0);
|
return cast<object>(o, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline object&
|
inline object&
|
||||||
parent(Context* c, object o)
|
parent(Context* c UNUSED, object o)
|
||||||
{
|
{
|
||||||
assert(c, wasCollected(c, o));
|
assert(c, wasCollected(c, o));
|
||||||
return cast<object>(o, BytesPerWord);
|
return cast<object>(o, BytesPerWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uintptr_t*
|
inline uintptr_t*
|
||||||
bitset(Context* c, object o)
|
bitset(Context* c UNUSED, object o)
|
||||||
{
|
{
|
||||||
assert(c, wasCollected(c, o));
|
assert(c, wasCollected(c, o));
|
||||||
return &cast<uintptr_t>(o, BytesPerWord * 2);
|
return &cast<uintptr_t>(o, BytesPerWord * 2);
|
||||||
@ -982,7 +994,7 @@ collect(Context* c, object* p)
|
|||||||
|
|
||||||
void
|
void
|
||||||
collect(Context* c, Segment::Map* map, unsigned start, unsigned end,
|
collect(Context* c, Segment::Map* map, unsigned start, unsigned end,
|
||||||
bool* dirty, bool expectDirty)
|
bool* dirty, bool expectDirty UNUSED)
|
||||||
{
|
{
|
||||||
bool wasDirty = false;
|
bool wasDirty = false;
|
||||||
for (Segment::Map::Iterator it(map, start, end); it.hasMore();) {
|
for (Segment::Map::Iterator it(map, start, end); it.hasMore();) {
|
||||||
@ -1060,9 +1072,9 @@ collect(Context* c, unsigned footprint)
|
|||||||
int64_t then;
|
int64_t then;
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
if (c->mode == Heap::MajorCollection) {
|
if (c->mode == Heap::MajorCollection) {
|
||||||
fprintf(stderr, "major collection ");
|
fprintf(stderr, "major collection\n");
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "minor collection ");
|
fprintf(stderr, "minor collection\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
then = c->system->now();
|
then = c->system->now();
|
||||||
@ -1081,7 +1093,22 @@ collect(Context* c, unsigned footprint)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
fprintf(stderr, "- " LLD "ms\n", (c->system->now() - then));
|
int64_t now = c->system->now();
|
||||||
|
int64_t collection = now - then;
|
||||||
|
int64_t run = then - c->lastCollectionTime;
|
||||||
|
c->totalCollectionTime += collection;
|
||||||
|
c->totalTime += collection + run;
|
||||||
|
c->lastCollectionTime = now;
|
||||||
|
|
||||||
|
fprintf(stderr,
|
||||||
|
" - collect: %4"LLD"ms; "
|
||||||
|
"total: %4"LLD"ms; "
|
||||||
|
"run: %4"LLD"ms; "
|
||||||
|
"total: %4"LLD"ms\n",
|
||||||
|
collection,
|
||||||
|
c->totalCollectionTime,
|
||||||
|
run,
|
||||||
|
c->totalTime - c->totalCollectionTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2136,7 +2136,7 @@ parseClass(Thread* t, const uint8_t* data, unsigned size)
|
|||||||
Stream s(&client, data, size);
|
Stream s(&client, data, size);
|
||||||
|
|
||||||
uint32_t magic = s.read4();
|
uint32_t magic = s.read4();
|
||||||
assert(t, magic == 0xCAFEBABE);
|
expect(t, magic == 0xCAFEBABE);
|
||||||
s.read2(); // minor version
|
s.read2(); // minor version
|
||||||
s.read2(); // major version
|
s.read2(); // major version
|
||||||
|
|
||||||
|
@ -1193,7 +1193,7 @@ class Thread {
|
|||||||
Thread* t;
|
Thread* t;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned HeapSizeInBytes = 64 * 1024;
|
static const unsigned HeapSizeInBytes = 512 * 1024;
|
||||||
static const unsigned StackSizeInBytes = 64 * 1024;
|
static const unsigned StackSizeInBytes = 64 * 1024;
|
||||||
|
|
||||||
static const unsigned HeapSizeInWords = HeapSizeInBytes / BytesPerWord;
|
static const unsigned HeapSizeInWords = HeapSizeInBytes / BytesPerWord;
|
||||||
@ -1339,11 +1339,13 @@ abort(Thread* t)
|
|||||||
abort(t->vm->system);
|
abort(t->vm->system);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
inline void
|
inline void
|
||||||
assert(Thread* t, bool v)
|
assert(Thread* t, bool v)
|
||||||
{
|
{
|
||||||
assert(t->vm->system, v);
|
assert(t->vm->system, v);
|
||||||
}
|
}
|
||||||
|
#endif // not NDEBUG
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
expect(Thread* t, bool v)
|
expect(Thread* t, bool v)
|
||||||
@ -1601,7 +1603,7 @@ inline void
|
|||||||
pushLong(Thread* t, uint64_t v)
|
pushLong(Thread* t, uint64_t v)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "push long " LLD " at %d\n", v, t->sp);
|
fprintf(stderr, "push long %"LLD" at %d\n", v, t->sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushInt(t, v >> 32);
|
pushInt(t, v >> 32);
|
||||||
@ -1632,7 +1634,7 @@ inline uint32_t
|
|||||||
popInt(Thread* t)
|
popInt(Thread* t)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "pop int " LD " at %d\n",
|
fprintf(stderr, "pop int %"LD" at %d\n",
|
||||||
t->stack[((t->sp - 1) * 2) + 1],
|
t->stack[((t->sp - 1) * 2) + 1],
|
||||||
t->sp - 1);
|
t->sp - 1);
|
||||||
}
|
}
|
||||||
@ -1653,7 +1655,7 @@ inline uint64_t
|
|||||||
popLong(Thread* t)
|
popLong(Thread* t)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "pop long " LLD " at %d\n",
|
fprintf(stderr, "pop long %"LLD" at %d\n",
|
||||||
(static_cast<uint64_t>(t->stack[((t->sp - 2) * 2) + 1]) << 32)
|
(static_cast<uint64_t>(t->stack[((t->sp - 2) * 2) + 1]) << 32)
|
||||||
| static_cast<uint64_t>(t->stack[((t->sp - 1) * 2) + 1]),
|
| static_cast<uint64_t>(t->stack[((t->sp - 1) * 2) + 1]),
|
||||||
t->sp - 2);
|
t->sp - 2);
|
||||||
@ -1690,7 +1692,7 @@ inline uint32_t
|
|||||||
peekInt(Thread* t, unsigned index)
|
peekInt(Thread* t, unsigned index)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "peek int " LD " at %d\n",
|
fprintf(stderr, "peek int %"LD" at %d\n",
|
||||||
t->stack[(index * 2) + 1],
|
t->stack[(index * 2) + 1],
|
||||||
index);
|
index);
|
||||||
}
|
}
|
||||||
@ -1704,7 +1706,7 @@ inline uint64_t
|
|||||||
peekLong(Thread* t, unsigned index)
|
peekLong(Thread* t, unsigned index)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "peek long " LLD " at %d\n",
|
fprintf(stderr, "peek long %"LLD" at %d\n",
|
||||||
(static_cast<uint64_t>(t->stack[(index * 2) + 1]) << 32)
|
(static_cast<uint64_t>(t->stack[(index * 2) + 1]) << 32)
|
||||||
| static_cast<uint64_t>(t->stack[((index + 1) * 2) + 1]),
|
| static_cast<uint64_t>(t->stack[((index + 1) * 2) + 1]),
|
||||||
index);
|
index);
|
||||||
@ -1740,7 +1742,7 @@ inline void
|
|||||||
pokeLong(Thread* t, unsigned index, uint64_t value)
|
pokeLong(Thread* t, unsigned index, uint64_t value)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "poke long " LLD " at %d\n", value, index);
|
fprintf(stderr, "poke long %"LLD" at %d\n", value, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
pokeInt(t, index, value >> 32);
|
pokeInt(t, index, value >> 32);
|
||||||
@ -1862,7 +1864,7 @@ objectExtended(Thread*, object o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline uintptr_t&
|
inline uintptr_t&
|
||||||
extendedWord(Thread* t, object o, unsigned baseSize)
|
extendedWord(Thread* t UNUSED, object o, unsigned baseSize)
|
||||||
{
|
{
|
||||||
assert(t, objectExtended(t, o));
|
assert(t, objectExtended(t, o));
|
||||||
return cast<uintptr_t>(o, baseSize * BytesPerWord);
|
return cast<uintptr_t>(o, baseSize * BytesPerWord);
|
||||||
@ -2107,7 +2109,7 @@ object
|
|||||||
makeObjectArray(Thread* t, object elementClass, unsigned count, bool clear);
|
makeObjectArray(Thread* t, object elementClass, unsigned count, bool clear);
|
||||||
|
|
||||||
inline unsigned
|
inline unsigned
|
||||||
objectArrayLength(Thread* t, object array)
|
objectArrayLength(Thread* t UNUSED, object array)
|
||||||
{
|
{
|
||||||
assert(t, classFixedSize(t, objectClass(t, array)) == BytesPerWord * 2);
|
assert(t, classFixedSize(t, objectClass(t, array)) == BytesPerWord * 2);
|
||||||
assert(t, classArrayElementSize(t, objectClass(t, array)) == BytesPerWord);
|
assert(t, classArrayElementSize(t, objectClass(t, array)) == BytesPerWord);
|
||||||
@ -2115,7 +2117,7 @@ objectArrayLength(Thread* t, object array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline object&
|
inline object&
|
||||||
objectArrayBody(Thread* t, object array, unsigned index)
|
objectArrayBody(Thread* t UNUSED, object array, unsigned index)
|
||||||
{
|
{
|
||||||
assert(t, classFixedSize(t, objectClass(t, array)) == BytesPerWord * 2);
|
assert(t, classFixedSize(t, objectClass(t, array)) == BytesPerWord * 2);
|
||||||
assert(t, classArrayElementSize(t, objectClass(t, array)) == BytesPerWord);
|
assert(t, classArrayElementSize(t, objectClass(t, array)) == BytesPerWord);
|
||||||
@ -2186,7 +2188,7 @@ wait(Thread* t, object o, int64_t milliseconds)
|
|||||||
System::Monitor* m = objectMonitor(t, o);
|
System::Monitor* m = objectMonitor(t, o);
|
||||||
|
|
||||||
if (DebugMonitors) {
|
if (DebugMonitors) {
|
||||||
fprintf(stderr, "thread %p waits " LLD " millis on %p for %x\n",
|
fprintf(stderr, "thread %p waits %"LLD" millis on %p for %x\n",
|
||||||
t, milliseconds, m, objectHash(t, o));
|
t, milliseconds, m, objectHash(t, o));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ find(Thread* t, object table, object reference,
|
|||||||
object& (*name)(Thread*, object),
|
object& (*name)(Thread*, object),
|
||||||
object& (*spec)(Thread*, object))
|
object& (*spec)(Thread*, object))
|
||||||
{
|
{
|
||||||
|
if (table) {
|
||||||
object n = referenceName(t, reference);
|
object n = referenceName(t, reference);
|
||||||
object s = referenceSpec(t, reference);
|
object s = referenceSpec(t, reference);
|
||||||
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
||||||
@ -143,6 +144,7 @@ find(Thread* t, object table, object reference,
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -478,7 +480,7 @@ invokeNative(Thread* t, object method)
|
|||||||
case FloatField:
|
case FloatField:
|
||||||
case IntField:
|
case IntField:
|
||||||
if (DebugRun) {
|
if (DebugRun) {
|
||||||
fprintf(stderr, "result: " LLD "\n", result);
|
fprintf(stderr, "result: %"LLD"\n", result);
|
||||||
}
|
}
|
||||||
pushInt(t, result);
|
pushInt(t, result);
|
||||||
break;
|
break;
|
||||||
@ -486,7 +488,7 @@ invokeNative(Thread* t, object method)
|
|||||||
case LongField:
|
case LongField:
|
||||||
case DoubleField:
|
case DoubleField:
|
||||||
if (DebugRun) {
|
if (DebugRun) {
|
||||||
fprintf(stderr, "result: " LLD "\n", result);
|
fprintf(stderr, "result: %"LLD"\n", result);
|
||||||
}
|
}
|
||||||
pushLong(t, result);
|
pushLong(t, result);
|
||||||
break;
|
break;
|
||||||
@ -2470,7 +2472,7 @@ run(Thread* t, const char* className, int argc, const char** argv)
|
|||||||
PROTECT(t, args);
|
PROTECT(t, args);
|
||||||
|
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
object arg = makeString(t, "%s", argv);
|
object arg = makeString(t, "%s", argv[i]);
|
||||||
set(t, objectArrayBody(t, args, i), arg);
|
set(t, objectArrayBody(t, args, i), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class MySystem: public System {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void join() {
|
virtual void join() {
|
||||||
int rv = pthread_join(thread, 0);
|
int rv UNUSED = pthread_join(thread, 0);
|
||||||
assert(s, rv == 0);
|
assert(s, rv == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,11 +262,11 @@ class MySystem: public System {
|
|||||||
if (time) {
|
if (time) {
|
||||||
int64_t then = s->now() + time;
|
int64_t then = s->now() + time;
|
||||||
timespec ts = { then / 1000, (then % 1000) * 1000 * 1000 };
|
timespec ts = { then / 1000, (then % 1000) * 1000 * 1000 };
|
||||||
int rv = pthread_cond_timedwait
|
int rv UNUSED = pthread_cond_timedwait
|
||||||
(&(t->condition), &(t->mutex), &ts);
|
(&(t->condition), &(t->mutex), &ts);
|
||||||
assert(s, rv == 0 or rv == ETIMEDOUT or rv == EINTR);
|
assert(s, rv == 0 or rv == ETIMEDOUT or rv == EINTR);
|
||||||
} else {
|
} else {
|
||||||
int rv = pthread_cond_wait(&(t->condition), &(t->mutex));
|
int rv UNUSED = pthread_cond_wait(&(t->condition), &(t->mutex));
|
||||||
assert(s, rv == 0 or rv == EINTR);
|
assert(s, rv == 0 or rv == EINTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ class MySystem: public System {
|
|||||||
ACQUIRE(t->mutex);
|
ACQUIRE(t->mutex);
|
||||||
|
|
||||||
t->flags |= Notified;
|
t->flags |= Notified;
|
||||||
int rv = pthread_cond_signal(&(t->condition));
|
int rv UNUSED = pthread_cond_signal(&(t->condition));
|
||||||
assert(s, rv == 0);
|
assert(s, rv == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ class MySystem: public System {
|
|||||||
sigemptyset(&(sa.sa_mask));
|
sigemptyset(&(sa.sa_mask));
|
||||||
sa.sa_handler = handleSignal;
|
sa.sa_handler = handleSignal;
|
||||||
|
|
||||||
int rv = sigaction(InterruptSignal, &sa, 0);
|
int rv UNUSED = sigaction(InterruptSignal, &sa, 0);
|
||||||
assert(this, rv == 0);
|
assert(this, rv == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ class MySystem: public System {
|
|||||||
count -= *up;
|
count -= *up;
|
||||||
|
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
fprintf(stderr, "free " LD "; count: %d; limit: %d\n",
|
fprintf(stderr, "free %"LD"; count: %d; limit: %d\n",
|
||||||
*up, count, limit);
|
*up, count, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ class MySystem: public System {
|
|||||||
virtual Status start(Runnable* r) {
|
virtual Status start(Runnable* r) {
|
||||||
Thread* t = new (System::allocate(sizeof(Thread))) Thread(this, r);
|
Thread* t = new (System::allocate(sizeof(Thread))) Thread(this, r);
|
||||||
r->attach(t);
|
r->attach(t);
|
||||||
int rv = pthread_create(&(t->thread), 0, run, r);
|
int rv UNUSED = pthread_create(&(t->thread), 0, run, r);
|
||||||
assert(this, rv == 0);
|
assert(this, rv == 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,7 @@ expect(System* s, bool v)
|
|||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
|
||||||
inline void
|
# define assert(a, b)
|
||||||
assert(System*, bool)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
#else // not NDEBUG
|
#else // not NDEBUG
|
||||||
|
|
||||||
|
@ -1023,7 +1023,7 @@ writeAccessor(Output* out, Object* member, Object* offset, bool unsafe = false)
|
|||||||
out->write(capitalize(::typeName(memberOwner(member))));
|
out->write(capitalize(::typeName(memberOwner(member))));
|
||||||
out->write("*");
|
out->write("*");
|
||||||
} else {
|
} else {
|
||||||
out->write("(Thread* t, object");
|
out->write("(Thread* t UNUSED, object");
|
||||||
}
|
}
|
||||||
out->write(" o");
|
out->write(" o");
|
||||||
if (member->type != Object::Scalar) {
|
if (member->type != Object::Scalar) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user