Skip to content

Commit 07211fe

Browse files
committed
Remove old ThreadState
1 parent 0927888 commit 07211fe

File tree

1 file changed

+0
-71
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/function

1 file changed

+0
-71
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/function/PArguments.java

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,14 @@
2626
package com.oracle.graal.python.builtins.objects.function;
2727

2828
import com.oracle.graal.python.builtins.objects.cell.PCell;
29-
import com.oracle.graal.python.builtins.objects.dict.PDict;
3029
import com.oracle.graal.python.builtins.objects.frame.PFrame;
31-
import com.oracle.graal.python.builtins.objects.frame.PFrame.Reference;
3230
import com.oracle.graal.python.builtins.objects.object.PythonObject;
3331
import com.oracle.graal.python.runtime.exception.PException;
3432
import com.oracle.graal.python.util.PythonUtils;
3533
import com.oracle.truffle.api.CompilerAsserts;
36-
import com.oracle.truffle.api.CompilerDirectives.ValueType;
37-
import com.oracle.truffle.api.Truffle;
3834
import com.oracle.truffle.api.frame.Frame;
39-
import com.oracle.truffle.api.frame.FrameDescriptor;
4035
import com.oracle.truffle.api.frame.MaterializedFrame;
4136
import com.oracle.truffle.api.frame.VirtualFrame;
42-
import com.oracle.truffle.api.profiles.ConditionProfile;
4337

4438
//@formatter:off
4539
/**
@@ -69,22 +63,9 @@
6963
* | ... |
7064
* | arg_(nArgs-1) |
7165
* +-------------------+
72-
*
73-
* The layout of a generator frame (stored in INDEX_GENERATOR_FRAME in the figure above)
74-
* is different in on place:
75-
*
76-
* MaterializedFrame
77-
* |
78-
* | ....
79-
* | | |
80-
* | +----------------------+
81-
* INDEX_CALLER_FRAME_INFO -> | PDict (locals) |
82-
* +----------------------+
83-
* | .... |
8466
*/
8567
//@formatter:on
8668
public final class PArguments {
87-
private static final FrameDescriptor EMTPY_FD = new FrameDescriptor();
8869

8970
private static final int INDEX_VARIABLE_ARGUMENTS = 0;
9071
private static final int INDEX_KEYWORD_ARGUMENTS = 1;
@@ -334,25 +315,9 @@ public static void setGeneratorFunction(Object[] arguments, PFunction generatorF
334315
arguments[INDEX_GENERATOR_FRAME] = generatorFunction;
335316
}
336317

337-
public static void setGeneratorFrameLocals(Object[] arguments, PDict locals) {
338-
arguments[INDEX_CALLER_FRAME_INFO] = locals;
339-
}
340-
341-
public static PDict getGeneratorFrameLocals(Frame frame) {
342-
return getGeneratorFrameLocals(frame.getArguments());
343-
}
344-
345-
public static PDict getGeneratorFrameLocals(Object[] arguments) {
346-
return (PDict) arguments[INDEX_CALLER_FRAME_INFO];
347-
}
348-
349318
/**
350319
* Synchronizes the arguments array of a Truffle frame with a {@link PFrame}. Copies only those
351320
* arguments that are necessary to be synchronized between the two.
352-
*
353-
* NOTE: such arguments usually need to be preserved in {@link ThreadState} so that when we are
354-
* materializing a frame restored from {@link ThreadState}, the newly created instance of
355-
* {@link PFrame} will contain those arguments.
356321
*/
357322
public static void synchronizeArgs(Frame frameToMaterialize, PFrame escapedFrame) {
358323
Object[] arguments = frameToMaterialize.getArguments();
@@ -368,40 +333,4 @@ public static void synchronizeArgs(Frame frameToMaterialize, PFrame escapedFrame
368333

369334
escapedFrame.setArguments(copiedArgs);
370335
}
371-
372-
public static ThreadState getThreadState(VirtualFrame frame) {
373-
assert frame != null : "cannot get thread state without a frame";
374-
return new ThreadState(PArguments.getCurrentFrameInfo(frame),
375-
PArguments.getExceptionUnchecked(frame.getArguments()),
376-
PArguments.getGlobals(frame));
377-
}
378-
379-
public static ThreadState getThreadStateOrNull(VirtualFrame frame, ConditionProfile hasFrameProfile) {
380-
return hasFrameProfile.profile(frame != null) ? getThreadState(frame) : null;
381-
}
382-
383-
public static VirtualFrame frameForCall(ThreadState frame) {
384-
Object[] args = PArguments.create();
385-
PArguments.setCurrentFrameInfo(args, frame.info);
386-
PArguments.setExceptionUnchecked(args, frame.exc);
387-
args[INDEX_GLOBALS_ARGUMENT] = frame.globals;
388-
return Truffle.getRuntime().createVirtualFrame(args, EMTPY_FD);
389-
}
390-
391-
/**
392-
* Represents the current thread state information that needs to be passed between calls.
393-
*/
394-
@ValueType
395-
public static final class ThreadState {
396-
private final PFrame.Reference info;
397-
// The type is object because it is Object in the frame and casting it slows things down
398-
private final Object exc;
399-
private final Object globals;
400-
401-
private ThreadState(Reference info, Object exc, Object globals) {
402-
this.info = info;
403-
this.exc = exc;
404-
this.globals = globals;
405-
}
406-
}
407336
}

0 commit comments

Comments
 (0)