Skip to content

Commit a1077ba

Browse files
committed
Fix style and warnings
1 parent 21844b8 commit a1077ba

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@
5959
import com.oracle.graal.python.builtins.objects.cext.hpy.HPyMode;
6060
import com.oracle.graal.python.lib.PyObjectGetItem;
6161
import com.oracle.graal.python.nodes.ErrorMessages;
62+
import com.oracle.graal.python.nodes.PConstructAndRaiseNode;
6263
import com.oracle.graal.python.nodes.SpecialAttributeNames;
6364
import com.oracle.graal.python.nodes.attributes.WriteAttributeToObjectNode;
64-
import com.oracle.graal.python.nodes.PConstructAndRaiseNode;
65-
import com.oracle.graal.python.nodes.PRaiseNode;
6665
import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode;
6766
import com.oracle.graal.python.nodes.function.builtins.PythonClinicBuiltinNode;
6867
import com.oracle.graal.python.nodes.function.builtins.clinic.ArgumentClinicProvider;
@@ -156,8 +155,10 @@ protected ArgumentClinicProvider getArgumentClinic() {
156155

157156
@Specialization
158157
Object doGeneric(VirtualFrame frame, TruffleString name, TruffleString extName, Object pkg, TruffleString file, Object loader, Object spec, Object env,
158+
@Bind("this") Node inliningTarget,
159159
@Cached TruffleString.EqualNode eqNode,
160-
@Cached WriteAttributeToObjectNode writeAttrNode) {
160+
@Cached WriteAttributeToObjectNode writeAttrNode,
161+
@Cached PConstructAndRaiseNode.Lazy constructAndRaiseNode) {
161162
Object module;
162163

163164
PythonContext context = getContext();
@@ -170,11 +171,11 @@ Object doGeneric(VirtualFrame frame, TruffleString name, TruffleString extName,
170171
// thrown by getHPyModeFromEnviron if value is not a string
171172
throw raise(PythonBuiltinClassType.TypeError, ErrorMessages.HPY_MODE_VALUE_MUST_BE_STRING);
172173
} catch (ApiInitException ie) {
173-
throw ie.reraise(getConstructAndRaiseNode(), frame);
174+
throw ie.reraise(frame, inliningTarget, constructAndRaiseNode);
174175
} catch (ImportException ie) {
175-
throw ie.reraise(getConstructAndRaiseNode(), frame);
176+
throw ie.reraise(frame, inliningTarget, constructAndRaiseNode);
176177
} catch (IOException e) {
177-
throw getConstructAndRaiseNode().raiseOSError(frame, e, eqNode);
178+
throw constructAndRaiseNode.get(inliningTarget).raiseOSError(frame, e, eqNode);
178179
} finally {
179180
IndirectCallContext.exit(frame, language, context, state);
180181
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ static long[] now(VirtualFrame frame, PNone times, PNone ns) {
18631863
@Specialization(guards = {"isNoValue(ns)"})
18641864
long[] times(VirtualFrame frame, PTuple times, @SuppressWarnings("unused") PNone ns,
18651865
@Bind("this") Node inliningTarget,
1866-
@Shared @Cached LenNode lenNode,
1866+
@Exclusive @Cached LenNode lenNode,
18671867
@Shared @Cached("createNotNormalized()") GetItemNode getItemNode,
18681868
@Cached ObjectToTimespecNode objectToTimespecNode) {
18691869
return convertToTimespec(frame, inliningTarget, times, lenNode, getItemNode, objectToTimespecNode);
@@ -1872,7 +1872,7 @@ long[] times(VirtualFrame frame, PTuple times, @SuppressWarnings("unused") PNone
18721872
@Specialization
18731873
long[] ns(VirtualFrame frame, @SuppressWarnings("unused") PNone times, PTuple ns,
18741874
@Bind("this") Node inliningTarget,
1875-
@Shared @Cached LenNode lenNode,
1875+
@Exclusive @Cached LenNode lenNode,
18761876
@Shared @Cached("createNotNormalized()") GetItemNode getItemNode,
18771877
@Cached SplitLongToSAndNsNode splitLongToSAndNsNode) {
18781878
return convertToTimespec(frame, inliningTarget, ns, lenNode, getItemNode, splitLongToSAndNsNode);
@@ -2709,7 +2709,7 @@ abstract static class StringOrBytesToOpaquePathNode extends Node {
27092709
static Object doString(Node inliningTarget, Object strObj,
27102710
@Cached CastToTruffleStringNode castToStringNode,
27112711
@Shared @CachedLibrary(limit = "1") PosixSupportLibrary posixLib,
2712-
@Shared @Cached PRaiseNode.Lazy raiseNode) {
2712+
@Exclusive @Cached PRaiseNode.Lazy raiseNode) {
27132713
TruffleString str = castToStringNode.execute(inliningTarget, strObj);
27142714
return checkPath(inliningTarget, posixLib.createPathFromString(PosixSupport.get(inliningTarget), str), raiseNode);
27152715
}
@@ -2718,7 +2718,7 @@ static Object doString(Node inliningTarget, Object strObj,
27182718
static Object doBytes(Node inliningTarget, PBytes bytes,
27192719
@Cached(inline = false) BytesNodes.ToBytesNode toBytesNode,
27202720
@Shared @CachedLibrary(limit = "1") PosixSupportLibrary posixLib,
2721-
@Shared @Cached PRaiseNode.Lazy raiseNode) {
2721+
@Exclusive @Cached PRaiseNode.Lazy raiseNode) {
27222722
return checkPath(inliningTarget, posixLib.createPathFromBytes(PosixSupport.get(inliningTarget), toBytesNode.execute(bytes)), raiseNode);
27232723
}
27242724

@@ -2821,7 +2821,7 @@ static void doLong(long value, long[] timespec, int offset) {
28212821
@Specialization(guards = {"!isDouble(value)", "!isPFloat(value)", "!isInteger(value)"})
28222822
static void doGeneric(VirtualFrame frame, Node inliningTarget, Object value, long[] timespec, int offset,
28232823
@Cached PyLongAsLongAndOverflowNode asLongNode,
2824-
@Shared @Cached PRaiseNode.Lazy raiseNode) {
2824+
@Exclusive @Cached PRaiseNode.Lazy raiseNode) {
28252825
try {
28262826
timespec[offset] = asLongNode.execute(frame, inliningTarget, value);
28272827
} catch (OverflowException e) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ protected ArgumentClinicProvider getArgumentClinic() {
9494
@SuppressWarnings("unused")
9595
@Specialization
9696
Object openKey(VirtualFrame frame, Object key, Object subKey, Object reserved, Object access,
97-
@Bind("this") Node inliningTarget,
98-
@Cached PConstructAndRaiseNode.Lazy constructAndRaiseNode) {
97+
@Bind("this") Node inliningTarget,
98+
@Cached PConstructAndRaiseNode.Lazy constructAndRaiseNode) {
9999
if (key instanceof Integer intKey) {
100100
if (intKey == HKEY_CLASSES_ROOT) {
101101
return factory().createLock();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/io/FileIOBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ protected ArgumentClinicProvider getArgumentClinic() {
722722
@GenerateNodeFactory
723723
public abstract static class WriteNode extends PythonBinaryBuiltinNode {
724724

725-
@Specialization(guards = {"!self.isClosed()", "self.isWritable()", "!self.isUTF8Write()"})
725+
@Specialization(guards = {"!self.isClosed()", "self.isWritable()"})
726726
Object write(VirtualFrame frame, PFileIO self, Object data,
727727
@Bind("this") Node inliningTarget,
728728
@Cached GetBytesToWriteNode getBytesToWriteNode,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/mmap/MMapBuiltins.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
import com.oracle.truffle.api.dsl.Bind;
128128
import com.oracle.truffle.api.dsl.Cached;
129129
import com.oracle.truffle.api.dsl.Cached.Exclusive;
130-
import com.oracle.truffle.api.dsl.Cached.Shared;
131130
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
132131
import com.oracle.truffle.api.dsl.NeverDefault;
133132
import com.oracle.truffle.api.dsl.NodeFactory;
@@ -235,7 +234,7 @@ int doSingle(VirtualFrame frame, PMMap self, Object idxObj,
235234
@Bind("this") Node inliningTarget,
236235
@CachedLibrary("getPosixSupport()") PosixSupportLibrary posixSupportLib,
237236
@Cached PyLongAsLongNode asLongNode,
238-
@Shared @Cached PConstructAndRaiseNode.Lazy constructAndRaiseNode) {
237+
@Exclusive @Cached PConstructAndRaiseNode.Lazy constructAndRaiseNode) {
239238
long i = asLongNode.execute(frame, inliningTarget, idxObj);
240239
long len = self.getLength();
241240
long idx = i < 0 ? i + len : i;
@@ -258,7 +257,7 @@ Object doSlice(VirtualFrame frame, PMMap self, PSlice idx,
258257
@Cached CoerceToIntSlice sliceCast,
259258
@Cached ComputeIndices compute,
260259
@Cached LenOfRangeNode sliceLenNode,
261-
@Shared @Cached PConstructAndRaiseNode.Lazy constructAndRaiseNode) {
260+
@Exclusive @Cached PConstructAndRaiseNode.Lazy constructAndRaiseNode) {
262261
try {
263262
SliceInfo info = compute.execute(frame, sliceCast.execute(inliningTarget, idx), PInt.intValueExact(self.getLength()));
264263
int len = sliceLenNode.len(inliningTarget, info);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/socket/SocketUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PosixSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0

0 commit comments

Comments
 (0)