Skip to content

Commit

Permalink
Final commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cornzz committed Apr 19, 2021
1 parent 8cea600 commit 745f082
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion plugins/org.eclipse.objectteams.otredyn/otre.jardesc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="C:/Users/corny/OneDrive/Uni/7. Semester/BA/role-benchmarks/implementations/objectteams/indy-3.8.0/cp/otredyn.jar"/>
<jar path="C:/Users/corny/OneDrive/Uni/BA/7. Semester/BA/role-benchmarks/implementations/objectteams/indy-3.8.0/cp/otredyn.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/org.eclipse.objectteams.otredyn/otre.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
Expand Down
2 changes: 1 addition & 1 deletion plugins/org.eclipse.objectteams.otredyn/otre_agent.jardesc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="C:/Users/corny/OneDrive/Uni/7. Semester/BA/role-benchmarks/implementations/objectteams/indy-3.8.0/otredyn_agent.jar"/>
<jar path="C:/Users/corny/OneDrive/Uni/BA/7. Semester/BA/role-benchmarks/implementations/objectteams/indy-3.8.0/otredyn_agent.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/org.eclipse.objectteams.otredyn/otre_agent.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
Expand Down
2 changes: 1 addition & 1 deletion plugins/org.eclipse.objectteams.runtime/otre_min.jardesc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="C:/Users/corny/OneDrive/Uni/7. Semester/BA/role-benchmarks/implementations/objectteams/indy-3.8.0/otre_min.jar"/>
<jar path="C:/Users/corny/OneDrive/Uni/BA/7. Semester/BA/role-benchmarks/implementations/objectteams/indy-3.8.0/otre_min.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/org.eclipse.objectteams.runtime/otre_min.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,24 @@ public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, fin
static GuardedInvocation getGuardedInvocation(final LinkRequest request, final OTCallSiteDescriptor desc) {
// logger.debug("========== BEGIN getGuardedInvocation ==========");
final String joinpointDesc = desc.getJoinpointDesc();
final boolean isCallNext = desc.isCallNext();
MethodHandle beforeComposition = null;
MethodHandle replace = null;
MethodHandle afterComposition = null;
MethodHandle beforeComposition = null, replace = null, afterComposition = null;
MethodHandle guard;
final Object[] stack = request.getArguments();
final Class<?> baseClass = stack[0].getClass();
final ITeam[] teams = (ITeam[]) stack[1];
final int oldIndex = (int) stack[2];
int index = oldIndex;
final int startingIndex = (int) stack[2];
int index = startingIndex;
final int[] callinIds = (int[]) stack[3];
final Class<?> baseClass = request.getReceiver().getClass();
if (teams != null) {
boolean stopSearch = false;
if (isCallNext) {
if (desc.isCallNext()) {
index++;
}
while (!stopSearch && index < teams.length) {
final ITeam team = teams[index];
final int callinId = callinIds[index];
final IBinding binding = ObjectTeamsTypeUtilities.getBindingFromId(joinpointDesc, team, callinId);
int relativeIndex = index - oldIndex;
int relativeIndex = index - startingIndex;
final MethodHandle incrementor = MethodHandles.insertArguments(INCREMENT, 0, relativeIndex);
switch (binding.getCallinModifier()) {
case BEFORE:
Expand All @@ -165,18 +162,17 @@ static GuardedInvocation getGuardedInvocation(final LinkRequest request, final O
index++;
break;
case REPLACE:
replace = handleReplace(desc, team, binding);
replace = MethodHandles.filterArguments(replace, 2, incrementor);
replace = MethodHandles.filterArguments(handleReplace(desc, team, binding), 2, incrementor);
stopSearch = true;
break;
}
}
final int testStackLength = (isCallNext) ? teams.length - oldIndex : teams.length;
final int testStackLength = teams.length - startingIndex;
Class<?>[] testStack = new Class<?>[testStackLength];
for (int j = 0, i = oldIndex; i < teams.length; i++, j++) {
for (int j = 0, i = startingIndex; i < teams.length; i++, j++) {
testStack[j] = teams[i].getClass();
}
guard = OTGuards.TEST_COMPOSITION_AND_INDEX.bindTo(testStack);
guard = OTGuards.TEST_TEAM_COMPOSITION.bindTo(testStack);
} else {
guard = Guards.isNull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
public class OTGuards {
static final Lookup lookup = new Lookup(MethodHandles.lookup());

public static final MethodHandle TEST_COMPOSITION_AND_INDEX = lookup.findOwnStatic("testTeamsComposition",
public static final MethodHandle TEST_TEAM_COMPOSITION = lookup.findOwnStatic("testTeamComposition",
boolean.class, Class[].class, ITeam[].class, int.class);

@SuppressWarnings("unused")
private static boolean testTeamsComposition(final Class<ITeam>[] testStack, final ITeam[] stack, final int index) {
private static boolean testTeamComposition(final Class<ITeam>[] testStack, final ITeam[] stack, final int index) {
if (stack == null || testStack.length != stack.length - index) {
return false;
}
Expand All @@ -23,7 +23,7 @@ private static boolean testTeamsComposition(final Class<ITeam>[] testStack, fina
return false;
}
}

return true;
}
}

0 comments on commit 745f082

Please sign in to comment.