Skip to content

Commit 7465ad6

Browse files
committed
Documentation and cleanup
1 parent 2566ec2 commit 7465ad6

File tree

9 files changed

+607
-114
lines changed

9 files changed

+607
-114
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/BinaryOps.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
import com.oracle.graal.python.annotations.GenerateEnumConstants;
4444

45+
/** Operation identifiers for {@link OpCodes#BINARY_OP}. */
4546
@GenerateEnumConstants
4647
public enum BinaryOps {
4748
ADD,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/Block.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
import java.util.ArrayList;
4444
import java.util.EnumSet;
4545

46+
/**
47+
* Block of instructions. Not always exactly like basic block, we allow having jumps in the middle.
48+
*/
4649
final class Block {
4750
ArrayList<Instruction> instr = new ArrayList<>();
4851
Block next;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/BlockInfo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242

4343
import com.oracle.graal.python.pegparser.sst.StmtTy;
4444

45+
/**
46+
* Linked stack of block-related information needed to unwind execution before {@code break},
47+
* {@code continue} or {@code return}.
48+
*/
4549
class BlockInfo {
4650
BlockInfo outer;
4751

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/CodeUnit.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
import com.oracle.graal.python.compiler.OpCodes.CollectionBits;
5252
import com.oracle.graal.python.util.PythonUtils;
5353

54+
/**
55+
* A context-independent representation of code for bytecode interpreter. Contains the actual
56+
* bytecode and all the related data, like constants or exception handler ranges. It doesn't contain
57+
* the filename to make it easier to keep in native images.
58+
*/
5459
public final class CodeUnit {
5560
public static final int HAS_DEFAULTS = 0x1;
5661
public static final int HAS_KWONLY_DEFAULTS = 0x2;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/Compiler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@
144144
import com.oracle.graal.python.pegparser.sst.StmtTy;
145145
import com.oracle.graal.python.util.PythonUtils;
146146

147+
/**
148+
* Compiler for bytecode interpreter.
149+
*/
147150
public class Compiler implements SSTreeVisitor<Void> {
148151
public static final int BYTECODE_VERSION = 20;
149152

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/FormatOptions.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,32 @@
4141
package com.oracle.graal.python.compiler;
4242

4343
public abstract class FormatOptions {
44+
/**
45+
* Mask to extract just the conversion type flags.
46+
*/
4447
public static final int FVC_MASK = 0x3;
48+
/**
49+
* No conversion (identity function).
50+
*/
4551
public static final int FVC_NONE = 0x0;
52+
/**
53+
* Conversion equivalent to builtin {@code str}
54+
*/
4655
public static final int FVC_STR = 0x1;
56+
/**
57+
* Conversion equivalent to builtin {@code repr}
58+
*/
4759
public static final int FVC_REPR = 0x2;
60+
/**
61+
* Conversion equivalent to builtin {@code ascii}
62+
*/
4863
public static final int FVC_ASCII = 0x3;
64+
/**
65+
* Mask to extract just the spec flag.
66+
*/
4967
public static final int FVS_MASK = 0x4;
68+
/**
69+
* Whether a format spec is present.
70+
*/
5071
public static final int FVS_HAVE_SPEC = 0x4;
5172
}

0 commit comments

Comments
 (0)