Skip to content

Commit

Permalink
code formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mhaupt committed Jul 22, 2017
1 parent c78ec01 commit f5b6144
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/som/compiler/Disassembler.java
Expand Up @@ -35,6 +35,7 @@

import static som.interpreter.Bytecodes.*;


public class Disassembler {

public static void dump(final SClass cl) {
Expand Down
47 changes: 24 additions & 23 deletions src/som/interpreter/Bytecodes.java
Expand Up @@ -27,6 +27,7 @@

import java.util.stream.Stream;


public class Bytecodes {

// Bytecodes used by the simple object machine
Expand All @@ -48,16 +49,16 @@ public class Bytecodes {
public static final byte RETURN_NON_LOCAL = 15;

private static final String[] PADDED_BYTECODE_NAMES = new String[] {
"HALT ", "DUP ", "PUSH_LOCAL ",
"PUSH_ARGUMENT ", "PUSH_FIELD ", "PUSH_BLOCK ",
"PUSH_CONSTANT ", "PUSH_GLOBAL ", "POP ",
"POP_LOCAL ", "POP_ARGUMENT ", "POP_FIELD ",
"SEND ", "SUPER_SEND ", "RETURN_LOCAL ",
"RETURN_NON_LOCAL"
"HALT ", "DUP ", "PUSH_LOCAL ",
"PUSH_ARGUMENT ", "PUSH_FIELD ", "PUSH_BLOCK ",
"PUSH_CONSTANT ", "PUSH_GLOBAL ", "POP ",
"POP_LOCAL ", "POP_ARGUMENT ", "POP_FIELD ",
"SEND ", "SUPER_SEND ", "RETURN_LOCAL ",
"RETURN_NON_LOCAL"
};

private static final String[] BYTECODE_NAMES =
Stream.of(PADDED_BYTECODE_NAMES).map(String::trim).toArray(String[]::new);
Stream.of(PADDED_BYTECODE_NAMES).map(String::trim).toArray(String[]::new);

private static final byte NUM_BYTECODES = (byte) BYTECODE_NAMES.length;

Expand All @@ -84,22 +85,22 @@ public static int getBytecodeLength(byte bytecode) {

// Static array holding lengths of each bytecode
private static final int[] BYTECODE_LENGTH = new int[] {
1, // HALT
1, // DUP
3, // PUSH_LOCAL
3, // PUSH_ARGUMENT
2, // PUSH_FIELD
2, // PUSH_BLOCK
2, // PUSH_CONSTANT
2, // PUSH_GLOBAL
1, // POP
3, // POP_LOCAL
3, // POP_ARGUMENT
2, // POP_FIELD
2, // SEND
2, // SUPER_SEND
1, // RETURN_LOCAL
1 // RETURN_NON_LOCAL
1, // HALT
1, // DUP
3, // PUSH_LOCAL
3, // PUSH_ARGUMENT
2, // PUSH_FIELD
2, // PUSH_BLOCK
2, // PUSH_CONSTANT
2, // PUSH_GLOBAL
1, // POP
3, // POP_LOCAL
3, // POP_ARGUMENT
2, // POP_FIELD
2, // SEND
2, // SUPER_SEND
1, // RETURN_LOCAL
1 // RETURN_NON_LOCAL
};

}
1 change: 1 addition & 0 deletions src/som/interpreter/Interpreter.java
Expand Up @@ -36,6 +36,7 @@

import static som.interpreter.Bytecodes.*;


public class Interpreter {

private final Universe universe;
Expand Down

0 comments on commit f5b6144

Please sign in to comment.