Skip to content

Commit

Permalink
Add ucall debugging; Add debug type prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MatwayBurkow committed Jul 1, 2020
1 parent 770f172 commit 54ebc7d
Show file tree
Hide file tree
Showing 14 changed files with 284 additions and 259 deletions.
1 change: 1 addition & 0 deletions Block.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ Block: [{
exportDepth: 0 dynamic;
namedFunctions: String Int32 HashTable; # name -> node ID
capturedVars: RefToVar Array;
fileLexicalBlocks: Int32 Int32 HashTable;
funcDbgIndex: -1 dynamic;
lastVarName: 0 dynamic;
lastBrLabelName: 0 dynamic;
Expand Down
2 changes: 1 addition & 1 deletion Var.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ getStringImplementation: [
i: 0 dynamic;
[
i stringView.size < [
codeRef: stringView.data i Natx cast + Nat8 addressToReference;
codeRef: stringView.data storageAddress i Natx cast + Nat8 addressToReference;
code: codeRef copy;
code 32n8 < ~ [code 127n8 <] && [code 34n8 = ~] && [code 92n8 = ~] && [ # exclude " and \
code 0n32 cast @result.catSymbolCode
Expand Down
74 changes: 33 additions & 41 deletions builtinImpl.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ mplNumberBinaryOp: [
value2: tag var2.data.get.end copy;
resultType: tag @getResultType call;
result: resultType zeroValue makeValuePair resultType @processor @block createVariable
Dynamic @processor block makeStaticity
@processor @block createAllocIR;
Dynamic @processor block makeStaticity
@processor @block createAllocIR;
arg1 arg2 @result opName @processor @block createBinaryOperation
result @block push
] staticCall
Expand Down Expand Up @@ -192,8 +192,8 @@ mplNumberBuiltinOp: [
value: tag var.data.get.end copy;
resultType: tag copy;
result: resultType zeroValue makeValuePair resultType @processor @block createVariable
Dynamic @processor block makeStaticity
@processor @block createAllocIR;
Dynamic @processor block makeStaticity
@processor @block createAllocIR;

args: IRArgument Array;

Expand Down Expand Up @@ -250,8 +250,8 @@ mplNumberUnaryOp: [
value: tag var.data.get.end copy;
resultType: tag copy;
result: resultType zeroValue makeValuePair resultType @processor @block createVariable
Dynamic @processor block makeStaticity
@processor @block createAllocIR;
Dynamic @processor block makeStaticity
@processor @block createAllocIR;
arg @result opName mopName @processor @block createUnaryOperation
result @block push
] staticCall
Expand Down Expand Up @@ -301,8 +301,8 @@ mplShiftBinaryOp: [
copy tag:;
resultType: tag copy;
result: resultType zeroValue makeValuePair resultType @processor @block createVariable
Dynamic @processor @block makeStaticity
@processor @block createAllocIR;
Dynamic @processor @block makeStaticity
@processor @block createAllocIR;
arg1 @processor getStorageSize arg2 @processor getStorageSize = [
arg1 arg2 @result opName @processor @block createBinaryOperation
] [
Expand Down Expand Up @@ -347,7 +347,7 @@ parseSignature: [
optionsStruct.fields [
f:;
f.nameInfo (
processor.variadicNameInfo [
processor.specialNames.variadicNameInfo [
variadicRefToVar: f.refToVar;
variadicVar: variadicRefToVar getVar;
(
Expand All @@ -357,7 +357,7 @@ parseSignature: [
[VarCond variadicVar.data.get.end @result.@variadic set]
) sequence
]
processor.conventionNameInfo [
processor.specialNames.conventionNameInfo [
conventionRefToVarRef: f.refToVar;
conventionVarRef: conventionRefToVarRef getVar;
(
Expand Down Expand Up @@ -616,8 +616,8 @@ staticityOfBinResult: [
copy tag:;
resultType: tag copy;
result: resultType zeroValue makeValuePair resultType @processor @block createVariable
Dynamic @processor @block makeStaticity
@processor @block createAllocIR;
Dynamic @processor @block makeStaticity
@processor @block createAllocIR;

args: IRArgument Array;

Expand Down Expand Up @@ -726,7 +726,7 @@ staticityOfBinResult: [
i count < [
element: refToElement @processor @block copyVar staticity @processor @block makeStaticity;
field: Field;
processor.emptyNameInfo @field.@nameInfo set
processor.specialNames.emptyNameInfo @field.@nameInfo set
element @field.@refToVar set
field @struct.@fields.pushBack
i 1 + @i set TRUE
Expand Down Expand Up @@ -1146,48 +1146,40 @@ staticityOfBinResult: [
[
processor.varForCallTrace.assigned ~ [
varPrev: 0n64 makeValuePair VarNatX @processor @block createVariable;
varNext: 0n64 makeValuePair VarNatX @processor @block createVariable;
varName: String @processor @block makeVarString TRUE dynamic @processor @block createRefNoOp;
varLine: 0i64 makeValuePair VarInt32 @processor @block createVariable;
varColumn: 0i64 makeValuePair VarInt32 @processor @block createVariable;

struct: Struct;
5 @struct.@fields.resize

varPrev 0 @struct.@fields.at.@refToVar set
"prev" makeStringView @processor findNameInfo 0 @struct.@fields.at.@nameInfo set
field: Field;
varPrev @field.@refToVar set
"prev" makeStringView @processor findNameInfo @field.@nameInfo set
@field move @struct.@fields.pushBack

varNext 1 @struct.@fields.at.@refToVar set
"next" makeStringView @processor findNameInfo 1 @struct.@fields.at.@nameInfo set
field: Field;
varName @field.@refToVar set
"name" makeStringView @processor findNameInfo @field.@nameInfo set
@field move @struct.@fields.pushBack

varName 2 @struct.@fields.at.@refToVar set
"name" makeStringView @processor findNameInfo 2 @struct.@fields.at.@nameInfo set
field: Field;
varLine @field.@refToVar set
"line" makeStringView @processor findNameInfo @field.@nameInfo set
@field move @struct.@fields.pushBack

varLine 3 @struct.@fields.at.@refToVar set
"line" makeStringView @processor findNameInfo 3 @struct.@fields.at.@nameInfo set

varColumn 4 @struct.@fields.at.@refToVar set
"column" makeStringView @processor findNameInfo 4 @struct.@fields.at.@nameInfo set
field: Field;
varColumn @field.@refToVar set
"column" makeStringView @processor findNameInfo @field.@nameInfo set
@field move @struct.@fields.pushBack

@struct move owner VarStruct @processor @block createVariable @processor.@varForCallTrace set

Dynamic @processor.@varForCallTrace getVar.@storageStaticity set
@processor.@varForCallTrace @processor @block makeVarTreeDirty
] when

firstRef: @processor.@varForCallTrace FALSE dynamic @processor @block createRefNoOp;
lastRef: @processor.@varForCallTrace FALSE dynamic @processor @block createRefNoOp;

resultStruct: Struct;
2 @resultStruct.@fields.resize

firstRef 0 @resultStruct.@fields.at.@refToVar set
"first" makeStringView @processor findNameInfo 0 @resultStruct.@fields.at.@nameInfo set

lastRef 1 @resultStruct.@fields.at.@refToVar set
"last" makeStringView @processor findNameInfo 1 @resultStruct.@fields.at.@nameInfo set

result: @resultStruct move owner VarStruct @processor @block createVariable @processor @block createAllocIR;
@processor.@varForCallTrace @processor getIrType result @processor getIrType result @processor @block createGetCallTrace
result: @processor.@varForCallTrace FALSE dynamic @processor @block createRefNoOp @processor @block createAllocIR Dynamic @processor @block makeStaticity;
result @processor @block createGetCallTrace
result @block push

TRUE @block.!hasCallTrace
Expand Down Expand Up @@ -1663,7 +1655,7 @@ staticityOfBinResult: [
splitted.chars [
element: toString @processor @block makeVarString;
field: Field;
processor.emptyNameInfo @field.@nameInfo set
processor.specialNames.emptyNameInfo @field.@nameInfo set
@element TRUE dynamic @processor @block createRef @field.@refToVar set
field @struct.@fields.pushBack
] each
Expand Down
Loading

0 comments on commit 54ebc7d

Please sign in to comment.