Bladeren bron

now with generic hashmaps and array lists

master
FelixBrendel 6 jaren geleden
bovenliggende
commit
58e9169c03
6 gewijzigde bestanden met toevoegingen van 17 en 23 verwijderingen
  1. BIN
     
  2. +5
    -1
      src/eval.cpp
  3. +8
    -8
      src/forward_decls.cpp
  4. +1
    -1
      src/ftb
  5. +2
    -10
      src/slime.h
  6. +1
    -3
      src/structs.cpp

+ 5
- 1
src/eval.cpp Bestand weergeven

@@ -252,13 +252,17 @@ proc apply_arguments_to_function(Lisp_Object* arguments, Lisp_Object* function,
filling it in
*/
proc create_arguments_from_lambda_list_and_inject(Lisp_Object* arguments, Lisp_Object* function) -> void {
Arguments* result;;
Arguments* result;
if (Memory::get_type(function) == Lisp_Object_Type::CFunction) {
result = &function->value.cFunction->args;
} else {
result = &function->value.function.args;
}

::new ((&(result->positional.symbols))) Array_List<Lisp_Object*>;
::new ((&(result->keyword.keywords))) Array_List<Lisp_Object*>;
::new ((&(result->keyword.values))) Array_List<Lisp_Object*>;

// first init the fields
// result->positional = create_positional_argument_list(16);
// result->keyword = create_keyword_argument_list(16);


+ 8
- 8
src/forward_decls.cpp Bestand weergeven

@@ -62,14 +62,6 @@ namespace Globals {
Error* error = nullptr;
}

bool hm_objects_match(char* a, char* b) {
return strcmp(a, b) == 0;
}

bool hm_objects_match(void* a, void* b) {
return a == b;
}

unsigned int hm_hash(void* ptr) {
return ((unsigned long long)ptr * 2654435761) % 4294967296;
}
@@ -83,6 +75,14 @@ unsigned int hm_hash(char* str) {
return value ^ i;
}

bool hm_objects_match(char* a, char* b) {
return strcmp(a, b) == 0;
}

bool hm_objects_match(void* a, void* b) {
return a == b;
}

bool hm_objects_match(Lisp_Object* a, Lisp_Object* b) {
return lisp_object_equal(a, b);
}


+ 1
- 1
src/ftb

@@ -1 +1 @@
Subproject commit e782aa70b7ad2a175f11683307e605ad805d5ad3
Subproject commit dd7db5b3308b839995bfa211fb77ced6aa2f696e

+ 2
- 10
src/slime.h Bestand weergeven

@@ -24,19 +24,11 @@
#include "./ftb/types.hpp"
#include "./ftb/macros.hpp"
#include "./ftb/profiler.hpp"

struct Lisp_Object;
u32 hm_hash(Lisp_Object* obj);
unsigned int hm_hash(char* obj);
unsigned int hm_hash(void* obj);
bool hm_objects_match(void* a, void* b);
bool hm_objects_match(char* a, char* b);
bool hm_objects_match(Lisp_Object* a, Lisp_Object* b);

#include "./ftb/hashmap.hpp"
#include "./ftb/arraylist.hpp"

namespace Slime {
#include "./ftb/hashmap.hpp"

# include "./defines.cpp"
# include "./platform.cpp"
# include "./structs.cpp"


+ 1
- 3
src/structs.cpp Bestand weergeven

@@ -33,9 +33,7 @@ enum struct Lisp_Object_Type {
CFunction,
};

typedef uint64_t u64;

enum class Lisp_Object_Flags : u64
enum class Lisp_Object_Flags
{
// bits 1 to 5 (including) will be reserved for the type
Already_Garbage_Collected = 1 << 5,


Laden…
Annuleren
Opslaan