mirror of
https://github.com/corda/corda.git
synced 2025-01-16 01:40:17 +00:00
stack trace work
This commit is contained in:
parent
c34ee64988
commit
b8e009075c
19
classpath/TestExceptions.java
Normal file
19
classpath/TestExceptions.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
public class TestExceptions {
|
||||||
|
|
||||||
|
private static void evenMoreDangerous() {
|
||||||
|
throw new RuntimeException("chaos! panic! overwhelming anxiety!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void moreDangerous() {
|
||||||
|
evenMoreDangerous();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void dangerous() {
|
||||||
|
moreDangerous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
dangerous();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
classpath/java/lang/Error.java
Normal file
19
classpath/java/lang/Error.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package java.lang;
|
||||||
|
|
||||||
|
public class Error extends Throwable {
|
||||||
|
public Error(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Error(String message) {
|
||||||
|
this(message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Error(Throwable cause) {
|
||||||
|
this(null, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Error() {
|
||||||
|
this(null, null);
|
||||||
|
}
|
||||||
|
}
|
19
classpath/java/lang/Exception.java
Normal file
19
classpath/java/lang/Exception.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package java.lang;
|
||||||
|
|
||||||
|
public class Exception extends Throwable {
|
||||||
|
public Exception(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Exception(String message) {
|
||||||
|
this(message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Exception(Throwable cause) {
|
||||||
|
this(null, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Exception() {
|
||||||
|
this(null, null);
|
||||||
|
}
|
||||||
|
}
|
19
classpath/java/lang/RuntimeException.java
Normal file
19
classpath/java/lang/RuntimeException.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package java.lang;
|
||||||
|
|
||||||
|
public class RuntimeException extends Exception {
|
||||||
|
public RuntimeException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RuntimeException(String message) {
|
||||||
|
this(message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RuntimeException(Throwable cause) {
|
||||||
|
this(null, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RuntimeException() {
|
||||||
|
this(null, null);
|
||||||
|
}
|
||||||
|
}
|
8
classpath/java/lang/StackTraceElement.java
Normal file
8
classpath/java/lang/StackTraceElement.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package java.lang;
|
||||||
|
|
||||||
|
public class StackTraceElement {
|
||||||
|
private Object method;
|
||||||
|
private int ip;
|
||||||
|
|
||||||
|
private StackTraceElement() { }
|
||||||
|
}
|
@ -7,7 +7,7 @@ public class Throwable {
|
|||||||
|
|
||||||
public Throwable(String message, Throwable cause) {
|
public Throwable(String message, Throwable cause) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.trace = trace(1);
|
this.trace = trace(0);
|
||||||
this.cause = cause;
|
this.cause = cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
makefile
11
makefile
@ -36,6 +36,7 @@ stress-cflags = -DDEBUG_MEMORY -DDEBUG_MEMORY_MAJOR
|
|||||||
|
|
||||||
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(bld)/%.o,$(x)))
|
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(bld)/%.o,$(x)))
|
||||||
asm-objects = $(foreach x,$(1),$(patsubst $(2)/%.S,$(bld)/%.o,$(x)))
|
asm-objects = $(foreach x,$(1),$(patsubst $(2)/%.S,$(bld)/%.o,$(x)))
|
||||||
|
java-classes = $(foreach x,$(1),$(patsubst $(2)/%.java,$(bld)/%.class,$(x)))
|
||||||
|
|
||||||
stdcpp-sources = $(src)/stdc++.cpp
|
stdcpp-sources = $(src)/stdc++.cpp
|
||||||
stdcpp-objects = $(call cpp-objects,$(stdcpp-sources),$(src))
|
stdcpp-objects = $(call cpp-objects,$(stdcpp-sources),$(src))
|
||||||
@ -122,10 +123,14 @@ fast-objects = \
|
|||||||
fast-executable = $(bld)/fast-vm
|
fast-executable = $(bld)/fast-vm
|
||||||
fast-cflags = $(fast) $(cflags)
|
fast-cflags = $(fast) $(cflags)
|
||||||
|
|
||||||
|
classpath-sources = $(shell find %(classpath)/java -name '*.java')
|
||||||
|
classpath-classes = $(call java-classes,$(classpath-sources),$(classpath))
|
||||||
|
|
||||||
input = $(bld)/classes/TestExceptions.class
|
input = $(bld)/classes/TestExceptions.class
|
||||||
# input-depends = \
|
input-depends = \
|
||||||
# $(bld)/classes/java/lang/System.class \
|
$(bld)/classes/java/lang/System.class \
|
||||||
# $(jni-library)
|
$(bld)/classes/java/lang/Throwable.class \
|
||||||
|
$(jni-library)
|
||||||
|
|
||||||
gen-run-arg = $(shell echo $(1) | sed -e 's:$(bld)/classes/\(.*\)\.class:\1:')
|
gen-run-arg = $(shell echo $(1) | sed -e 's:$(bld)/classes/\(.*\)\.class:\1:')
|
||||||
args = -cp $(bld)/classes -hs 67108864 $(call gen-run-arg,$(input))
|
args = -cp $(bld)/classes -hs 67108864 $(call gen-run-arg,$(input))
|
||||||
|
@ -2532,7 +2532,7 @@ run(Thread* t)
|
|||||||
if (UNLIKELY(exception)) goto throw_;
|
if (UNLIKELY(exception)) goto throw_;
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
//fprintf(stderr, "ip: %d; instruction: 0x%x\n", ip, codeBody(t, code, ip));
|
// fprintf(stderr, "ip: %d; instruction: 0x%x\n", ip, codeBody(t, code, ip));
|
||||||
|
|
||||||
switch (codeBody(t, code, ip++)) {
|
switch (codeBody(t, code, ip++)) {
|
||||||
case aaload: {
|
case aaload: {
|
||||||
@ -3713,8 +3713,7 @@ run(Thread* t)
|
|||||||
} goto loop;
|
} goto loop;
|
||||||
|
|
||||||
case putfield: {
|
case putfield: {
|
||||||
object instance = pop(t);
|
if (LIKELY(stack[sp - 2])) {
|
||||||
if (LIKELY(instance)) {
|
|
||||||
uint8_t index1 = codeBody(t, code, ip++);
|
uint8_t index1 = codeBody(t, code, ip++);
|
||||||
uint8_t index2 = codeBody(t, code, ip++);
|
uint8_t index2 = codeBody(t, code, ip++);
|
||||||
uint16_t index = (index1 << 8) | index2;
|
uint16_t index = (index1 << 8) | index2;
|
||||||
@ -3723,6 +3722,7 @@ run(Thread* t)
|
|||||||
if (UNLIKELY(exception)) goto throw_;
|
if (UNLIKELY(exception)) goto throw_;
|
||||||
|
|
||||||
object value = pop(t);
|
object value = pop(t);
|
||||||
|
object instance = pop(t);
|
||||||
setField(t, instance, field, value);
|
setField(t, instance, field, value);
|
||||||
} else {
|
} else {
|
||||||
exception = makeNullPointerException(t);
|
exception = makeNullPointerException(t);
|
||||||
|
Loading…
Reference in New Issue
Block a user