Compare commits
1 Commits
332344073a
...
89c0799767
Author | SHA1 | Date | |
---|---|---|---|
89c0799767 |
@ -409,7 +409,7 @@ void vm_exception(struct vm * vm, struct objectref * objectref)
|
||||
printc(')');
|
||||
prints("\n ");
|
||||
struct arrayref * arrayref = string_objectref->aref[0];
|
||||
print_chars(arrayref->u16, arrayref->length);
|
||||
print__string(arrayref->u8, arrayref->length);
|
||||
printc('\n');
|
||||
}
|
||||
}
|
||||
|
16
c/native.c
16
c/native.c
@ -88,21 +88,9 @@ const static struct native_method native_method[] = {
|
||||
},
|
||||
{
|
||||
.class_name = "java/io/PrintStream",
|
||||
.method_name = "_write",
|
||||
.method_name = "write",
|
||||
.method_descriptor = "([B)V",
|
||||
.func = native_java_io_printstream_write_ba_1,
|
||||
},
|
||||
{
|
||||
.class_name = "java/io/PrintStream",
|
||||
.method_name = "_write",
|
||||
.method_descriptor = "([C)V",
|
||||
.func = native_java_io_printstream_write_ca_1,
|
||||
},
|
||||
{
|
||||
.class_name = "java/io/PrintStream",
|
||||
.method_name = "_write",
|
||||
.method_descriptor = "(Ljava/lang/String;)V",
|
||||
.func = native_java_io_printstream_write_s_1,
|
||||
.func = native_java_io_printstream_write_1,
|
||||
},
|
||||
{
|
||||
.class_name = "jvm/internal/Loader",
|
||||
|
@ -2,21 +2,8 @@
|
||||
#include "printstream.h"
|
||||
#include "printf.h"
|
||||
|
||||
void native_java_io_printstream_write_ba_1(struct vm * vm, uint32_t * args)
|
||||
void native_java_io_printstream_write_1(struct vm * vm, uint32_t * args)
|
||||
{
|
||||
struct arrayref * arrayref = (struct arrayref *)args[0];
|
||||
print_bytes(arrayref->u8, arrayref->length);
|
||||
}
|
||||
|
||||
void native_java_io_printstream_write_ca_1(struct vm * vm, uint32_t * args)
|
||||
{
|
||||
struct arrayref * arrayref = (struct arrayref *)args[0];
|
||||
print_chars(arrayref->u16, arrayref->length);
|
||||
}
|
||||
|
||||
void native_java_io_printstream_write_s_1(struct vm * vm, uint32_t * args)
|
||||
{
|
||||
struct objectref * objectref = (struct objectref *)args[0];
|
||||
struct arrayref * arrayref = objectref->aref[0];
|
||||
print_chars(arrayref->u16, arrayref->length);
|
||||
print_string((const char *)arrayref->u8, arrayref->length);
|
||||
}
|
||||
|
@ -4,6 +4,4 @@
|
||||
|
||||
#include "frame.h"
|
||||
|
||||
void native_java_io_printstream_write_ba_1(struct vm * vm, uint32_t * args);
|
||||
void native_java_io_printstream_write_ca_1(struct vm * vm, uint32_t * args);
|
||||
void native_java_io_printstream_write_s_1(struct vm * vm, uint32_t * args);
|
||||
void native_java_io_printstream_write_1(struct vm * vm, uint32_t * args);
|
||||
|
14
c/printf.c
14
c/printf.c
@ -78,20 +78,6 @@ void print_string(const char * s, int length)
|
||||
}
|
||||
}
|
||||
|
||||
void print_bytes(const uint8_t * s, int length)
|
||||
{
|
||||
for (int i = 0; i < length; i++) {
|
||||
print_char(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void print_chars(const uint16_t * s, int length)
|
||||
{
|
||||
for (int i = 0; i < length; i++) {
|
||||
print_char(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void print_cstring(const char * s)
|
||||
{
|
||||
while (*s != 0) {
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -22,8 +20,6 @@ static inline void print_char(char c)
|
||||
}
|
||||
|
||||
void print_string(const char * s, int length);
|
||||
void print_bytes(const uint8_t * s, int length);
|
||||
void print_chars(const uint16_t * s, int length);
|
||||
void print_cstring(const char * s);
|
||||
|
||||
void _printf(const char * format, ...);
|
||||
|
@ -10,94 +10,94 @@ public class PrintStream
|
||||
|
||||
private static final byte[] newline = {'\n'};
|
||||
|
||||
private static native void _write(byte[] buf);
|
||||
public static native void write(byte[] buf);
|
||||
|
||||
private static native void _write(char[] buf);
|
||||
|
||||
private static native void _write(String s);
|
||||
public static void write(String s) {
|
||||
write(s.getBytes());
|
||||
}
|
||||
|
||||
public void print(byte[] buf) {
|
||||
_write(buf);
|
||||
write(buf);
|
||||
}
|
||||
|
||||
public void print(boolean b) {
|
||||
_write(String.valueOf(b));
|
||||
write(String.valueOf(b));
|
||||
}
|
||||
|
||||
public void print(char c) {
|
||||
_write(String.valueOf(c));
|
||||
write(String.valueOf(c));
|
||||
}
|
||||
|
||||
public void print(int i) {
|
||||
_write(String.valueOf(i));
|
||||
write(String.valueOf(i));
|
||||
}
|
||||
|
||||
public void print(long l) {
|
||||
_write(String.valueOf(l));
|
||||
write(String.valueOf(l));
|
||||
}
|
||||
|
||||
public void print(float f) {
|
||||
_write(String.valueOf(f));
|
||||
write(String.valueOf(f));
|
||||
}
|
||||
|
||||
public void print(double d) {
|
||||
_write(String.valueOf(d));
|
||||
write(String.valueOf(d));
|
||||
}
|
||||
|
||||
public void print(Object obj) {
|
||||
_write(String.valueOf(obj));
|
||||
write(String.valueOf(obj));
|
||||
}
|
||||
|
||||
public void print(String s) {
|
||||
_write(String.valueOf(s));
|
||||
write(String.valueOf(s));
|
||||
}
|
||||
|
||||
public void println() {
|
||||
_write(newline);
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(byte[] buf) {
|
||||
_write(buf);
|
||||
_write(newline);
|
||||
write(buf);
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(boolean b) {
|
||||
_write(String.valueOf(b));
|
||||
_write(newline);
|
||||
write(String.valueOf(b));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(char c) {
|
||||
_write(String.valueOf(c));
|
||||
_write(newline);
|
||||
write(String.valueOf(c));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(int i) {
|
||||
_write(String.valueOf(i));
|
||||
_write(newline);
|
||||
write(String.valueOf(i));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(long l) {
|
||||
_write(String.valueOf(l));
|
||||
_write(newline);
|
||||
write(String.valueOf(l));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(float f) {
|
||||
_write(String.valueOf(f));
|
||||
_write(newline);
|
||||
write(String.valueOf(f));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(double d) {
|
||||
_write(String.valueOf(d));
|
||||
_write(newline);
|
||||
write(String.valueOf(d));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(Object obj) {
|
||||
_write(String.valueOf(obj));
|
||||
_write(newline);
|
||||
write(String.valueOf(obj));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(String s) {
|
||||
_write(String.valueOf(s));
|
||||
_write(newline);
|
||||
write(String.valueOf(s));
|
||||
write(newline);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class ArithmeticException extends RuntimeException {
|
||||
|
||||
public ArithmeticException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ArithmeticException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
|
||||
|
||||
ArrayIndexOutOfBoundsException() {
|
||||
super();
|
||||
}
|
||||
|
||||
ArrayIndexOutOfBoundsException(int index) {
|
||||
super(String.valueOf(index));
|
||||
}
|
||||
|
||||
ArrayIndexOutOfBoundsException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class ArrayStoreException extends RuntimeException {
|
||||
public ArrayStoreException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ArrayStoreException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package java.lang;
|
||||
|
||||
class Character
|
||||
implements Comparable<Character> {
|
||||
class Character {
|
||||
public static final int MAX_RADIX = 36;
|
||||
|
||||
public static final int MAX_VALUE = '\uFFFF';
|
||||
|
@ -1,12 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class ClassCastException extends RuntimeException {
|
||||
|
||||
public ClassCastException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ClassCastException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class ClassNotFoundException extends RuntimeException {
|
||||
|
||||
public ClassNotFoundException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ClassNotFoundException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public ClassNotFoundException(String s,
|
||||
Throwable ex) {
|
||||
super(s, ex);
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class CloneNotSupportedException extends RuntimeException {
|
||||
|
||||
public CloneNotSupportedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CloneNotSupportedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class IllegalAccessException extends Exception {
|
||||
|
||||
public IllegalAccessException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IllegalAccessException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class IllegalArgumentException extends RuntimeException {
|
||||
|
||||
public IllegalArgumentException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IllegalArgumentException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public IllegalArgumentException(String message,
|
||||
Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public IllegalArgumentException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class IllegalMonitorStateException extends RuntimeException {
|
||||
|
||||
public IllegalMonitorStateException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IllegalMonitorStateException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class IllegalStateException extends RuntimeException {
|
||||
|
||||
public IllegalStateException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IllegalStateException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public IllegalStateException(String message,
|
||||
Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public IllegalStateException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class IllegalThreadStateException extends RuntimeException {
|
||||
|
||||
public IllegalThreadStateException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IllegalThreadStateException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,12 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class IndexOutOfBoundsException extends RuntimeException {
|
||||
|
||||
public IndexOutOfBoundsException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IndexOutOfBoundsException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class InstantiationException extends Exception {
|
||||
|
||||
public InstantiationException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InstantiationException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class InterruptedException extends Exception {
|
||||
|
||||
public InterruptedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InterruptedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,12 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class NegativeArraySizeException extends RuntimeException {
|
||||
|
||||
public NegativeArraySizeException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NegativeArraySizeException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class NullPointerException extends RuntimeException {
|
||||
|
||||
public NullPointerException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NullPointerException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class NumberFormatException extends IllegalArgumentException {
|
||||
|
||||
public NumberFormatException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NumberFormatException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,20 +1,4 @@
|
||||
package java.lang;
|
||||
|
||||
public class RuntimeException extends Exception {
|
||||
public RuntimeException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public RuntimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public RuntimeException(String message,
|
||||
Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public RuntimeException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class SecurityException extends RuntimeException {
|
||||
|
||||
public SecurityException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SecurityException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public SecurityException(String message,
|
||||
Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public SecurityException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
|
||||
|
||||
public StringIndexOutOfBoundsException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public StringIndexOutOfBoundsException(int index) {
|
||||
super(index);
|
||||
}
|
||||
|
||||
public StringIndexOutOfBoundsException(String s) {
|
||||
super(s);
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package java.lang;
|
||||
|
||||
public class UnsupportedOperationException extends RuntimeException {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user