Skip to content

Commit 684dbef

Browse files
committed
Fix style
1 parent d907fe0 commit 684dbef

File tree

12 files changed

+44
-60
lines changed

12 files changed

+44
-60
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ public NodeFactory getNodeFactory() {
219219
}
220220

221221
/**
222-
* <b>DO NOT DIRECTLY USE THIS METHOD !!!</b>
223-
* Instead, use {@link PythonContext#getThreadState(PythonLanguage)}}.
222+
* <b>DO NOT DIRECTLY USE THIS METHOD !!!</b> Instead, use
223+
* {@link PythonContext#getThreadState(PythonLanguage)}}.
224224
*/
225225
public ContextThreadLocal<PythonThreadState> getThreadStateLocal() {
226226
return threadState;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/MarshalModuleBuiltins.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
import com.oracle.graal.python.nodes.function.builtins.clinic.ArgumentClinicProvider;
8080
import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile;
8181
import com.oracle.graal.python.runtime.ExecutionContext.IndirectCallContext;
82-
import com.oracle.graal.python.runtime.PythonContext;
8382
import com.oracle.graal.python.runtime.PythonContext.GetThreadStateNode;
8483
import com.oracle.graal.python.runtime.PythonContext.PythonThreadState;
8584
import com.oracle.graal.python.util.PythonUtils;
@@ -89,7 +88,6 @@
8988
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
9089
import com.oracle.truffle.api.Truffle;
9190
import com.oracle.truffle.api.dsl.Cached;
92-
import com.oracle.truffle.api.dsl.CachedContext;
9391
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
9492
import com.oracle.truffle.api.dsl.NodeFactory;
9593
import com.oracle.truffle.api.dsl.Specialization;
@@ -583,8 +581,7 @@ private Object readObjectBoundary(byte[] dataBytes) {
583581

584582
@Specialization
585583
Object readObject(VirtualFrame frame, byte[] dataBytes, @SuppressWarnings("unused") int version,
586-
@Cached GetThreadStateNode getThreadStateNode,
587-
@CachedContext(PythonLanguage.class) PythonContext context) {
584+
@Cached GetThreadStateNode getThreadStateNode) {
588585
PythonThreadState threadState = getThreadStateNode.execute();
589586
Object state = IndirectCallContext.enter(frame, threadState, this);
590587
try {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/PThreadState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static Object doOverflowed(PythonThreadState threadState, String key, int value)
390390
}
391391

392392
@Specialization(guards = {"!isCurrentExceptionMember(key)", "!isCaughtExceptionMember(key)"})
393-
static Object doGeneric(PythonThreadState threadState, Object key, @SuppressWarnings("unused") Object value) throws UnknownIdentifierException {
393+
static Object doGeneric(@SuppressWarnings("unused") PythonThreadState threadState, Object key, @SuppressWarnings("unused") Object value) throws UnknownIdentifierException {
394394
CompilerDirectives.transferToInterpreterAndInvalidate();
395395
throw UnknownIdentifierException.create(key.toString());
396396
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyNodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ public final void execute(GraalHPyContext nativeContext, PException e) {
197197

198198
@Specialization
199199
static void setCurrentException(Frame frame, GraalHPyContext nativeContext, PException e,
200-
@Cached GetCurrentFrameRef getCurrentFrameRef,
201-
@Cached GetThreadStateNode getThreadStateNode) {
200+
@Cached GetCurrentFrameRef getCurrentFrameRef,
201+
@Cached GetThreadStateNode getThreadStateNode) {
202202
// TODO connect f_back
203203
getCurrentFrameRef.execute(frame).markAsEscaped();
204204
getThreadStateNode.setCurrentException(nativeContext.getContext(), e);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/HPyExternalFunctionNodes.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
9898
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
9999
import com.oracle.truffle.api.Truffle;
100-
import com.oracle.truffle.api.TruffleLanguage.LanguageReference;
101100
import com.oracle.truffle.api.dsl.Cached;
102101
import com.oracle.truffle.api.dsl.Cached.Exclusive;
103102
import com.oracle.truffle.api.dsl.Cached.Shared;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/PythonObjectLibrary.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,13 @@
5454
import com.oracle.graal.python.builtins.objects.type.TypeNodes.IsSameTypeNode;
5555
import com.oracle.graal.python.builtins.objects.type.TypeNodesFactory.IsSameTypeNodeGen;
5656
import com.oracle.graal.python.nodes.ErrorMessages;
57-
import com.oracle.graal.python.nodes.IndirectCallNode;
5857
import com.oracle.graal.python.nodes.PRaiseNode;
5958
import com.oracle.graal.python.nodes.SpecialMethodNames;
6059
import com.oracle.graal.python.nodes.classes.IsSubtypeNode;
6160
import com.oracle.graal.python.nodes.classes.IsSubtypeNodeGen;
6261
import com.oracle.graal.python.nodes.object.GetClassNode;
63-
import com.oracle.graal.python.runtime.ExecutionContext.IndirectCallContext;
64-
import com.oracle.graal.python.runtime.PythonContext;
65-
import com.oracle.graal.python.runtime.PythonContext.GetThreadStateNode;
66-
import com.oracle.graal.python.runtime.PythonContext.PythonThreadState;
6762
import com.oracle.truffle.api.CompilerDirectives;
6863
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
69-
import com.oracle.truffle.api.TruffleLanguage.ContextReference;
7064
import com.oracle.truffle.api.frame.Frame;
7165
import com.oracle.truffle.api.frame.VirtualFrame;
7266
import com.oracle.truffle.api.interop.InteropLibrary;
@@ -1037,11 +1031,11 @@ public boolean isBuffer(Object receiver) {
10371031
/**
10381032
* Returns the length of the buffer, i.e. number of bytes.
10391033
*
1040-
* @param receiver a buffer object. Use {@See isBuffer} to check if the receiver is a buffer or
1041-
* not.
1034+
* @param receiver a buffer object. Use {@link #isBuffer(Object)} to check if the receiver is a
1035+
* buffer or not.
10421036
* @return Returns the length of the buffer
1043-
* @throws UnsupportedMessageException if the object is not a buffer. Use {@See isBuffer} to
1044-
* check if the receiver is a buffer or not.
1037+
* @throws UnsupportedMessageException if the object is not a buffer. Use
1038+
* {@link #isBuffer(Object)} to check if the receiver is a buffer or not.
10451039
*/
10461040
@Abstract(ifExported = {"isBuffer", "getBufferBytes"})
10471041
public int getBufferLength(Object receiver) throws UnsupportedMessageException {
@@ -1054,8 +1048,8 @@ public int getBufferLength(Object receiver) throws UnsupportedMessageException {
10541048
*
10551049
* @param receiver a buffer object.
10561050
* @return a byte array copy of the receiver's storage.
1057-
* @throws UnsupportedMessageException if the object is not a buffer. Use {@See isBuffer} to
1058-
* check if the receiver is a buffer or not.
1051+
* @throws UnsupportedMessageException if the object is not a buffer. Use
1052+
* {@link #isBuffer(Object)} to check if the receiver is a buffer or not.
10591053
*/
10601054
@Abstract(ifExported = {"isBuffer", "getBufferLength"})
10611055
public byte[] getBufferBytes(Object receiver) throws UnsupportedMessageException {
@@ -1070,7 +1064,7 @@ public byte[] getBufferBytes(Object receiver) throws UnsupportedMessageException
10701064
* {@code DefaultPythonObjectExports} implements the logic of how an unknown object is
10711065
* being checked.
10721066
*
1073-
* @param receiver
1067+
* @param receiver the receiver Object
10741068
* @return True if the receiver is a Foreign Object
10751069
*/
10761070

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str/StringBuiltins.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
import com.oracle.graal.python.nodes.util.CastToJavaStringNodeGen;
133133
import com.oracle.graal.python.runtime.ExecutionContext.IndirectCallContext;
134134
import com.oracle.graal.python.runtime.PythonContext;
135-
import com.oracle.graal.python.runtime.PythonContext.GetThreadStateNode;
136135
import com.oracle.graal.python.runtime.PythonContext.PythonThreadState;
137136
import com.oracle.graal.python.runtime.PythonOptions;
138137
import com.oracle.graal.python.runtime.exception.PException;
@@ -148,7 +147,6 @@
148147
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
149148
import com.oracle.truffle.api.dsl.Cached;
150149
import com.oracle.truffle.api.dsl.Cached.Shared;
151-
import com.oracle.truffle.api.dsl.CachedContext;
152150
import com.oracle.truffle.api.dsl.CachedLanguage;
153151
import com.oracle.truffle.api.dsl.Fallback;
154152
import com.oracle.truffle.api.dsl.GenerateNodeFactory;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/classes/IsSubtypeNode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ protected PythonBuiltinClassType getType(Object cls, ConditionProfile builtinTyp
120120
}
121121

122122
@Specialization(guards = "isSameType(isSameTypeNode, derived, cls)")
123+
@SuppressWarnings("unused")
123124
static boolean isIdentical(Object derived, Object cls,
124-
@SuppressWarnings("unused") @Cached IsSameTypeNode isSameTypeNode) {
125+
@Cached IsSameTypeNode isSameTypeNode) {
125126
// trivial case: derived == cls
126127
return true;
127128
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/control/TopLevelExceptionHandler.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
7676
import com.oracle.truffle.api.RootCallTarget;
7777
import com.oracle.truffle.api.TruffleLanguage.ContextReference;
78-
import com.oracle.truffle.api.TruffleLanguage.LanguageReference;
7978
import com.oracle.truffle.api.frame.VirtualFrame;
8079
import com.oracle.truffle.api.interop.ExceptionType;
8180
import com.oracle.truffle.api.interop.InteropLibrary;
@@ -84,12 +83,11 @@
8483
import com.oracle.truffle.api.source.Source;
8584
import com.oracle.truffle.api.source.SourceSection;
8685

87-
public class TopLevelExceptionHandler extends RootNode {
86+
public final class TopLevelExceptionHandler extends RootNode {
8887
private final RootCallTarget innerCallTarget;
8988
private final PException exception;
9089
private final SourceSection sourceSection;
9190
private final Source source;
92-
@CompilationFinal private LanguageReference<PythonLanguage> language;
9391
@CompilationFinal private ContextReference<PythonContext> context;
9492

9593
@Child private GilNode gilNode = GilNode.create();
@@ -111,11 +109,7 @@ public TopLevelExceptionHandler(PythonLanguage language, PException exception) {
111109
}
112110

113111
private PythonLanguage getPythonLanguage() {
114-
if (language == null) {
115-
CompilerDirectives.transferToInterpreterAndInvalidate();
116-
language = lookupLanguageReference(PythonLanguage.class);
117-
}
118-
return language.get();
112+
return getLanguage(PythonLanguage.class);
119113
}
120114

121115
private PythonContext getContext() {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/expression/CastToListExpressionNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected PList starredGeneric(VirtualFrame frame, Object v,
167167
@Cached ConstructListNode constructListNode,
168168
@Cached IsBuiltinClassProfile attrProfile,
169169
@Cached PRaiseNode raise,
170-
@Shared("getThreadStateNode") @Cached GetThreadStateNode getThreadStateNode) {
170+
@Shared("getThreadStateNode") @Cached GetThreadStateNode getThreadStateNode) {
171171
PythonThreadState threadState = getThreadStateNode.execute();
172172
Object state = IndirectCallContext.enter(frame, threadState, this);
173173
try {

0 commit comments

Comments
 (0)