-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wasm gc: implement branching instructions and null check instruction
- Loading branch information
1 parent
5acb9a4
commit 7029d3c
Showing
21 changed files
with
567 additions
and
12 deletions.
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
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
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
89 changes: 89 additions & 0 deletions
89
core/src/main/java/org/teavm/backend/wasm/model/expression/WasmCastBranch.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,89 @@ | ||
/* | ||
* Copyright 2024 Alexey Andreev. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.teavm.backend.wasm.model.expression; | ||
|
||
import java.util.Objects; | ||
import org.teavm.backend.wasm.model.WasmType; | ||
|
||
public class WasmCastBranch extends WasmExpression { | ||
private WasmCastCondition condition; | ||
private WasmExpression value; | ||
private WasmType.Reference sourceType; | ||
private WasmType.Reference type; | ||
private WasmBlock target; | ||
private WasmExpression result; | ||
|
||
public WasmCastBranch(WasmCastCondition condition, WasmExpression value, WasmType.Reference sourceType, | ||
WasmType.Reference type, WasmBlock target) { | ||
this.condition = Objects.requireNonNull(condition); | ||
this.value = Objects.requireNonNull(value); | ||
this.type = Objects.requireNonNull(type); | ||
this.target = Objects.requireNonNull(target); | ||
} | ||
|
||
public WasmCastCondition getCondition() { | ||
return condition; | ||
} | ||
|
||
public void setCondition(WasmCastCondition condition) { | ||
this.condition = Objects.requireNonNull(condition); | ||
} | ||
|
||
public WasmExpression getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(WasmExpression value) { | ||
this.value = Objects.requireNonNull(value); | ||
} | ||
|
||
public WasmType.Reference getSourceType() { | ||
return sourceType; | ||
} | ||
|
||
public void setSourceType(WasmType.Reference sourceType) { | ||
this.sourceType = Objects.requireNonNull(sourceType); | ||
} | ||
|
||
public WasmType.Reference getType() { | ||
return type; | ||
} | ||
|
||
public void setType(WasmType.Reference type) { | ||
this.type = Objects.requireNonNull(type); | ||
} | ||
|
||
public WasmBlock getTarget() { | ||
return target; | ||
} | ||
|
||
public void setTarget(WasmBlock target) { | ||
this.target = Objects.requireNonNull(target); | ||
} | ||
|
||
public WasmExpression getResult() { | ||
return result; | ||
} | ||
|
||
public void setResult(WasmExpression result) { | ||
this.result = result; | ||
} | ||
|
||
@Override | ||
public void acceptVisitor(WasmExpressionVisitor visitor) { | ||
visitor.visit(this); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
core/src/main/java/org/teavm/backend/wasm/model/expression/WasmCastCondition.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,21 @@ | ||
/* | ||
* Copyright 2024 Alexey Andreev. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.teavm.backend.wasm.model.expression; | ||
|
||
public enum WasmCastCondition { | ||
SUCCESS, | ||
FAILURE | ||
} |
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
39 changes: 39 additions & 0 deletions
39
core/src/main/java/org/teavm/backend/wasm/model/expression/WasmIsNull.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,39 @@ | ||
/* | ||
* Copyright 2024 Alexey Andreev. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.teavm.backend.wasm.model.expression; | ||
|
||
import java.util.Objects; | ||
|
||
public class WasmIsNull extends WasmExpression { | ||
private WasmExpression value; | ||
|
||
public WasmIsNull(WasmExpression value) { | ||
this.value = Objects.requireNonNull(value); | ||
} | ||
|
||
public WasmExpression getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(WasmExpression value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public void acceptVisitor(WasmExpressionVisitor visitor) { | ||
visitor.visit(this); | ||
} | ||
} |
Oops, something went wrong.