-
Notifications
You must be signed in to change notification settings - Fork 20
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
1 parent
f01199d
commit ac5f977
Showing
25 changed files
with
471 additions
and
120 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
66 changes: 0 additions & 66 deletions
66
...kotlin/org/vorpal/research/kex/reanimator/actionsequence/generator/CollectionGenerator.kt
This file was deleted.
Oops, something went wrong.
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
4 changes: 3 additions & 1 deletion
4
...ctionsequence/generator/KexRtGenerator.kt → ...equence/generator/kexrt/KexRtGenerator.kt
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
58 changes: 58 additions & 0 deletions
58
...lin/org/vorpal/research/kex/reanimator/actionsequence/generator/rt/ArrayDequeGenerator.kt
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,58 @@ | ||
package org.vorpal.research.kex.reanimator.actionsequence.generator.rt | ||
|
||
import org.vorpal.research.kex.descriptor.ArrayDescriptor | ||
import org.vorpal.research.kex.descriptor.ConstantDescriptor | ||
import org.vorpal.research.kex.descriptor.Descriptor | ||
import org.vorpal.research.kex.descriptor.ObjectDescriptor | ||
import org.vorpal.research.kex.descriptor.descriptor | ||
import org.vorpal.research.kex.ktype.KexInt | ||
import org.vorpal.research.kex.ktype.asArray | ||
import org.vorpal.research.kex.ktype.kexType | ||
import org.vorpal.research.kex.reanimator.actionsequence.ActionList | ||
import org.vorpal.research.kex.reanimator.actionsequence.ActionSequence | ||
import org.vorpal.research.kex.reanimator.actionsequence.DefaultConstructorCall | ||
import org.vorpal.research.kex.reanimator.actionsequence.MethodCall | ||
import org.vorpal.research.kex.reanimator.actionsequence.generator.Generator | ||
import org.vorpal.research.kex.reanimator.actionsequence.generator.GeneratorContext | ||
import org.vorpal.research.kfg.arrayDequeClass | ||
import org.vorpal.research.kfg.type.objectType | ||
|
||
class ArrayDequeGenerator(val fallback: Generator) : Generator { | ||
override val context: GeneratorContext | ||
get() = fallback.context | ||
|
||
private val kfgArrayDeque = context.cm.arrayDequeClass | ||
private val kexArrayDeque = kfgArrayDeque.kexType | ||
private val kfgObjectType = context.cm.type.objectType | ||
|
||
override fun supports(descriptor: Descriptor): Boolean = descriptor.type == kexArrayDeque | ||
|
||
override fun generate(descriptor: Descriptor, generationDepth: Int): ActionSequence = with(context) { | ||
descriptor as ObjectDescriptor | ||
|
||
val name = "${descriptor.term}" | ||
val actionSequence = ActionList(name) | ||
saveToCache(descriptor, actionSequence) | ||
|
||
val elements = descriptor["elements" to kfgObjectType.kexType.asArray()] as? ArrayDescriptor | ||
val head = (descriptor["head" to KexInt] as? ConstantDescriptor.Int)?.value ?: 0 | ||
val tail = (descriptor["tail" to KexInt] as? ConstantDescriptor.Int)?.value ?: elements?.length ?: 0 | ||
actionSequence += DefaultConstructorCall(kfgArrayDeque) | ||
|
||
val addMethod = kfgArrayDeque.getMethod("add", cm.type.boolType, kfgObjectType) | ||
if (elements != null) { | ||
for (i in head..<tail) { | ||
val element = elements[i] ?: descriptor { default(elements.elementType) } | ||
val elementAS = fallback.generate(element, generationDepth) | ||
actionSequence += MethodCall(addMethod, listOf(elementAS)) | ||
} | ||
} else if (tail - head > 0) { | ||
for (i in head..<tail) { | ||
val elementAS = fallback.generate(descriptor { `null` }, generationDepth) | ||
actionSequence += MethodCall(addMethod, listOf(elementAS)) | ||
} | ||
} | ||
|
||
actionSequence | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...tlin/org/vorpal/research/kex/reanimator/actionsequence/generator/rt/ArrayListGenerator.kt
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,57 @@ | ||
package org.vorpal.research.kex.reanimator.actionsequence.generator.rt | ||
|
||
import org.vorpal.research.kex.descriptor.ArrayDescriptor | ||
import org.vorpal.research.kex.descriptor.ConstantDescriptor | ||
import org.vorpal.research.kex.descriptor.Descriptor | ||
import org.vorpal.research.kex.descriptor.ObjectDescriptor | ||
import org.vorpal.research.kex.descriptor.descriptor | ||
import org.vorpal.research.kex.ktype.KexInt | ||
import org.vorpal.research.kex.ktype.asArray | ||
import org.vorpal.research.kex.ktype.kexType | ||
import org.vorpal.research.kex.reanimator.actionsequence.ActionList | ||
import org.vorpal.research.kex.reanimator.actionsequence.ActionSequence | ||
import org.vorpal.research.kex.reanimator.actionsequence.DefaultConstructorCall | ||
import org.vorpal.research.kex.reanimator.actionsequence.MethodCall | ||
import org.vorpal.research.kex.reanimator.actionsequence.generator.Generator | ||
import org.vorpal.research.kex.reanimator.actionsequence.generator.GeneratorContext | ||
import org.vorpal.research.kfg.arrayListClass | ||
import org.vorpal.research.kfg.type.objectType | ||
|
||
class ArrayListGenerator(val fallback: Generator) : Generator { | ||
override val context: GeneratorContext | ||
get() = fallback.context | ||
|
||
private val kfgArrayList = context.cm.arrayListClass | ||
private val kexArrayList = kfgArrayList.kexType | ||
private val kfgObjectType = context.cm.type.objectType | ||
|
||
override fun supports(descriptor: Descriptor): Boolean = descriptor.type == kexArrayList | ||
|
||
override fun generate(descriptor: Descriptor, generationDepth: Int): ActionSequence = with(context) { | ||
descriptor as ObjectDescriptor | ||
|
||
val name = "${descriptor.term}" | ||
val actionSequence = ActionList(name) | ||
saveToCache(descriptor, actionSequence) | ||
|
||
val elementData = descriptor["elementData" to kfgObjectType.kexType.asArray()] as? ArrayDescriptor | ||
val size = (descriptor["size" to KexInt] as? ConstantDescriptor.Int)?.value ?: elementData?.length ?: 0 | ||
actionSequence += DefaultConstructorCall(kfgArrayList) | ||
|
||
val addMethod = kfgArrayList.getMethod("add", cm.type.boolType, kfgObjectType) | ||
if (elementData != null) { | ||
for (i in 0 until size) { | ||
val element = elementData[i] ?: descriptor { default(elementData.elementType) } | ||
val elementAS = fallback.generate(element, generationDepth) | ||
actionSequence += MethodCall(addMethod, listOf(elementAS)) | ||
} | ||
} else if (size > 0) { | ||
for (i in 0 until size) { | ||
val elementAS = fallback.generate(descriptor { `null` }, generationDepth) | ||
actionSequence += MethodCall(addMethod, listOf(elementAS)) | ||
} | ||
} | ||
|
||
actionSequence | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
...ionsequence/generator/CharsetGenerator.kt → ...sequence/generator/rt/CharsetGenerator.kt
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
Oops, something went wrong.