-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RD-10562 Implement OSR for iterators #352
Closed
Closed
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
0c55576
updated aggregations
alexzerntev 5046dfd
Headers
alexzerntev d04e19d
Finished joins
alexzerntev e5f17f0
Fixed tests
alexzerntev b6b4a35
Finished List OSR
alexzerntev bddc1cf
Added compilation finals
alexzerntev 1fa3144
Finished iterables
alexzerntev f0d0335
Finished json reader
alexzerntev 7131a7c
Merge remote-tracking branch 'origin/main' into RD-10562-implement-os…
alexzerntev 4e3d069
Updated some OSR nodes according to comments
alexzerntev 0efd125
finished list OSR
alexzerntev e376168
Updated compute next
alexzerntev 4325af9
format
alexzerntev e6ea58c
Updated compute next
alexzerntev 4db112c
Fix
alexzerntev bae21c9
Fix
alexzerntev 6827dc0
Fix
alexzerntev 61863b9
Fix
alexzerntev 66ff36b
fixes
alexzerntev a471176
test
alexzerntev e54533e
fix
alexzerntev a9f0673
fix
alexzerntev a82c9fc
wip
alexzerntev 637cbb4
wip
alexzerntev 41d966b
added std deviation to metrics
alexzerntev 8a05a1d
Added multirun
alexzerntev cd384cf
fixed filter OSR to use frame
alexzerntev 499dca6
added osr Auxiliary slots
alexzerntev c72a0a2
Applied frame changes
alexzerntev bf96ff7
wip
alexzerntev d7b1dbc
finished lists
alexzerntev bddc147
wip
alexzerntev 39922d6
finished OSR
alexzerntev f7ba5b4
fixed test
alexzerntev f3b117e
updated slots
alexzerntev c74d453
metrics
alexzerntev 98e5020
Merge remote-tracking branch 'origin/main' into RD-10562-implement-os…
alexzerntev ac9af7e
metrics
alexzerntev e9d6a13
improvement
alexzerntev a62e98b
metrics
alexzerntev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
snapi-truffle/src/main/java/raw/runtime/truffle/ast/osr/OSRGeneratorNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2023 RAW Labs S.A. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0, included in the file | ||
* licenses/APL.txt. | ||
*/ | ||
|
||
package raw.runtime.truffle.ast.osr; | ||
|
||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.nodes.Node; | ||
import com.oracle.truffle.api.nodes.RepeatingNode; | ||
import com.oracle.truffle.api.nodes.UnexpectedResultException; | ||
import raw.runtime.truffle.ExpressionNode; | ||
import raw.runtime.truffle.runtime.exceptions.RawTruffleInternalErrorException; | ||
|
||
public class OSRGeneratorNode extends Node implements RepeatingNode { | ||
|
||
@Child private ExpressionNode conditionNode; | ||
|
||
@Child private ExpressionNode bodyNode; | ||
|
||
public OSRGeneratorNode(ExpressionNode conditionNode, ExpressionNode bodyNode) { | ||
this.conditionNode = conditionNode; | ||
this.bodyNode = bodyNode; | ||
} | ||
|
||
public boolean executeRepeating(VirtualFrame frame) { | ||
try { | ||
if (conditionNode.executeBoolean(frame)) { | ||
bodyNode.executeVoid(frame); | ||
return true; | ||
} | ||
return false; | ||
} catch (UnexpectedResultException e) { | ||
throw new RawTruffleInternalErrorException(e); | ||
} | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
snapi-truffle/src/main/java/raw/runtime/truffle/ast/osr/filter/OSRListFilterBodyNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2023 RAW Labs S.A. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0, included in the file | ||
* licenses/APL.txt. | ||
*/ | ||
|
||
package raw.runtime.truffle.ast.osr.filter; | ||
|
||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import java.util.ArrayList; | ||
import raw.runtime.truffle.ExpressionNode; | ||
import raw.runtime.truffle.runtime.function.FunctionExecuteNodes; | ||
import raw.runtime.truffle.runtime.function.FunctionExecuteNodesFactory; | ||
import raw.runtime.truffle.runtime.generator.collection.GeneratorNodes; | ||
import raw.runtime.truffle.runtime.generator.collection.GeneratorNodesFactory; | ||
import raw.runtime.truffle.tryable_nullable.TryableNullable; | ||
|
||
public class OSRListFilterBodyNode extends ExpressionNode { | ||
|
||
@Child | ||
private GeneratorNodes.GeneratorNextNode nextNode = | ||
GeneratorNodesFactory.GeneratorNextNodeGen.create(); | ||
|
||
@Child | ||
FunctionExecuteNodes.FunctionExecuteOne functionExecuteOneNode = | ||
FunctionExecuteNodesFactory.FunctionExecuteOneNodeGen.create(); | ||
|
||
private final int generatorSlot; | ||
private final int functionSlot; | ||
private final int llistSlot; | ||
|
||
public OSRListFilterBodyNode(int generatorSlot, int functionSlot, int llistSlot) { | ||
this.generatorSlot = generatorSlot; | ||
this.functionSlot = functionSlot; | ||
this.llistSlot = llistSlot; | ||
} | ||
|
||
@Override | ||
public Object executeGeneric(VirtualFrame frame) { | ||
Object generator = frame.getAuxiliarySlot(generatorSlot); | ||
Object v = nextNode.execute(this, generator); | ||
Boolean predicate = null; | ||
Object function = frame.getAuxiliarySlot(functionSlot); | ||
predicate = | ||
TryableNullable.handlePredicate(functionExecuteOneNode.execute(this, function, v), false); | ||
if (predicate) { | ||
@SuppressWarnings("unchecked") | ||
ArrayList<Object> llist = (ArrayList<Object>) frame.getAuxiliarySlot(llistSlot); | ||
llist.add(v); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public void executeVoid(VirtualFrame virtualFrame) { | ||
executeGeneric(virtualFrame); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...-truffle/src/main/java/raw/runtime/truffle/ast/osr/filter/OSRListFilterConditionNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2023 RAW Labs S.A. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file licenses/BSL.txt. | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0, included in the file | ||
* licenses/APL.txt. | ||
*/ | ||
|
||
package raw.runtime.truffle.ast.osr.filter; | ||
|
||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.nodes.UnexpectedResultException; | ||
import raw.runtime.truffle.ExpressionNode; | ||
import raw.runtime.truffle.runtime.generator.collection.GeneratorNodes; | ||
import raw.runtime.truffle.runtime.generator.collection.GeneratorNodesFactory; | ||
|
||
public class OSRListFilterConditionNode extends ExpressionNode { | ||
|
||
@Child | ||
private GeneratorNodes.GeneratorHasNextNode hasNextNode = | ||
GeneratorNodesFactory.GeneratorHasNextNodeGen.create(); | ||
|
||
private final int generatorSlot; | ||
|
||
public OSRListFilterConditionNode(int generatorSlot) { | ||
this.generatorSlot = generatorSlot; | ||
} | ||
|
||
@Override | ||
public Object executeGeneric(VirtualFrame frame) { | ||
Object generator = frame.getAuxiliarySlot(generatorSlot); | ||
if (!hasNextNode.execute(this, generator)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean executeBoolean(VirtualFrame virtualFrame) throws UnexpectedResultException { | ||
return (boolean) executeGeneric(virtualFrame); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo, remove the if