diff options
author | kripken <alonzakai@gmail.com> | 2011-07-29 18:03:37 -0700 |
---|---|---|
committer | kripken <alonzakai@gmail.com> | 2011-07-29 18:03:37 -0700 |
commit | d49f169b48c3a1aa8d50b2b6deaf30b7037b5672 (patch) | |
tree | 8b265c8eb2d051b7d6f5775e6f9afd37417420a4 /src/runtime.js | |
parent | dece1080e837ccddddac1187709cdd669329b1a1 (diff) | |
parent | 0e64105b7e8463ef65a2004d3b0d47a1aa61d98d (diff) |
Merge pull request #57 from max99x/master
Filesystem, unistd, and others
Diffstat (limited to 'src/runtime.js')
-rw-r--r-- | src/runtime.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/runtime.js b/src/runtime.js index 06638fa3..9a6cbc50 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -162,13 +162,18 @@ Runtime = { // { field1: 0, field2: 4 } (depending on QUANTUM_SIZE) // // You can optionally provide a type name as a second parameter. In that - // case, you do not need to provide the types (but you do still need to - // provide the names, since they are not present in the .ll), for example, - // generateStructInfo(['field1', 'field2'], '%struct.UserStructType'); - // (Note that you will need the full %struct.* name here at compile time, - // but not at runtime. The reason is that during compilation we cannot simplify - // the type names yet. At runtime, you can provide either the short or the - // full name.) + // case, you do not need to provide the types. If the .ll contains debugging + // symbols (i.e. it was compiled with the -g flag), you can leave the struct + // parameter entirely empty, for example: + // generateStructInfo(null, '%struct.UserStructType'); + // If the compilation was done without symbols, you will still need to provide + // the names, since they are not present in the .ll, for example: + // generateStructInfo(['field1', 'field2'], '%struct.UserStructType'); + // + // Note that you will need the full %struct.* name here at compile time, + // but not at runtime. The reason is that during compilation we cannot + // simplify the type names yet. At runtime, you can provide either the short + // or the full name. // // When providing a typeName, you can generate information for nested // structs, for example, struct = ['field1', { field2: ['sub1', 'sub2', 'sub3'] }, 'field3'] @@ -179,6 +184,8 @@ Runtime = { offset = offset || 0; type = typeof Types === 'undefined' ? Runtime.typeInfo[typeName] : Types.types[typeName]; if (!type) return null; + if (!struct) struct = Types.structMetadata[typeName.replace(/.*\./, '')]; + if (!struct) return null; assert(type.fields.length === struct.length, 'Number of named fields must match the type for ' + typeName); alignment = type.flatIndexes; } else { |