Skip to content

Commit

Permalink
Merge PR #98: Various small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr committed Jan 25, 2017
2 parents 33b1015 + e17e350 commit 8e04cfa
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 68 deletions.
6 changes: 3 additions & 3 deletions src/som/interpreter/actors/EventualSendNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public abstract static class SendNode extends Node {

protected final SourceSection source;

protected final AbstractBreakpointNode messageReceiverBreakpoint;
protected final AbstractBreakpointNode promiseResolverBreakpoint;
protected final AbstractBreakpointNode promiseResolutionBreakpoint;
@Child protected AbstractBreakpointNode messageReceiverBreakpoint;
@Child protected AbstractBreakpointNode promiseResolverBreakpoint;
@Child protected AbstractBreakpointNode promiseResolutionBreakpoint;

protected SendNode(final SSymbol selector, final WrapReferenceNode[] wrapArgs,
final RootCallTarget onReceive, final SourceSection source) {
Expand Down
25 changes: 9 additions & 16 deletions src/tools/debugger/Tags.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 Stefan Marr
* Copyright (c) 2016-2017 Stefan Marr
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -27,17 +27,10 @@
public abstract class Tags {
private Tags() { }

public static Class<?>[] getAll() {
return new Class<?>[] {KeywordTag.class, LiteralTag.class, CommentTag.class,
IdentifierTag.class, ArgumentTag.class, LocalVariableTag.class,
StatementSeparatorTag.class, DelimiterOpeningTag.class,
DelimiterClosingTag.class};
}

/**
* Marks keywords or keyword-like language constructs.
* Elements that are not preserved in the AST should reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class KeywordTag extends Tags {
private KeywordTag() { }
Expand All @@ -53,7 +46,7 @@ private LiteralTag() { }
/**
* Marks comments.
* Elements that are not preserved in the AST should reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class CommentTag extends Tags {
private CommentTag() { }
Expand All @@ -63,7 +56,7 @@ private CommentTag() { }
* Marks identifiers. Currently only used for class names.
* TODO: figure out whether this is really useful.
* Elements that are not preserved in the AST should reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class IdentifierTag extends Tags {
private IdentifierTag() { }
Expand All @@ -72,7 +65,7 @@ private IdentifierTag() { }
/**
* Marks formal and actual arguments.
* Formal arguments that are not preserved in the AST should reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class ArgumentTag extends Tags {
private ArgumentTag() { }
Expand All @@ -81,7 +74,7 @@ private ArgumentTag() { }
/**
* Marks local variables.
* Variable declarations that are not part of the AST should be reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class LocalVariableTag extends Tags {
private LocalVariableTag() { }
Expand All @@ -90,7 +83,7 @@ private LocalVariableTag() { }
/**
* Marks line endings like ';', or '.'.
* Elements that are not preserved in the AST should reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class StatementSeparatorTag extends Tags {
private StatementSeparatorTag() { }
Expand All @@ -99,7 +92,7 @@ private StatementSeparatorTag() { }
/**
* Marks opening delimiters such as parentheses.
* Elements that are not preserved in the AST should reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class DelimiterOpeningTag extends Tags {
private DelimiterOpeningTag() { }
Expand All @@ -108,7 +101,7 @@ private DelimiterOpeningTag() { }
/**
* Marks closing delimiters such as parentheses.
* Elements that are not preserved in the AST should reported via
* {@link Highlight#reportNonAstSyntax(Class, SourceSection)}.
* {@link VM#reportSyntaxElement(Class, SourceSection)}.
*/
public final class DelimiterClosingTag extends Tags {
private DelimiterClosingTag() { }
Expand Down
2 changes: 1 addition & 1 deletion src/tools/debugger/session/SectionBreakpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public boolean equals(final Object obj) {
return false;
}
SectionBreakpoint o = (SectionBreakpoint) obj;
return o.equals(this);
return coord.equals(o.coord);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions tools/kompos/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export class Controller {

resumeExecution() {
if (!this.dbg.isSuspended()) { return; }
this.dbg.setResumed();
this.vmConnection.sendDebuggerAction('resume', this.dbg.lastSuspendEventId);
this.view.onContinueExecution();
}
Expand Down
35 changes: 16 additions & 19 deletions tools/kompos/src/history-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import {IdMap} from './messages';
import {dbgLog} from './source';
import {displayMessageHistory} from './visualizations';

var horizontalDistance = 100,
verticalDistance = 100;
Expand All @@ -17,7 +16,7 @@ export class HistoryData {
private currentReceiver = "";

constructor(){
this.addActor("0:0", "Platform"); //add main actor
this.addActor("0:0", "Platform"); //add main actor
}

addActor(id: string, type: string) {
Expand All @@ -41,7 +40,7 @@ export class HistoryData {
}

addMessage(sender: string, target: string) {
if(target == "0:0") return;
if (target === "0:0") { return; };

if (!this.messages.hasOwnProperty(sender.toString())) {
this.messages[sender.toString()] = {};
Expand Down Expand Up @@ -74,11 +73,11 @@ export class HistoryData {
}

getActorNodes() {
return mapToArray(this.actors)
return mapToArray(this.actors);
}

getMaxMessageSends() {
return this.maxMessageCount
return this.maxMessageCount;
}

updateDataBin(data: DataView){
Expand All @@ -103,7 +102,7 @@ export class HistoryData {
//8 byte promise id
//8 byte resolving message id
i += 16;
i += readParameter(data, i, null);
i += readParameter(data, i);
break;
case 4:
//8 byte promise id
Expand All @@ -116,42 +115,40 @@ export class HistoryData {
i += 16;
break;
case 6:
var thread = data.getInt8(i); //Thread
data.getInt8(i); //Thread
//8 byte timestamp
i += 9;
break;
case 7:
//8 byte message base id
this.currentReceiver = (data.getInt32(i+12) + ':' + data.getInt32(i+8)); //receiver id
var offset = data.getInt16(i+16); //id offset
data.getInt16(i+16); //id offset
i += 18;
break;
case 8:
var sender = (data.getInt32(i+4) + ':' + data.getInt32(i)); //sender id
//8 byte causal message id
var sym = data.getInt16(i+16); //selector
data.getInt16(i+16); //selector
//8byte execution start
//8byte send time
var numParam = data.getInt8(i+34);//parameter count
i += 35;
var k;
for(k = 0; k < numParam; k++){
i += readParameter(data, i, null);
for (var k = 0; k < numParam; k++) {
i += readParameter(data, i);
}
this.addMessage(sender, this.currentReceiver);
break;
case 9:
//8 byte promise id
var sender = (data.getInt32(i+12) + ':' + data.getInt32(i+8)); //sender id
sender = (data.getInt32(i+12) + ':' + data.getInt32(i+8)); //sender id
//8 byte causal message id
var sym = data.getInt16(i+24); //selector
data.getInt16(i+24); //selector
//8byte execution start
//8byte send time
var numParam = data.getInt8(i+42);//parameter count
numParam = data.getInt8(i+42);//parameter count
i += 43;
var k;
for(k = 0; k < numParam; k++){
i += readParameter(data, i, null);
for (var k = 0; k < numParam; k++) {
i += readParameter(data, i);
}
this.addMessage(sender, this.currentReceiver);
break;
Expand All @@ -160,7 +157,7 @@ export class HistoryData {
}
}

function readParameter(dv:DataView, offset:number, o):number{
function readParameter(dv:DataView, offset:number): number {
var paramType = dv.getInt8(offset);
switch(paramType){
case 0: //false
Expand Down
16 changes: 8 additions & 8 deletions tools/kompos/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface SourceMessage {

export interface SuspendEventMessage {
type: "suspendEvent";

/** id of SuspendEvent, to be recognized in backend. */
id: string;
sourceUri: string;
Expand All @@ -70,7 +70,7 @@ export interface SuspendEventMessage {
}

export type StoppedReason = "step" | "breakpoint" | "exception" | "pause";
export type ActivityType = "Actor";
export type ActivityType = "Actor";

export interface StoppedMessage {
type: "StoppedEvent";
Expand All @@ -79,7 +79,7 @@ export interface StoppedMessage {
activityId: number;
activityType: ActivityType;
text: string;
allThreadsStopped: boolean;
allThreadsStopped: boolean;
}

export interface UpdateSourceSections {
Expand Down Expand Up @@ -139,7 +139,7 @@ export function createSectionBreakpointData(sourceUri: string, line: number,
startLine: line,
startColumn: column,
charLength: length }};

return breakpoint;
}

Expand All @@ -161,7 +161,7 @@ interface UpdateBreakpoint {
breakpoint: BreakpointData;
}

export type StepType = "stepInto" | "stepOver" | "return" | "resume" | "stop";
export type StepType = "stepInto" | "stepOver" | "return" | "resume" | "stop";

export interface StepMessage {
action: StepType;
Expand All @@ -183,7 +183,7 @@ export interface StackTraceRequest {
export interface StackFrame {
/** Id for the frame, unique across all threads. */
id: number;

/** Name of the frame, typically a method name. */
name: string;

Expand Down Expand Up @@ -228,7 +228,7 @@ export interface Scope {

/** If true, the number of variables in this scope is large or expensive to retrieve. */
expensive: boolean;
}
}

export interface ScopesResponse {
type: "ScopesResponse";
Expand All @@ -253,7 +253,7 @@ export interface VariablesResponse {
export interface Variable {
name: string;
value: string;

/**
* If variablesReference is > 0, the variable is structured and its
* children can be retrieved by passing variablesReference to the
Expand Down
12 changes: 6 additions & 6 deletions tools/kompos/src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ function splitAndKeepNewlineAsEmptyString(str) {
function sourceToArray(source: string): string[][] {
let lines = splitAndKeepNewlineAsEmptyString(source);
let arr = new Array(lines.length);

for (let i in lines) {
let line = lines[i];
arr[i] = new Array(line.length);
for (let j = 0; j < line.length; j += 1) {
arr[i][j] = line[j];
}
}
}
return arr;
}

Expand Down Expand Up @@ -75,7 +75,7 @@ class Begin extends SectionMarker {
this.type = Begin;
}

toString() {
toString() {
return '<span id="' + this.sectionId + '" class="' + this.section.tags.join(" ") + '">';
}

Expand Down Expand Up @@ -214,7 +214,7 @@ function ensureItIsAnnotation(arr: any[][], line: number, column: number) {

/**
* Determine line and column for `length` elements from given start location.
*
*
* Arguments and results are 1-based.
* Computation is zero-based.
*/
Expand Down Expand Up @@ -425,7 +425,7 @@ export class View {

displayUpdatedSourceSections(data, getSourceAndMethods) {
// update the source sections for the sourceId

var pane = document.getElementById(data.sourceId);
var sourceFile = $(pane).find(".source-file");

Expand Down Expand Up @@ -466,7 +466,7 @@ export class View {
for (var varName in data.topFrame.slots) {
showVar(varName, data.topFrame.slots[varName], list);
}

// highlight current node
let ssId = getSectionId(sourceId, data.stack[0].sourceSection);
let ss = document.getElementById(ssId);
Expand Down
7 changes: 3 additions & 4 deletions tools/kompos/src/visualizations.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* jshint -W097 */
'use strict';

import {IdMap, SymbolMessage} from './messages';
import {dbgLog} from './source';
import {SymbolMessage} from './messages';
import * as d3 from 'd3';
import {HistoryData} from './history-data';

Expand Down Expand Up @@ -32,7 +31,7 @@ export function displayMessageHistory() {
// - links are always source < target; edge directions are set by 'left' and 'right'.

nodes = data.getActorNodes();

links = data.getLinks() ;

// init D3 force layout
Expand All @@ -59,7 +58,7 @@ export function displayMessageHistory() {
.append('svg:path')
.attr('d', 'M0,-5L10,0L0,5')
.attr('fill', '#000');

svg.append('svg:defs').append('svg:marker')
.attr('id', 'start-arrow')
.attr('viewBox', '0 -5 10 10')
Expand Down
Loading

0 comments on commit 8e04cfa

Please sign in to comment.