Skip to content

Commit 85ef98c

Browse files
committed
remove old GC prevention mechanism which is now replaced by object pinning
1 parent 0056e98 commit 85ef98c

File tree

3 files changed

+1
-20
lines changed

3 files changed

+1
-20
lines changed

espresso/src/com.oracle.truffle.espresso.jdwp/src/com/oracle/truffle/espresso/jdwp/impl/DebuggerController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,6 @@ private void lockThread(Object thread, boolean forceSuspend, List<Callable<Void>
711711
}
712712
checkThreadJobsAndRun(thread);
713713
}
714-
getGCPrevention().releaseActiveWhileSuspended(thread);
715714
fine(() -> "lock wakeup for thread: " + getThreadName(thread));
716715
}
717716

espresso/src/com.oracle.truffle.espresso.jdwp/src/com/oracle/truffle/espresso/jdwp/impl/GCPrevention.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,13 @@
2222
*/
2323
package com.oracle.truffle.espresso.jdwp.impl;
2424

25-
import java.util.ArrayList;
26-
import java.util.HashMap;
2725
import java.util.HashSet;
2826

2927
public final class GCPrevention {
3028

3129
// simply hold a strong reference to all objects for which
3230
// GC should be disabled
3331
private final HashSet<Object> prevent = new HashSet<>();
34-
private final HashMap<Object, ArrayList<Object>> activeWhileSuspended = new HashMap<>();
3532

3633
public void disableGC(Object object) {
3734
prevent.add(object);
@@ -45,13 +42,4 @@ public void clearAll() {
4542
prevent.clear();
4643
}
4744

48-
public synchronized void setActiveWhileSuspended(Object guestThread, Object obj) {
49-
activeWhileSuspended.putIfAbsent(guestThread, new ArrayList<>());
50-
activeWhileSuspended.get(guestThread).add(obj);
51-
}
52-
53-
public synchronized void releaseActiveWhileSuspended(Object guestThread) {
54-
activeWhileSuspended.remove(guestThread);
55-
}
56-
5745
}

espresso/src/com.oracle.truffle.espresso.jdwp/src/com/oracle/truffle/espresso/jdwp/impl/JDWP.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ static CommandResult createReply(Packet packet, JDWPContext context) {
15871587

15881588
Object object = context.getIds().fromId((int) objectId);
15891589

1590-
if (object == context.getNullObject()) {
1590+
if (object == null || object == context.getNullObject()) {
15911591
reply.errorCode(ErrorCodes.INVALID_OBJECT);
15921592
return new CommandResult(reply);
15931593
}
@@ -3049,17 +3049,11 @@ private static void writeMethodResult(PacketStream reply, JDWPContext context, T
30493049
reply.writeByte(TagConstants.OBJECT);
30503050
Object guestException = context.getGuestException(result.getException());
30513051
reply.writeLong(context.getIds().getIdAsLong(guestException));
3052-
if (controller.getThreadSuspension().getSuspensionCount(thread) > 0) {
3053-
controller.getGCPrevention().setActiveWhileSuspended(thread, guestException);
3054-
}
30553052
} else {
30563053
Object value = result.getResult();
30573054
if (value != null) {
30583055
byte tag = context.getTag(value);
30593056
writeValue(tag, value, reply, true, context);
3060-
if (controller.getThreadSuspension().getSuspensionCount(thread) > 0) {
3061-
controller.getGCPrevention().setActiveWhileSuspended(thread, value);
3062-
}
30633057
} else { // return value is null
30643058
reply.writeByte(TagConstants.OBJECT);
30653059
reply.writeLong(0);

0 commit comments

Comments
 (0)