- Start Date: 2014-07-20
- RFC PR #: (leave this empty)
- Rust Issue #: (leave this empty)
Values should be able to be passed as type parameters. The [T, ..n]
fixed length array should be changed to use a value as a type parameter.
This adds the ability to refer to fields of types and use them later on with objects of that type.
The FieldOffset<Obj, Field>
type is added which refers to fields of type Field
in the object Obj
.
The offsetof Type.field
syntax is defined to construct instances of FieldOffset<Type, the type of field>
.
; ModuleID = 'nicer.ll' | |
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-unknown-linux-gnu" | |
define i8 @test({ i8*, i64 } %arg, i64 %arg1) unnamed_addr { | |
"the block": | |
%tmp = extractvalue { i8*, i64 } %arg, 1 | |
%tmp2 = icmp ugt i64 %tmp, %arg1 | |
br i1 %tmp2, label %exit, label %cond.i |
; ModuleID = 'bugpoint-reduced-simplified.bc' | |
target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128" | |
target triple = "x86_64-unknown-linux-gnu" | |
; Function Attrs: noreturn | |
declare void @fail() | |
declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...) | |
define void @test() { |
All code is shared between processes. Processes can not read or write to the code segment. | |
The global code segment is 2 TB. It is split into 1MB blocks, giving 2M blocks in total. | |
A module is a executable or shared library. | |
Each process has an bitmap where each bit represents a block of code of the code segment. | |
With 1 bit per block means the size of the array is 256KB. | |
If a bit is 0, the process does not have access to the block in the code segment. |
#include <stdbool.h> | |
/* | |
* Dummy typedefs for types used. | |
*/ | |
typedef int event_t; | |
typedef int message_t; | |
/* | |
* Prototype for event functions. |
#include <stdio.h> | |
#include <math.h> | |
#include <GLES2/gl2.h> | |
#include <GLES2/gl2ext.h> | |
#include "swl.h" | |
#include "gles.hpp" | |
#include "OpenGL.Texture.hpp" | |
#include <ft2build.h> | |
#include FT_FREETYPE_H |
unit BitClass; | |
interface | |
uses SysUtils; | |
type | |
Bit = 0..7; | |
BitByte = set of Bit; |
> tap { raise "hi" } | |
RuntimeError: hi | |
in main.Kernel(Object)#raise("hi") | |
in main.#<Class:main>(Object)#main(main) | |
Input:1: tap { raise "hi" } | |
~~~~~~~~~~ | |
in #<Proc:0x4c2048>.Proc#call(main) | |
in main.Object#tap() | |
in main.#<Class:main>(Object)#main() |