-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables Debugging #544
Variables Debugging #544
Conversation
Codecov ReportBase: 93.44% // Head: 93.61% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #544 +/- ##
==========================================
+ Coverage 93.44% 93.61% +0.17%
==========================================
Files 42 44 +2
Lines 15802 16420 +618
==========================================
+ Hits 14766 15372 +606
- Misses 1036 1048 +12
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
02c1e78
to
cd27995
Compare
|
…k to inkwell's master branch
|
||
#[derive(PartialEq, Eq)] | ||
#[allow(non_camel_case_types)] | ||
enum DebugEncoding { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can find a better name for that enum - i'm not 100% what it does
what does DW_ATE stand for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DW = Dwarf
AT = Attribute
E = Encoding, hence the name.. The parameter this is passed as is also called encoding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The encoding here is usually only used for Basic Types, which I updated in the comment
src/codegen/debug.rs
Outdated
} | ||
} | ||
|
||
pub struct DebugObj<'ink> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we find a better name for this? i would have assumed that the DebugObject is a small unit of debugging (like the dwarf DebugItem)
this represents all debug information of one compilation-unit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would debug builder be OK? I didin't initially use it to avoid confusion with DebugInfoBuilder (The inkwell struct)
src/codegen/debug.rs
Outdated
} | ||
|
||
/// Wraps a debug object in an enum based on its level | ||
pub enum DebugWrapper<'ink> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name too generic
Changed some names, and added documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small issues, overall I like it!
src/codegen/debug.rs
Outdated
|
||
fn create_array_type( | ||
&mut self, | ||
array: &DataTypeInformation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would deconstruct this when calling.
you have to check for array before you call this AND you do an if-let check right at the start.
its only 3 params you're interested in
src/codegen/debug.rs
Outdated
|
||
fn create_pointer_type( | ||
&mut self, | ||
pointer: &DataTypeInformation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deconstruct before calling
src/codegen/debug.rs
Outdated
fn create_string_type( | ||
&mut self, | ||
name: &str, | ||
string: &DataTypeInformation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deconstruct before calling
@@ -2348,8 +2348,8 @@ impl<'ink, 'b> ExpressionCodeGenerator<'ink, 'b> { | |||
let target_size = self.get_string_size(left_type, right_statement.get_location())?; //we report error on parameter :-/ | |||
let value_size = self.get_string_size(right_type, right_statement.get_location())?; | |||
let size = std::cmp::min(target_size - 1, value_size) as i64; | |||
let align_left = left_type.get_alignment(); | |||
let align_right = right_type.get_alignment(); | |||
let align_left = left_type.get_string_inner_alignment(self.index).bytes(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you had the feeling that the old name was bad ... i agree
but I think we're not talking about alignment here when considering string-encoding
i would use: bytes_per_character - and yes i know there are multi-byte characters
but i would not agree that utf16 is 2byte aligned (it would mean that a utf16 char can only start at an even byte-adress!). for me, alignment talks about the start-adress of a some data, not the inner structure.
src/typesystem.rs
Outdated
self.get_size(index).bits() | ||
} | ||
|
||
pub fn get_size(&self, index: &Index) -> Offset { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this useful to have an Offset here?
src/typesystem.rs
Outdated
DataTypeInformation::Generic { .. } => unimplemented!("generics"), | ||
} | ||
} | ||
|
||
pub fn get_alignment(&self) -> u32 { | ||
/// Returns the String encoding's alignment (charachter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: charachter
Support for debug information for variables that are accessible globally.
Solves #536
Not tested : POU generation