-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
126 additions
and
37 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
61 changes: 61 additions & 0 deletions
61
convex-core/src/main/java/convex/core/cvm/ops/AFlatMultiOp.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,61 @@ | ||
package convex.core.cvm.ops; | ||
|
||
import convex.core.cvm.AOp; | ||
import convex.core.data.ACell; | ||
import convex.core.data.AVector; | ||
import convex.core.data.IRefFunction; | ||
import convex.core.data.Ref; | ||
import convex.core.util.ErrorMessages; | ||
|
||
public abstract class AFlatMultiOp<T extends ACell> extends AMultiOp<T> { | ||
|
||
protected final byte tag; | ||
|
||
protected AFlatMultiOp(byte tag, AVector<AOp<ACell>> ops) { | ||
super(ops); | ||
this.tag=tag; | ||
} | ||
|
||
@Override | ||
public byte getTag() { | ||
return tag; | ||
} | ||
|
||
@Override | ||
public byte opCode() { | ||
// TODO remove from hierarchy | ||
throw new Error(ErrorMessages.UNREACHABLE); | ||
} | ||
|
||
@Override | ||
public int encodeRaw(byte[] bs, int pos) { | ||
int epos=pos; | ||
epos=ops.encodeRaw(bs, epos); | ||
return epos; | ||
} | ||
|
||
@Override | ||
public int encodeAfterOpcode(byte[] bs, int pos) { | ||
throw new Error(ErrorMessages.UNREACHABLE); | ||
} | ||
|
||
@Override | ||
public final int getRefCount() { | ||
return ops.getRefCount(); | ||
} | ||
|
||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public Ref<?> getRef(int i) { | ||
return ops.getRef(i); | ||
} | ||
|
||
@Override | ||
public final AFlatMultiOp<T> updateRefs(IRefFunction func) { | ||
AVector<AOp<ACell>> newOps=(AVector<AOp<ACell>>) ops.updateRefs(func); | ||
return recreate(newOps); | ||
} | ||
|
||
protected abstract AFlatMultiOp<T> recreate(AVector<AOp<ACell>> newOps); | ||
} |
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
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